Comparative numerical laboratory

Numerical Differentiation: Error versus Step Size — Chapter 8

Differentiate \(f(x)=\sin x\) at a point and compare forward, backward, central, and Richardson formulas.

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

Methods compared

MethodConvenienceInconvenience / warning
Forward differenceWorks at left boundaries.First order and roundoff-sensitive.
Backward differenceWorks at right boundaries.First order and roundoff-sensitive.
Central differenceSecond order for smooth functions.Needs values on both sides.
Richardson extrapolationCancels leading error terms.Assumes asymptotic error regime and smoothness.

Illustrative plot / animation

Numerical diagnostics

What the student must compare