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
| Method | Convenience | Inconvenience / warning |
|---|---|---|
| Forward difference | Works at left boundaries. | First order and roundoff-sensitive. |
| Backward difference | Works at right boundaries. | First order and roundoff-sensitive. |
| Central difference | Second order for smooth functions. | Needs values on both sides. |
| Richardson extrapolation | Cancels leading error terms. | Assumes asymptotic error regime and smoothness. |
Illustrative plot / animation
Numerical diagnostics
What the student must compare
- log-log error curve
- optimal step range
- roundoff/truncation balance
- method order