Effacer les filtres
Effacer les filtres

Matlab symbolic cannot separate real from imaginary

5 vues (au cours des 30 derniers jours)
Lior Rubanenko
Lior Rubanenko le 18 Oct 2020
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,
So basically, the second term (with the complex number in the denominator) is left Re(complex), which is not very helpful.

Réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by