nth root using sym class
2 views (last 30 days)
Show older comments
Hello, I am new to Matlab and am trying to write a script to compute the roots of a quartic equation using analytical procedures. I am attempting to utilize my variables as sym objects so that I can control the numerical precision. The problem I am incurring, is that I have an expression that contains a cube root. It is my understanding that the nthroot() function is not compatible with the sym class. When I try to raise the term to the 1/3 power it produces complex roots when I need the real roots. Is there any way to compute the real cube root of a sym class variable?
P.S. I have found that I can convert to double for the desired expression and use the nthroot() function then convert back to the sym class, but I would prefer to keep everything sym if possible.
Thank You.
0 Comments
Answers (1)
Andrew Newell
on 17 Nov 2011
If you have R2011b, you could use solve, for example,
y = solve(x^3-5,'Principal value','true');
0 Comments
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!