Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Halley’s method and fixed points

ProblemSolve using the first and second derivatives, and solve for a fixed point of
Devised byEdmond Halley (1694); Alexander Aitken (1926), the process; Johan Steffensen (1933)
AccuracyTo the requested step size, near a simple root or a fixed point with
CostHalley: three evaluations (, , ) per iteration, cubic convergence. Steffensen: two evaluations of per iteration, quadratic convergence
Read firstNewton’s method and the secant method
APIhalley, fixed_point, FixedPointMethod

Overview

Newton’s method fits a straight line to at each iterate. Halley’s method fits the osculating hyperbola instead, using as well, and converges cubically: the number of correct digits triples at each step. It is SciPy’s newton when fprime2 is given. It pays when is cheap given and , as for polynomials, (the Lambert W function) or Kepler’s equation.

A fixed point of is a solution of . Plain iteration converges only if , and then only linearly, at rate . Steffensen’s method applies Aitken’s extrapolation to each pair of steps. It converges quadratically, without derivatives, even where plain iteration diverges. It is SciPy’s optimize.fixed_point (method="del2").

Where it is used

Fixed points and faster-converging iterations.

  • Fixed-point iteration. Many engineering formulas are implicit, such as the friction factor or the pressure in an equation of state; iterating solves them.
  • Halley’s method. Cubic convergence when second derivatives are cheap, as in the computation of special functions.
  • Convergence analysis. The same theory explains why iterative solvers for linear systems converge or fail.

History

Edmond Halley (1694) published his method for the roots of polynomials, as an improvement of the methods of Newton and Raphson. Its geometric derivation by osculating hyperbolas is due to George Salehov (1952). Alexander Aitken (1926) introduced the process to accelerate Bernoulli’s method for polynomial roots. Johan Steffensen (1933) applied it to fixed-point iteration, and so obtained a derivative-free method with the convergence order of Newton’s.

The idea

Halley. Expanding to second order gives . Substituting the Newton step on the right gives SciPy applies the correction only when , and otherwise takes the Newton step. Near a simple root the error satisfies .

Steffensen. If linearly, with , then three successive iterates determine both and : Restarting the iteration from this extrapolation at every step gives quadratic convergence. Near , the step behaves like a secant step for . This is why it converges even when : the fixed point of repels plain iteration, which wanders chaotically instead, but Steffensen’s method finds it.

Algorithm

Halley (as SciPy’s newton with fprime2): repeat at most 50 times: if stop; ; ; if , ; ; stop when tol.

Steffensen (as SciPy’s fixed_point): repeat at most maxiter times: , , ; , or if ; stop when xtol; .

Implementation

/// Finds a root of `f` by Halley's method from `x0`, as SciPy's `newton` with `fprime2`: the
/// Newton step `δ = f/f'` is divided by `1 − δ f''/(2f')` whenever that correction is below one
/// in magnitude. Stops when successive iterates differ by at most `tol` (SciPy's default is
/// 1.48·10⁻⁸) or `f(x)` is exactly zero; errors on a zero derivative or after 50 iterations.
/// Converges cubically near a simple root.
pub fn halley<F, D, D2>(f: F, df: D, d2f: D2, x0: f64, tol: f64) -> Result<f64, ErrorsJSL>
where
    F: Fn(f64) -> f64,
    D: Fn(f64) -> f64,
    D2: Fn(f64) -> f64,
{
    let mut x = x0;
    for _ in 0..50 {
        let fx = f(x);
        if fx == 0.0 {
            return Ok(x);
        }
        let d = df(x);
        if d == 0.0 || !d.is_finite() {
            return Err(ErrorsJSL::RuntimeError("halley: derivative is zero or non-finite"));
        }
        let mut step = fx / d;
        let adj = step * d2f(x) / d / 2.0;
        if adj.abs() < 1.0 {
            step /= 1.0 - adj;
        }
        let next = x - step;
        if !next.is_finite() {
            return Err(ErrorsJSL::RuntimeError("halley: iterate diverged"));
        }
        if (next - x).abs() <= tol {
            return Ok(next);
        }
        x = next;
    }
    Err(ErrorsJSL::RuntimeError("halley: failed to converge in 50 iterations"))
}
/// Finds a fixed point of `g` from `x0` (SciPy's `fixed_point`). With [`FixedPointMethod::Del2`]
/// each step takes `p₁ = g(p₀)`, `p₂ = g(p₁)` and extrapolates
/// `p = p₀ − (p₁ − p₀)²/(p₂ − 2p₁ + p₀)` (or `p₂` when the denominator vanishes), which converges
/// quadratically even where plain iteration converges linearly — or not at all. Stops when the
/// relative change `|p/p₀ − 1|` (`|p|` at `p₀ = 0`) is below `xtol` (SciPy: 10⁻⁸); errors after
/// `maxiter` steps (SciPy: 500).
pub fn fixed_point<G>(g: G, x0: f64, xtol: f64, maxiter: usize, method: FixedPointMethod) -> Result<f64, ErrorsJSL>
where
    G: Fn(f64) -> f64,
{
    let mut p0 = x0;
    for _ in 0..maxiter {
        let p1 = g(p0);
        let p = match method {
            FixedPointMethod::Iteration => p1,
            FixedPointMethod::Del2 => {
                let p2 = g(p1);
                let d = p2 - 2.0 * p1 + p0;
                if d != 0.0 { p0 - (p1 - p0) * (p1 - p0) / d } else { p2 }
            }
        };
        if !p.is_finite() {
            return Err(ErrorsJSL::RuntimeError("fixed_point: iterate is not finite"));
        }
        let relerr = if p0 != 0.0 { (p / p0 - 1.0).abs() } else { p.abs() };
        if relerr < xtol {
            return Ok(p);
        }
        p0 = p;
    }
    Err(ErrorsJSL::RuntimeError("fixed_point: failed to converge"))
}
  • Both functions are scalar. SciPy’s versions also accept arrays, solving many independent problems at once; in Rust that is a loop.
  • fixed_point with FixedPointMethod::Iteration is plain iteration with the same stopping test.

In practice

The references are from SciPy 1.17.1, written by book/generator/data/make_calc28_refs.py, with SciPy’s default tolerances (tol = 1.48e-8, xtol = 1e-8) and starting points 1 for Halley’s method:

Table 4.7. Halley's method and Steffensen's fixed-point method against `scipy.optimize`.

ProblemRoot or fixed pointDifference from SciPyFunction evaluations
halley: x³ = 102.15443469003188405
halley: E − 0.9 sin E = 0.31.10351772030308703
halley: w eʷ = 51.32672466524220004
fixed_point: x = √(10/(x + 2))1.65424915785675908
fixed_point: x = cos x0.73908513321516108
fixed_point: x = 3.5 x (1 − x), repelling0.71428571428571408

The library takes the same steps as SciPy and returns the same bits.

Figure 4.7. Error against function evaluations. Plain iteration on gains a factor of per step; Steffensen's method reaches rounding in four steps. Counting and as evaluations, Halley's cubic convergence on is no faster than Newton's quadratic convergence: its efficiency index is , Newton's .

Strengths

  • Halley’s method needs fewer iterations than Newton’s, which matters when each iteration’s overhead (not the derivatives) dominates, or when is almost free.
  • Steffensen’s method needs no derivatives, converges quadratically, and finds repelling fixed points.

Weaknesses

  • Neither method is globally convergent; far from the solution both can wander or diverge. A bracketing method is safer when a bracket is known.
  • Steffensen’s denominator loses accuracy near convergence; the stopping test must trigger before it is pure rounding error.

Exercises

  1. Show that Halley’s method is Newton’s method applied to .
  2. Apply Halley’s method to and show that the iteration is .
  3. Show that Aitken’s extrapolation is exact for a sequence .
  4. For , compute and explain why plain iteration cannot converge to .
Hints and answers
  1. With , , which is Halley’s step.
  2. and , so .
  3. and , so the formula returns .
  4. , so . Errors grow by a factor of 1.5 per step.

Further reading

  • E. Halley, “A new, exact and easy method of finding the roots of equations generally”, Philosophical Transactions of the Royal Society 18 (1694) 136–148.
  • A. C. Aitken, “On Bernoulli’s numerical solution of algebraic equations”, Proceedings of the Royal Society of Edinburgh 46 (1926) 289–305.
  • J. F. Steffensen, “Remarks on iteration”, Scandinavian Actuarial Journal (1933) 64–72.
  • T. R. Scavo and J. B. Thoo, “On the geometry of Halley’s method”, American Mathematical Monthly 102 (1995) 417–426.
  • A. M. Ostrowski, Solution of Equations and Systems of Equations, 2nd ed., Academic Press (1966).