
clc,clear

syms x y
f1 = x^2 - 10*x + y^2 + 8;
f2 = x*y^2 + x - 10*y + 8;

x1 = [0,0]';
e = 1e-4;
n = 1;


F = [f1;f2];
dF = jacobian(F);
fprintf('µÚ %d ²½ x1=%g, x2=%g, F=[%g,%g]\n\n',n,x1(1),x1(2),(subs(F,{x,y},{x1(1),x1(2)}))');

while norm( subs(F,{x,y},{x1(1),x1(2)}) )>e 
    
    x1 = x1 - subs(dF,{x,y},{x1(1),x1(2)})\subs(F,{x,y},{x1(1),x1(2)});
    n = n+1;
    fprintf('µÚ %d ²½ x1=%g, x2=%g, F=[%g,%g]\n\n',n,x1(1),x1(2),(subs(F,{x,y},{x1(1),x1(2)}))');

end

