Richardson Extrapolation

← Numerical Methods

Source inspiration: (Mathew 2000-2019).

Description

Richardson extrapolation improves an approximation that depends on a step size \(h\) by combining its values at two step sizes so that the leading term of its error cancels. Mathews applies it to numerical differentiation, where it turns the three-point central difference for \(f'(x)\) into a five-point formula; this page animates that step for \(f(x)=e^{-x}\sin(x)\) over \([0,\pi]\).

The three-point central difference is

\[ D_3(x,h)=\frac{f(x+h)-f(x-h)}{2h}. \]

For smooth \(f\), Taylor expansion gives \(D_3(x,h)=f'(x)+\tfrac{f'''(x)}{6}h^2+\tfrac{f^{(5)}(x)}{120}h^4+\cdots\), with only even powers of \(h\). Halving \(h\) divides the \(h^2\) term by 4, so the combination

\[ D_5(x,h)=\frac{4D_3(x,h/2)-D_3(x,h)}{3}=\frac{f(x-h)-8f(x-h/2)+8f(x+h/2)-f(x+h)}{6h} \]

removes it. This is Mathews’ five-point central difference with spacing \(h/2\). In general, if \(A(h)=A+c\,h^p+O(h^q)\) with \(q>p\), then \(\bigl(2^pA(h/2)-A(h)\bigr)/(2^p-1)=A+O(h^q)\).

The method assumes that the exponent \(p\) of the leading error term is known and that this term dominates, which needs \(f\) smooth enough. As a general result, if \(f\in C^3[x-h,x+h]\) then \(f'(x)-D_3(x,h)=-\tfrac{f'''(c)}{6}h^2\), and if \(f\in C^5[x-h,x+h]\) then

\[ f'(x)-D_5(x,h)=\frac{f^{(5)}(c)}{480}\,h^4 \]

for some \(c\) in that interval, which is Mathews’ five-point remainder \(\tfrac{f^{(5)}(c)}{30}k^4\) with \(k=h/2\). So halving \(h\) divides the error of \(D_3\) by about 4 and that of \(D_5\) by about 16. In Case 1, going from \(h=0.02\) to \(h=0.01\) takes the maximum error over \([0,\pi]\) from \(1.33\times10^{-4}\) to \(3.33\times10^{-5}\) for \(D_3\) and from \(1.33\times10^{-9}\) to \(8.33\times10^{-11}\) for \(D_5\). In Case 2, at \(x=1\), the log-log slopes between successive step sizes are 2.000 to 2.007 for \(D_3\) and 3.905 to 4.005 for \(D_5\), from \(h=0.5\) down to \(h=0.006\).

Rounding error eventually wins. Both formulas subtract nearly equal values of \(f\) and divide by \(h\), so rounding errors grow as \(h\) shrinks while the truncation error of \(D_5\) falls like \(h^4\). The last two points of Case 2 leave the \(h^4\) line: at \(h=0.0015\) the computed error of \(D_5\) is \(1.29\times10^{-14}\), about 2.8 times the truncation error \(4.67\times10^{-15}\) found in 50-digit arithmetic. Wrong weights also mislead: a one-sided difference \(A(h)=\bigl(f(x+h)-f(x)\bigr)/h\) has an error starting with an \(h\) term, so the weights 4 and \(-1\) leave an \(O(h)\) error, and the right combination is \(2A(h/2)-A(h)\).

The difference formulas themselves are on Numerical Differentiation and Derive Numerical Differentiation Formulae, the \(O(h^p)\) notation is on Big “O” Truncation Error, Romberg Integration applies the same step repeatedly to the trapezoidal rule, and Aitken’s Method accelerates a sequence without a step size.

Animations

Each animation below compares the base central difference with Richardson extrapolation for the legacy test function and interval. Case 2 plots the error of the estimate in the legacy module’s Example 8: \(D_5(x,h)\) is that example’s five-point formula for \(f'\) with spacing \(h/2\), evaluated here over a different list of step sizes. Examples 9–10, which use five-point central-difference formulas to approximate the second and third derivatives at the same point, are not animated here, and neither are the pictures that Examples 8–10 draw: the five stencil points with a line, parabola or cubic through the centre point. Nor are the module’s truncation-error-bound examples: Examples 1, 3, 4 and 5 estimate \(M_5=\max|f^{(5)}|\) on \([0,\pi]\) from a graph of \(f^{(5)}\), check the resulting five-point error bound against the actual error, show the bound’s \(O(h^4)\) scaling, and compare it with the three-point bound; Case 1 annotates the actual maximum errors instead. Example 7, the module’s worked extrapolation, combines \(D_3(1,0.02)\) and \(D_3(1,0.01)\) into the five-point value at spacing \(0.01\), which is \(D_5(1,0.02)\); its error is the \(h=0.02\) point of Case 2 and is not shown separately, and Example 2(b)’s plot of the five-point formula at spacing \(0.01\) over \([0,\pi]\) is the \(h=0.02\) frame of Case 1. Example 2(a)’s table at \(x=0,1,2,3\) and Example 6’s proof that the five-point formula at spacing \(h\) equals \(\frac{4D_3(x,h)-D_3(x,2h)}{3}\) are not animated either.

Case 1 - profile comparison, \(D_3(x,h)\) vs. \(D_5(x,h)\)

Behavior: Both approximations converge as \(h\) shrinks, but the Richardson curve tracks \(f'(x)\) much more closely because the dominant \(h^2\) error term is canceled.

Julia source

Animation comparing D3 and Richardson D5 derivative curves against the true derivative over 0 to pi for decreasing h.

Case 2 - pointwise convergence at \(x_0=1\) on log-log axes

Behavior: The error slope for the three-point formula follows approximately \(O(h^2)\), while Richardson extrapolation follows approximately \(O(h^4)\) before roundoff effects appear.

Julia source

Animation of log-log error curves versus h at x0 equals 1 showing second-order and fourth-order convergence trends.

Derivation Notes

If \(D_3(x,h)=f'(x)+C_2 h^2 + C_4 h^4 + \cdots\), then

\[ \frac{4D_3(x,h/2)-D_3(x,h)}{3} = f'(x) + O(h^4), \]

because the \(C_2 h^2\) contribution cancels exactly.

References

Mathew, John H. 2000-2019. Numerical Analysis - Numerical Methods Modules. https://web.archive.org/web/20190808102217/http://mathfaculty.fullerton.edu/mathews/n2003/NumericalUndergradMod.html.