NewtRaph2:

Path: FormationFlying/Utility

% Newton Raphson solver. 
 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 optional arguments that are passed through to f and fD.
--------------------------------------------------------------------------
   Form:
   [x, n] = NewtRaph( f, fD, x, epsilon, nMax, p1, ... pN )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   f                     Function handle for f(x),    i.e. @f
   fD                    Function handle for df(x)/dx i.e. @dfdx
   x                     Initial guess
   epsilon               Tolerance
   nMax                  Max number of iterations (can be inf)
   p1 ... pN             Optional arguments

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

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

Back to the FormationFlying Module page