Non-typical system of nonlinear equations

조회 수: 1 (최근 30일)
KarolN
KarolN 2021년 12월 30일
댓글: KarolN 2021년 12월 30일
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?

채택된 답변

Walter Roberson
Walter Roberson 2021년 12월 30일
편집: Walter Roberson 2021년 12월 30일
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
KarolN
KarolN 2021년 12월 30일
The best answer of all submitted and works perfect! Thanks! Happy New Year!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Yusuf Suer Erdem
Yusuf Suer Erdem 2021년 12월 30일
편집: Walter Roberson 2021년 12월 30일
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
  댓글 수: 1
KarolN
KarolN 2021년 12월 30일
This works perfect! Thanks! Happy New Year!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Newton-Raphson Method에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by