function x=NR2(f,g,x0,tol)
frm=get(0,'Format');x0=[x0(1);x0(2)];
x=x0(1);y=x0(2);
format long;
disp('          n                 xn                  yn')
n=1;
x1=x0-inv(Jacobean(f,g,x0))*[f(x,y);g(x,y)];
while(sqrt(sum((x1-x0).^2))>tol)
    disp([n x1(1) x1(2)]);
    n=n+1;
    x0=x1;
    x=x0(1);y=x0(2);
    x1=x0-inv(Jacobean(f,g,x0))*[f(x,y);g(x,y)];
end
x=x1;
set(0,'Format',frm);