fhat. GitHub Workspace

Richardson extrapolation

Estimate the error of a computed result and make it more accurate.

order estimated from the runs · 2+ runs · improved estimate · error estimate · observed order

Also known as deferred approach to the limit

Placeholderv0.1.3Example

Use with your agent

Use the fhat method "richardson-extrapolation" (https://fhat.dev/methods/richardson-extrapolation/SKILL.md) for this problem. Check first whether it applies.

Placeholder (demo). Description only: there is no reference implementation or verification for this entry yet. It belongs to a demonstration set of textbook methods.

What it does

If a quantity computed with step hh has error A(h)−A=Chp+O(hp+1)A(h) - A = C h^p + O(h^{p+1}), then two runs at hh and h/2h/2 give an improved estimate A≈A(h/2)+(A(h/2)−A(h))/(2p−1)A \approx A(h/2) + \big(A(h/2) - A(h)\big)/(2^p - 1), and the correction term itself estimates the error of A(h/2)A(h/2). With three runs at hh, h/2h/2, h/4h/4, the observed order is p≈log⁡2A(h)−A(h/2)A(h/2)−A(h/4)p \approx \log_2 \frac{A(h) - A(h/2)}{A(h/2) - A(h/4)}, so the order does not have to be known in advance.

Mind the sign. Write the error of a result as computed minus exact. The correction (A(h/2)−A(h))/(2p−1)\big(A(h/2) - A(h)\big)/(2^p - 1) is what you add to A(h/2)A(h/2); it equals minus the estimated error of A(h/2)A(h/2), and it continues the trend the results already show as hh shrinks.

Which pp to use: if the method's theoretical order is known and the observed order agrees with it, use the theoretical value; otherwise use the observed one. Three runs give only one estimate of pp; a fourth run at h/8h/8 shows whether the observed order is stable, which means the step sizes are in the asymptotic range. The extrapolated value has a smaller error of higher order whose size is not estimated by this procedure.

Worked example. A second-order method gives A(h)=2.0480A(h) = 2.0480, A(h/2)=2.0120A(h/2) = 2.0120, A(h/4)=2.0030A(h/4) = 2.0030:

  • observed order: p≈log⁡22.0480−2.01202.0120−2.0030=log⁡20.03600.0090=2.00p \approx \log_2 \frac{2.0480 - 2.0120}{2.0120 - 2.0030} = \log_2 \frac{0.0360}{0.0090} = 2.00, matching the theoretical order;
  • correction for the best result: (A(h/4)−A(h/2))/(2p−1)=(2.0030−2.0120)/3=−0.0030\big(A(h/4) - A(h/2)\big)/(2^p - 1) = (2.0030 - 2.0120)/3 = -0.0030;
  • so the error of A(h/4)A(h/4) is about +0.0030+0.0030 (it is too high by about 0.00300.0030);
  • improved estimate: A(h/4)+correction=2.0030−0.0030=2.0000A(h/4) + \text{correction} = 2.0030 - 0.0030 = 2.0000.

Check: the results decrease as hh shrinks (2.0480→2.0120→2.00302.0480 \to 2.0120 \to 2.0030), and the improved value continues that trend.

When to use

  • You have, or can cheaply compute, results at two or more step sizes and want an error estimate or a more accurate value.
  • Checking a new implementation: the observed order should match the method's theoretical order.

When not to use (and what to use instead)

Situation Use instead
The error does not behave like ChpC h^p: step too large (not yet asymptotic), non-smooth solution, chaotic long-time dynamics Reduce the step until the observed order is stable, or report the spread between runs instead
Rounding error dominates (very small steps) Use larger steps; extrapolation amplifies noise
You only need step-size control during an ODE run An adaptive method such as dormand-prince-rk45, which estimates the error at every step

Key facts

Needs the order pp (two runs) or estimates it (three runs). Outputs: an improved estimate, an error estimate and the observed order.

Sources

  • L. F. Richardson. The approximate arithmetical solution by finite differences of physical problems involving differential equations. Philosophical Transactions of the Royal Society A 210 (1911) 307–357. https://doi.org/10.1098/rsta.1911.0009
  • L. F. Richardson, J. A. Gaunt. The deferred approach to the limit. Philosophical Transactions of the Royal Society A 226 (1927) 299–361. https://doi.org/10.1098/rsta.1927.0008

The methods shown are examples. More research methods are coming.