2 %> Algorithm 8.4: Newton
's secant method, n variables. Implementation of algorithm 8.4 of \cite Bier17-book 4 %> @author <a href="http://people.epfl.ch/michel.bierlaire">Michel Bierlaire</a> 5 %> @date Thu Mar 19 18:41:39 2015 9 %> @note Tested with \ref run0711sec.m 11 %> Applies Newton's secant algorithm to solve \f$F(x)=0\f$ where \f$F:\mathbb{R}^n\to\mathbb{R}^n \f$
12 %> @param obj the name of the Octave
function defining F(x) and its Jacobian
13 %> @param x0 the starting point
14 %> @param eps algorithm stops if \f$\|F(x)\| \leq \varepsilon \f$.
15 %> @param maxiter maximum number of iterations (Default: 100)
16 %> @
return root of the system
21 printf("%2d %+15.8e %+15.8e %+15.8e\n",k,xk(1),f(1),norm(f)) ;
22 printf(" %+15.8e %+15.8e\n",xk(2),f(2)) ;
32 A = A + ((y- A*d) * d') / (d' * d) ;
34 # printf("%2d %+15.8e\n",k,norm(f)) ; 35 printf(
"%2d %+15.8e %+15.8e %+15.8e\n",k,xk(1),f(1),norm(f)) ;
36 printf(
" %+15.8e %+15.8e\n",xk(2),f(2)) ;
37 until (norm(f) <= eps || k >= maxiter)
function secantNVariables(in obj, in x0, in eps, in maxiter)
Applies Newton's secant algorithm to solve where .