Calculates the zeros of a function using the secant method.
Use the following HTML code to embed the calculators within other websites:
Secant
doublesecant(
double
(*f)(double)[function pointer]
double
x0 = -1E+7
double
x1 = 1E+7
double
eps = 1E-10
int
maxit = 1000
)
This is a root-finding algorithm which assumes a function to be approximately linear in the region of interest. Each
improvement is taken as the point where the approximating line crosses the axis. The secant method retains only
the most recent estimate, so the root does not necessarily remain bracketed.
When the algorithm does converge, its order of convergence is
To give you a better idea on the way this method works, the following graph shows different iterations in the
approximation process. Here is the associated list of pairs chosen at consecutive steps
This algorithm finds the roots of the user-defined function f starting with an initial interval [x0, x1] and iterating
the sequence above until either the accuracy eps is achieved or the maximum number of iterations maxit
is exceeded.
References:
Jean-Pierre Moreau's Home Page, http://perso.wanadoo.fr/jean-pierre.moreau/
F.R. Ruckdeschel, "BASIC Scientific Subroutines", Vol. II, BYTE/McGRAWW-HILL, 1981