Matlab symbolic cannot separate real from imaginary
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am attempting to seperate a complex expression using Matlab's symbolic package.
I have some real V and r, and I know something about the relation between them (i.e., the square root of 9*V^2 - 4/3*V*sym('pi')*r^3 is complex). However, Matlab will not seperate the real and imaginary parts of the expression, even if I used "preferReal" in simplify().
syms V r
assume(V >= 0)
assumeAlso(V,'real')
assumeAlso(r >= 0)
assumeAlso(r,'real')
assumeAlso((9*V^2 - 12*V*sym('pi')*r^3) < 0) % criterion about the relation between V and r
eq = pi / 3 * h^3 - pi * r *h^2+V == 0;
sol = solve(eq, h, 'MaxDegree',3);
simplify(real(sol(1)),'Criterion','preferReal' ,'Steps', 200)
The output of this is,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/383953/image.png)
So basically, the second term (with the complex number in the denominator) is left Re(complex), which is not very helpful.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!