## Author: M. Turhan ÇOBAN
## Created: 2021-06-05
function retval = newton_MD_opt(f,x)
  k=length(x);
  nmax=100;
  tolerance=1.0e-10;
  total=0;
  for i=1:nmax
    fx=dfn(f,x);
    dfx=d2fn(f,x);
    dx=dfx\fx';
    dx=dx';
    for j=1:k
      x(j)=x(j)-dx(j);
    end
    total=0;
    for j=1:k
      total=total+abs(fx(j));
    end
    if total<tolerance
      break;
    end
  end
  retval=x;
endfunction
