Secant:

Path: Math/Solvers

% Finds the solution to f(x) = 0 without derivatives.
   If there are multiple roots, x
   should be in the vicinity of the desired root. Requires two
   initial guesses for the root.

   Since version 1.
--------------------------------------------------------------------------
   Form:
   [x, n] = Secant( f, x0, x00, tol, nMax, varargin )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   f             (1,:)   String name of f(x),  i.e. 'f'
   x0            (1,1)   Initial guess
   x00           (1,1)   Guess prior to the initial guess
   tol           (1,1)   Tolerance
   nMax          (1,1)   Max number of iterations
   varargin              Optional arguments

   -------
   Outputs
   -------
   x             (1,1)   Result
   n             (1,1)   Number of iterations

--------------------------------------------------------------------------
	References:	  Hornbeck, R., Numerical Methods, Quantum, 1975, pp. 70-71.
--------------------------------------------------------------------------

Back to the Math Module page