Analytical Solution of Double Integral in Symbolic Math
조회 수: 17 (최근 30일)
이전 댓글 표시
The following integral is known to have an analytical solution
int(sin(x)*(a^2*cos(x)^2 + sin(x)^2/a)^(1/2), x)
but Symbolic Math only returns the same command when I try to calculate it between the limits: 0 to pi.
Is there a way to calculate this integral analytically?
댓글 수: 4
David Goodmanson
2022년 11월 24일
Hi Saeid,
I don't much like to say it, but Matlab symbolics is not real capable compared to some other stuff out there. Mathworks does not appear to be too concerned about it. I believe this is because they are after all a commercial entity, and the real money lies elsewhere. Not a great look, but it's hard to blame them.
For this problem you can substitute u = cos(x), du = -sin(x) dx, (1-u^2) = sin(x)^2. Since there are only even powers of sin and cos, integral{0,p1} dx = 2*integral{0,1} du. Saving the minus sign until some later time, you get
% int(sin(x)*(a^2*cos(x)^2 + sin(x)^2/a)^(1/2), x)
syms u a
I1 = int((a^2*u^2 + (1-u^2)/a)^(1/2), u) % doesn't work
but with a little more help
I2 = int(((a^2-1/a)*u^2 + (1/a))^(1/2), u)
Assumptions help a bit.
assume(a<1)
I1 = int((a^2*u^2 + (1-u^2)/a)^(1/2), u) % still doesn't work
I2 = int(((a^2-1/a)*u^2 + (1/a))^(1/2), u)
assume(a>1)
I1 = int((a^2*u^2 + (1-u^2)/a)^(1/2), u) % both work and give the same result
I2 = int(((a^2-1/a)*u^2 + (1/a))^(1/2), u)
Integral I1 only works for a>1 in which case it gives the same result as I2. So consider just I2. For the definite integral
J2 = 2*int(((a^2-1/a)*u^2 + (1/a))^(1/2), u,0,1)
there are three cases above and of these only only the a>1 case works.
J2 = a + log((a^3 - 1)^(1/2) + a^(3/2))/(a*(a^2 - 1/a)^(1/2))
That's it. This does evaluate to 2 as a-->1, as it should.
By all rights the a<1 case should have worked, but given the form it is in, it's a complex function that happens to come out real. So it's hard to see the inverse trig function in there.
In a fairly simple case like this, and given all the messing around one has to do getting syms to cooperate, for me personally it would be faster to rearrange it a bit and go to a table of integrals.
p.s. my fond school days are long gone.
채택된 답변
VBBV
2022년 11월 23일
syms x
a = 2;
sol = int(sin(x).*(a.^2*cos(x).^2 + sin(x).^2/a).^(1/2),x,[0,pi])
vpa(sol) % use vpa
댓글 수: 2
VBBV
2022년 11월 23일
When int is not able to calculate the definite integral for expression, you can use vpa to approximate the value. Otherwise try with integral for numerical integration
VBBV
2022년 11월 23일
편집: VBBV
2022년 11월 23일
As the given expression seems to be nonlinear, a closed form symbolic solution cannot exist for it between 0 and pi, You can instead use integrateByParts option to evaluate and simplify it.
syms x t
a = 2;
sol = int(sin(x).*(a.^2*cos(x).^2 + sin(x).^2/a).^(1/2),x,[0 pi/2])
F = integrateByParts(sol,sin(x)) %
simplify(F)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!