Secant Method and Order of Convergence
Learning Objectives
- Derive the secant method from Newton's method and count its cost in function evaluations.
- State the formal definition of order of convergence, and tell a true order from a bound on a bracket.
- Derive the error relation and, from it, the order .
- Measure that order from the errors of a run, and explain why float64 alone gives only a rough value.
- Compare Newton and the secant method per evaluation under a stated cost model, and break each hypothesis of the order theorem.
Context & Motivation
newtons-method needs at every step. Often no formula for it exists: may be a simulation, a solver call, or a closed library. The secant method keeps the idea of solving a line and replaces the tangent by the line through the last two points, so it needs only values of .
The cost is a lower order, and the surprise is that the lower order can still win. Order per iteration is the wrong yardstick when iterations cost different amounts. This lesson makes "order" precise, derives the unusual value , and measures it.
Core Theory
From Newton to the secant
Replace in Newton's iteration by the slope through the last two iterates:
It needs two distinct starting points, which need not surround the root. Since is already stored, each iteration costs one new evaluation, so costs evaluations in total for . The step is undefined when , where the secant line is horizontal.
Order of convergence, formally
Let with . The sequence has order with constant if
with also required when . Order 1 is linear and order 2 is quadratic. If the convergence is superlinear, which every satisfies. This is an asymptotic statement about one sequence, under the hypotheses of whatever theorem produced it.
Not every convergent sequence has an order. A weaker notion only asks that for some sequence that has order . Bisection is the standard case: the bracket half-width has order 1 with constant , but the midpoint errors in general do not. On the equation of Example 1, starting from , the ratio ranged from to within 15 steps and settled on nothing. Special cases exist: for on the ratio is exactly .
If held exactly, then , which gives the measurement used throughout:
The error relation
Let and , and write the signed error . The secant line through and is the degree-1 interpolant of , so for every
Set , use , and note that the first two terms are the line, which vanishes at . This gives an exact formula:
For , and for points between the arguments. So near a simple root the fraction tends to , the same constant as Newton's. Newton's error is proportional to ; here one of the two factors is the older, larger error.
The order is the golden ratio
Hypotheses. near , , , , and are close enough to . Conclusion. with order and constant .
The reason shows up in a logarithm. With , the relation becomes , the Fibonacci recurrence. Its solutions are . Convergence means , so , the second term dies out, and . For the constant, suppose . Then , and substituting gives . Matching exponents gives , and matching constants gives . This argument treats as ; a full proof bounds the fraction above.
Worked Examples
Example 1: the order measured
Solve Kepler's equation from newtons-method, , with , . In float64, against a reference root computed to 2000 digits:
textk x_k e_k e_k/(e_{k-1}e_{k-2}) p_k 0 1.0 2.881e-01 1 1.5 2.119e-01 2 1.2785142391301476 9.577e-03 0.1569 3 1.2877773371566017 3.140e-04 0.1547 1.104 4 1.2880917861898569 4.730e-07 0.1573 1.901 5 1.2880913131884923 2.335e-11 0.1572 1.526 6 1.2880913132118377 1.177e-17
The two-term ratio already matches . The order column does not settle: float64 gives only three clean values, , , , and the term still matters at that stage. At the relation predicts , below the rounding error, and is simply the float nearest . Then , , and the formula for is , so a stopping test is mandatory rather than optional. scipy.optimize.newton(f, 1.0, x1=1.5, tol=1e-12), which runs the secant method when no fprime is given, stops after 6 iterations with a result one float away, because it writes the update differently.
The limit needs more digits, so here is the same iteration at 2000 digits:
textk e_k e_k/(e_{k-1}e_{k-2}) e_k/e_{k-1}^phi p_k 6 1.736e-18 0.1572012 0.27676 1.6553 8 1.738e-48 0.1572012 0.30198 1.6234 10 4.757e-127 0.1572012 0.31221 1.6188 12 9.732e-333 0.1572012 0.31620 1.6181 14 3.047e-871 0.1572012 0.31774 1.6181
approaches and the third column heads for , in agreement with the theorem.
Example 2: Newton against the secant method, per evaluation
Same equation, with Newton from . Counting and as one evaluation each, and listing the error of the best iterate those evaluations can produce:
textevaluations Newton Secant (x1 = 1.5) 2 1.3e-02 9.6e-03 3 3.1e-04 4 2.7e-05 4.7e-07 5 2.3e-11 6 1.2e-10 1.2e-17 8 1.2e-17
The secant method wins here despite the lower order. The result does depend on : with it reaches the rounding floor at 7 evaluations, and with at 6.
Asymptotically, the number of correct digits is multiplied by per iteration, so per unit of work it is multiplied by , where is the work of one iteration. If costs times as much as , Newton gets and the secant method gets . At that is against . The two are equal at , so Newton is ahead only when costs less than about 44% of . Kepler's only adds a to the of , and if both come from one call then is near and Newton is ahead, even though the table above, which charges full price for , favors the secant method. The model ignores the starting phase and rounding, and it assumes both methods are in their asymptotic regime.
Example 3: each hypothesis removed
. For the iteration is exactly , again Fibonacci, so the ratio tends to and the order is 1. On , with double root and starts and , the ratio reaches by , then rounding breaks it and the run freezes at at , near the floor Newton hit. Per evaluation this is still better than Newton's per two evaluations, which is per evaluation.
. For and , , so instead. The same argument gives , so . Measured from , , in float64 (the root at leaves plenty of exponent range):
textk e_k e_k/(e_{k-1}e_{k-2}^(1/2)) p_k 6 8.657e-06 0.7315 1.349 9 8.960e-14 0.9508 1.359 13 3.609e-46 1.0002 1.366
. Removing this one speeds the method up. For at , , so , and gives . A 6000-digit run from , gives of , , , , and the ratio settles at . Still, by the definition above this sequence has no order. Here plus a constant obeys , with roots and , and the term never dies out relative to the constant: alternates between and from to , with no drift. So , yet no limit exists, the same distinction drawn for bisection. The value is therefore a statement under its hypotheses, not a property of the method alone.
Good starts. For with , the two values of are equal and the first step divides by zero, although roots lie between the starts. For , starts , give , , , , and diverge, while , converge. At high eccentricity (, ), starts , stay below and reach the root at , a calmer run than Newton's excursion to in newtons-method. That is one case: neither method is safe from a bad start.
Example 4: a black box, where does not exist as code
A projectile with quadratic drag obeys , with m/s², per meter, and launch speed m/s. Find the angle below the maximum-range angle that lands at m. The range has no formula, so is one call to scipy.integrate.solve_ivp with method='DOP853', at about 270 right-hand-side evaluations. With starts and , rtol=1e-11 and atol=1e-13:
textevaluations theta (degrees) f(theta) (m) 3 22.160585688 -2.93 4 22.957456986 -3.83e-01 5 23.077269499 -1.70e-02 6 23.082829199 -1.06e-04 7 23.082864214 -2.98e-08 8 23.082864223534 1.47e-10
Later iterates only bounce: stays between and , the noise of the integrator. Rerunning with rtol=1e-5 and atol=1e-7 takes the same number of steps and arrives at , off by degrees. The secant method converges just as fast to the root of the function it was given. Order describes that speed and says nothing about how accurately was computed.
Example 5: keeping a bracket
The secant method can leave the root's neighborhood, so a tempting fix is regula falsi: use the same line, but replace whichever endpoint keeps a sign change. Counting the evaluation at which a point within of is first evaluated, on Example 1's equation over :
textbisection 36 regula falsi 13 scipy.optimize.brentq 7 secant (1, 1.5, no bracket) 6
Regula falsi is only linear here. The function is convex on the bracket, so the endpoint never moves, and the error ratio settles at . Keeping the bracket that way gives up the superlinear order. brentq keeps a bracket and combines bisection with inverse quadratic interpolation, which is why it is the usual default when a sign change is known.
Common Misconceptions & Pitfalls
- "Order 1.618 means it is slower than Newton." Per iteration, yes. Per evaluation it can be faster (Example 2), unless is cheap.
- "The starts must bracket the root." They need not, and starts that do are not safe either: from fails at the first step.
- "The secant method is regula falsi." Same line, different bookkeeping. Regula falsi keeps a sign change and drops to linear order (Example 5).
- "A float64 run shows the order." It gives a few noisy values of . In Example 1 the ratio was far more informative.
- "The order is , always." It requires a simple root, , and . Without those, Example 3 measured and , and a case where with no order at all.
- "Bisection has order 1." Its bracket does; its midpoint errors in general have no limiting ratio.
- "A faster order means a more accurate answer." Example 4 converged at full speed to a value limited by the accuracy of .
- "Keep iterating to be safe." After convergence the denominator is pure rounding noise, or exactly zero. Stop on the step size and the residual, and cap the iterations.
Summary
The secant method replaces by the slope through the last two points, so it costs one evaluation per iteration and needs no derivative. Order is defined by , and it is measured with ; bisection's midpoints in general have no such limit, only a bound. The exact relation gives , a Fibonacci recurrence for the logarithms, and so order with constant , for a simple root of a function with and good starts. High-precision runs reach and ; float64 gives only a rough value. Asymptotically, per evaluation, the secant method beats Newton when costs more than about 44% of . Without the hypotheses the measured order changed to or , tended to with no true order, or the run failed. When a bracket is known, brentq is the usual choice.
Documentation Links
- Driscoll and Braun: Fundamentals of Numerical Computation, 4.4 Interpolation-based methods
- Demanet (2012): MIT 18.330 Introduction to Numerical Analysis, Chapter 4: Nonlinear equations
- SciPy documentation: scipy.optimize.newton
- SciPy documentation: scipy.optimize.brentq
- SciPy documentation: scipy.optimize.bisect
- SciPy documentation: scipy.integrate.solve_ivp