function xn = newton2(x0,tol,N)
% 2D Newton's Method
xn = x0; err = 1; k = 1;
while ((err > tol)&&(k < N))
    x1 = xn;
    xn = x1 - J2(x1)\g2(x1)
    err = abs(norm(x1)-norm(xn))
    k = k+1;
end
end

