2 %> Algorithm 7.3: Newton
's method, n variables. Implementation of algorithm 7.3 of \cite Bier15-book 4 %> @author <a href="http://people.epfl.ch/michel.bierlaire">Michel Bierlaire</a> 5 %> @date Wed Mar 18 21:47:57 2015 9 %> @note Tested with \ref run0711.m 10 %> @note Tested with \ref run0712.m 12 %> Applies Newton's algorithm to solve \f$F(x)=0\f$ where \f$F:\mathbb{R}^n\to\mathbb{R}^n \f$
13 %> @param obj the name of the Octave
function defining F(x) and its Jacobian
14 %> @param x0 the starting point
15 %> @param eps algorithm stops if \f$\|F(x)\| \leq \varepsilon \f$.
16 %> @param maxiter maximum number of iterations (Default: 100)
17 %> @
return [solution,f] solution: root of the
function, f: value of F at the solution
20 [f,J] = feval(obj,xk) ;
22 printf("%d %15.8e %15.8e %15.8e\n",k,xk(1),f(1),norm(f)) ;
23 printf(" %15.8e %15.8e\n",xk(2),f(2)) ;
26 [f,J] = feval(obj,xk) ;
28 printf("%d %15.8e %15.8e %15.8e\n",k,xk(1),f(1),norm(f)) ;
29 printf(" %15.8e %15.8e\n",xk(2),f(2)) ;
30 until (norm(f) <= eps || k >= maxiter)
function newtonNVariables(in obj, in x0, in eps, in maxiter)
Applies Newton's algorithm to solve where .