What does "z" stand for in the "solve" function?
33 views (last 30 days)
Show older comments
Hi I'm currently working on a project and am trying to solve for x. Here is the code I am using:
h = 0.181356;
syms x;
S = (x^4)-(h/x)^2 == (h/14)^2;
SS = solve (S,x);
pretty (SS)
It's pretty simple but when I run the script I receive this,
/ root(#1, z, 1) \
| |
| root(#1, z, 2) |
| |
| root(#1, z, 3) |
| |
| root(#1, z, 4) |
| |
| root(#1, z, 5) |
| |
\ root(#1, z, 6) /
where 2
6 3095476475855217 z 42693659278536807904771815370441
#1 == z - -------------------- - ----------------------------------
18446744073709551616 1298074214633706907132624082305024
Can anyone explain what this means? I know there are 6 roots but I want to find those soulutions explicitly.
0 Comments
Answers (1)
Walter Roberson
on 26 Nov 2018
SS = solve (S,x, 'MaxDegree', 4);
You cannot usually find explicit solutions to a degree 6 polynomial, but you can in this case. Because there are no odd powers, you can do a substitution of variables to reduce it to a cubic, find the roots, and then take +/- those. MATLAB does that automatically in this case.
But to answer your question, root(f(z),z) stands for the set of values, z, such that f(z) == 0 -- the roots of f(z). The root() form can be used to express roots of polynomials even with degree higher than 4 (the maximum that is certain to have explicit roots.) .
These roots can be ordered somehow, and there would generally be N of them where N is the maximum degree of f(z). root(f(z),z,M) is the M'th of the N roots, according to whatever the internal ordering rule is. We do not know what the ordering is, just that for any given formula, it is consistent. It is a programming mistake to count on a particular root number corresponding to a particular meaning, but you can get away with it for any given MATLAB release (but the next release could potentially use a different ordering.) In particular do not count on the first root as being real valued (if any of the roots are) or positive (if any of them are even positive.) If you need a root with particular properties, it is better to take all of the roots and test them to see which ones have that property.
0 Comments
See Also
Categories
Find more on Number Theory 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!