function [w, it] = newtongaussmv(w)
% multivariate Newton method
%w is initial guess
%tol is the tolerance to solve to
% requires functions f coded separately
%syms x y z d;
%v = [x,y,z,d];
%jf = jacobian(f(v),v);

it = 0;
fx = Sgn(w);
%while norm(fx) > tol
while it < 20
   Jx = jfgn(w);
   w = w - (transpose(Jx)*Jx) \ (transpose(Jx)*fx);
   %w
   fx = Sgn(w);
   it = it + 1;
   %fprintf('Iteration %d: approx root = [%f,%f]\n', it, w);
   it;
   w;
end;