Secant method
Encyclopedia : S : SE : SEC : Secant method
In numerical analysis, the secant method is a root-finding algorithm that uses a succession of roots of secant lines to better approximate a root of a function f.
The method
The secant method is defined by the recurrence relation
- [x_ = x_n - \frac})} f(x_n). ]
Derivation of the method
Given xn−1 and xn, we construct the line through the points (xn−1, f(xn−1)) and (xn, f(xn)), as demonstrated in the picture on the right. Note that this line is a secant or chord of the graph of the function f. In point-slope form, it can be defined as
- [ y - f(x_n) = \frac)}} (x-x_n). ]
- [ f(x_n) + \frac)}} (x_-x_n) = 0. ]
Convergence
The iterates xn of the secant method converge to a root of f, if the initial values x0 and x1 are sufficiently close to the root. The order of convergence is φ, where
- [ \varphi = \frac} \approx 1.618 ]
This result only holds under some technical conditions, namely that f be twice continuously differentiable and the root in question be simple (i.e., that it not be a repeated root).
If the initial values are not close to the root, then there is no guarantee that the secant method converges.
Comparison with other root-finding methods
The secant method does not require that the root remain bracketed like the bisection method does, and hence it does not always converge. The false position method uses the same formula as the secant method. However, it does not apply the formula on xn−1 and xn, like the secant method, but on xn and on the last iterate xk such that f(xk) and f(xn) have a different sign. This means that the false position method always converges.
The recurrence formula of the secant method can be derived from the formula for Newton's method
- [ x_ = x_n - \frac ]
- [ f'(x_n) \approx \frac)}}. ]
Example code
The following C code was written for clarity instead of efficiency. It was designed to solve the same problem as solved by the Newton's method and false position method code: to find the positive number x where cos(x) = x3. This problem is transformed into a root-finding problem of the form f(x) = cos(x) − x3 = 0.
In the code below, the secant method continues until one of two conditions occur:
- [ |x_ - x_n| < e ]
- [ n > m ]
#includeAfter running this code, the final answer is approximately 0.865474033101614. The initial, intermediate, and final approximations are listed below:#include double f(double x) double SecantMethod(double xn_1, double xn, double e, int m) return xn; } int main(void)
- [ x_0 = 0 \,\!]
- [ x_1 = 1 \,\!]
- [ x_2 = 0.685073357326045 \,\!]
- [ x_3 = 0.841355125665652 \,\!]
- [ x_4 = 0.870353470875526 \,\!]
- [ x_5 = 0.865358300319342 \,\!]
- [ x_6 = 0.865473486654304 \,\!]
- [ x_7 = 0.865474033163012 \,\!]
- [ x_8 = 0.865474033101614 \,\!]
External link
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

