2 %> Algorithm 7.2: Newton
's method, one variable. Implementation of algorithm 7.2 of \cite Bier15-book 4 %> @author <a href="http://people.epfl.ch/michel.bierlaire">Michel Bierlaire</a> 5 %> @date Wed Mar 18 18:44:56 2015 9 %> @note Tested with \ref run0703.m 10 %> @note Tested with \ref run0704.m 11 %> @note Tested with \ref run0705.m 13 %> Applies Newton's algorithm to solve \f$F(x)=0\f$ where \f$F:\mathbb{R}\to\mathbb{R} \f$
14 %> @param obj the name of the Octave
function defining F(x) and its derivative
15 %> @param x0 the starting point
16 %> @param eps algorithm stops if \f$|F(x)| \leq \varepsilon \f$.
17 %> @param maxiter maximum number of iterations (Default: 100)
18 %> @
return root of the
function 22 [f,g] = feval(obj,xk) ;
24 printf("%d %15.8e %15.8e %15.8e\n",k,xk,f,g) ;
27 [f,g] = feval(obj,xk) ;
29 printf("%d %15.8e %15.8e %15.8e\n",k,xk,f,g) ;
30 until (abs(f) <= eps || k >= maxiter)
function newtonOneVariable(in obj, in x0, in eps, in maxiter)
Applies Newton's algorithm to solve where .