clear all
f = @(x) [x(1)^2+x(2)^2-1;...
          sin(pi*x(1)/2)+x(2)^3];
Jf = @(x) [2*x(1),              2*x(2);...
          cos(pi*x(1)/2)*pi/2, 3*x(2)^2];
x0 = [1;1];
tol = 1e-6;
x = x0;
delta = -Jf(x)\f(x);
while (norm(delta,inf) > tol)
  x = x+delta;
  delta = -Jf(x)\f(x);
end
x
