How to shorten the output of a system of equations?
3 views (last 30 days)
Show older comments
Aminul Haque Shawon
on 11 Oct 2020
Commented: christos d
on 3 Jan 2021
Hi! I am trying to solve a system of equations like the one below.
u = sym('u');
v = sym('v');
w = sym('w');
a = sym('a');
eqn = [u + i*v == 0, u + v*exp(i) + w == 3, w == a];
[sol_u, sol_v, sol_w] = solve(eqn, u, v, w);
The output I get for sol_u is
sol_u =
9646051260569284469454035484672/6430700840379523962456038802037 - a*(3215350420189761489818011828224/6430700840379523962456038802037 - 10958632677415100254319546466304i/6430700840379523962456038802037) - 32875898032245300762958639398912i/6430700840379523962456038802037
I tried using:
sol_u = double(sol_u);
But MATLAB gives me an error saying "Error using symengine, Unable to convert expression into double array."
How can display the output of these equations in a shorter format(i.e double)?
Thank you.
0 Comments
Accepted Answer
Walter Roberson
on 11 Oct 2020
vpa()
2 Comments
christos d
on 3 Jan 2021
vpa does work but it still displays too many digits.Is there a way to reduce them like format short on non-symbolic expressions?
More Answers (0)
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!