NewtRaph:

Path: Math/Solvers

% Newton Raphson root finding method
 Finds the solution to f(x) = 0 given df(x)/dx when only one root is possible.
 If there are multiple roots, x should be in the vicinity of the desired root.
 Accepts up to 10 optional arguments that are passed through to f and fD.
--------------------------------------------------------------------------
   Form:
   [x, n] = NewtRaph( f, fD, x, epsilon, nMax, varargin )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   f                     String name of f(x),    i.e. 'f'
   fD                    String name of df(x)/dx i.e. 'dfdx'
   x                     Initial guess
   epsilon               Tolerance
   nMax                  Max number of iterations (can be inf)
   varargin              Optional arguments

   -------
   Outputs
   -------
   x                     Result
   n                     Number of iterations

--------------------------------------------------------------------------
	References:	Hornbeck, R., Numerical Methods, Quantum, 1975, pp. 66-67.
--------------------------------------------------------------------------

Back to the Math Module page