Why does MATLAB (Symbolic Math Toolbox) not integrate this simple function.
1 view (last 30 days)
Show older comments
I am trying to integrate the following function symbolically, but MATLAB won't resolve this.
syms x a
int((1-x^2/a^2)^(3/2),x,-a,a)
It should be and Wolfram Alpha calculates it without problem. Is there a way to get this result in MATLAB too?
0 Comments
Answers (3)
John D'Errico
on 3 Jun 2022
Edited: John D'Errico
on 4 Jun 2022
Your problem is, you need to define a properly. So, if you do only this:
syms x a
I = int((1-x^2/a^2)^(3/2),x)
Now you see that MATLAB finds a solution, but it does not know anything about a. We can try this, but MATLAB is still confused.
simplify(subs(I,a) - subs(I,-a))
The problem there is, if a takes on some general complex value, that result may not be a simple thing. The point being:
syms a
simplify(a*sqrt(-1/a^2))
syms a real
simplify(a*sqrt(-1/a^2))
For real a, that last one reduces to +/-i, depending on the sign of a.
syms a real positive
simplify(a*sqrt(-1/a^2))
Only in the third case does a drop out completely.
So if we specify a more clearly.
syms x
syms a real positive
I = int((1-x^2/a^2)^(3/2),x)
simplify(subs(I,a) - subs(I,-a))
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!