What is z1 appearing when solving this nonlinear system for x y and z?

57 ビュー (過去 30 日間)
giannit
giannit 2020 年 3 月 24 日
コメント済み: giannit 2020 年 3 月 24 日
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:

採用された回答

Steven Lord
Steven Lord 2020 年 3 月 24 日
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.
  2 件のコメント
giannit
giannit 2020 年 3 月 24 日
Consider the same nonlinear system as before but with unknown parameters a, b and g, moreover add conditions on the parameters (g>0, b>0, a>b)
syms x y z a b g
eq1 = 0 == -x^2/g-2*a*x-y^2/g+2*b*y+1;
eq2 = 0 == a*x-a*y-b*y+b*z-x*y/g-y*z/g;
eq3 = 0 == -y^2/g+2*a*y-z^2/g-2*b*z+1;
[x,y,z] = solve([eq1, eq2, eq3, g>0, b>0, a>b], [x, y, z])
Do you know why in this case the code provides empty solutions?
Warning: Unable to find explicit solution. For options, see
help.
> In solve (line 317)
In test (line 15)
x =
Empty sym: 0-by-1
y =
Empty sym: 0-by-1
z =
Empty sym: 0-by-1

サインインしてコメントする。

その他の回答 (1 件)

Stijn Haenen
Stijn Haenen 2020 年 3 月 24 日
You can try to use the function vpasolve instead of solve

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by