What is z1 appearing when solving this nonlinear system for x y and z?
11 views (last 30 days)
Show older comments
I'm trying to solve the following nonlinear system
g = 1;
b = 1;
a = b+1;
syms x y z
eqn1 = 0 == -x^2/g-2*a*x-y^2/g+2*b*y+1;
eqn2 = 0 == a*x-a*y-b*y+b*z-x*y/g-y*z/g;
eqn3 = 0 == -y^2/g+2*a*y-z^2/g-2*b*z+1;
[x,y,z] = solve([eqn1, eqn2, eqn3], [x, y, z])
When running the code I was expecting to get numeric solutions, but instead each one of them contain z1, which I think is linked to the variable z (maybe it has to do with real or complex parts?). If I write z1 in the command window and press Enter, the error "Unrecognized function or variable 'z1'." appears.
These are the solutions:
x =
(230*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 1)^2)/361 + (100*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 1)^3)/361 + (21*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 1))/361 - 101/361
(230*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 2)^2)/361 + (100*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 2)^3)/361 + (21*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 2))/361 - 101/361
(230*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 3)^2)/361 + (100*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 3)^3)/361 + (21*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 3))/361 - 101/361
(230*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 4)^2)/361 + (100*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 4)^3)/361 + (21*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 4))/361 - 101/361
y =
(42*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 1)^2)/19 + (10*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 1)^3)/19 + (4*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 1))/19 - 31/19
(42*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 2)^2)/19 + (10*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 2)^3)/19 + (4*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 2))/19 - 31/19
(42*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 3)^2)/19 + (10*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 3)^3)/19 + (4*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 3))/19 - 31/19
(42*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 4)^2)/19 + (10*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 4)^3)/19 + (4*root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 4))/19 - 31/19
z =
root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 1)
root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 2)
root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 3)
root(z1^4 + (32*z1^3)/5 + (241*z1^2)/25 - (103*z1)/25 - 739/100, z1, 4)
The code above corresponds to the following system:
0 Comments
Accepted Answer
Steven Lord
on 24 Mar 2020
Theoretically you could write out the roots of a quartic equation. There's a picture on the Wikipedia page for quartic function that shows the roots. The expressions in the picture are quite long, so Symbolic Math Toolbox doesn't put them in the solution. Instead it uses the root function to represent those roots. In order to write out the polynomials whose roots root represent, it needs to introduce a "temporary" variable. In this case that temporary variable is z1.
If you want to see the numeric solutions call double or vpa on the variables returned by solve.
More Answers (1)
See Also
Categories
Find more on Systems of Nonlinear Equations 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!