Analytical Solution of Double Integral in Symbolic Math
13 次查看(过去 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!