Non-typical system of nonlinear equations

1 view (last 30 days)
I tried to solve this system of equations, using fsolve and various newton-raphson functions, but to no avail:
x*y-z^2-1 = 0
x*y*z+y^2-x^2-2 = 0
e^x+z-e^y-3 = 0
How to bite this?

Accepted Answer

Walter Roberson
Walter Roberson on 30 Dec 2021
Edited: Walter Roberson on 30 Dec 2021
There two real-valued solutions and two complex-valued solutions.
syms x y z
eq1=x.*y-z.^2-1 == 0;
eq2=x.*y.*z+y.^2-x.^2-2 == 0;
eq3=exp(x)+z-exp(y)-3 == 0;
eqns = [eq1, eq2, eq3];
string(eqns)
ans = 1×3 string array
"x*y - z^2 - 1 == 0" "y^2 - x^2 + x*y*z - 2 == 0" "z + exp(x) - exp(y) - 3 == 0"
solx = solve(eqns(1),x)
solx = 
eqns2 = subs(eqns(2:end), x, solx)
eqns2 = 
soly = solve(eqns2(1), y, 'maxdegree', 4)
soly = 
eqns3 = subs(eqns2(2:end), y, soly)
eqns3 = 
solz = arrayfun(@vpasolve, eqns3)
solz = 
backz = solz
backz = 
backy = simplify(arrayfun(@(Y,Z) subs(Y, z, Z), soly, backz))
backy = 
backx = simplify(arrayfun(@(Y,Z) subs(solx, {y, z}, {Y, Z}), backy, backz))
backx = 
X = double(backx(:));
Y = double(backy(:));
Z = double(backz(:));
sols = table(X, Y, Z)
sols = 4×3 table
X Y Z _____________________________________ ___________________________________ ___________________________________ 1.77767191801074+0i 1.42396059788849+0i 1.2374711177317+0i 0.312665572783089-1.92640000714264i -3.6173710991782+6.60644699784i 3.50141439437029+1.29006613162679i -6.00007674738141+0i -1.82891828362435+0i 3.15810862169672+0i -0.0235291143948645-1.64861787491676i 0.226753337733853+4.16490693352808i 2.42290841496534-0.097367728502186i
  1 Comment
KarolN
KarolN on 30 Dec 2021
The best answer of all submitted and works perfect! Thanks! Happy New Year!

Sign in to comment.

More Answers (1)

Yusuf Suer Erdem
Yusuf Suer Erdem on 30 Dec 2021
Edited: Walter Roberson on 30 Dec 2021
Try these codes below please;
syms x y z
eq1=x.*y-z.^2-1 == 0;
eq2=x.*y.*z+y.^2-x.^2-2 == 0;
eq3=exp(x)+z-exp(y)-3 == 0;
solve(eq1,eq2,eq3,x,y,z)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
ans = struct with fields:
x: 1.7776719180107405499159549245637 y: 1.4239605978884890880290410180788 z: 1.2374711177317033717819050711785

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!