A Central Difference Uses Both Sides

A centered difference estimates a derivative from values sampled at equal distances on either side of a point.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace exact arithmetic
  2. Check the sample domain
  3. Cancel the terms that arrive with opposite sign
  4. Check whether both evaluations are available

Trace exact arithmetic

For \(f(x)=x^2\), \((f(x+h)-f(x-h))/(2h)=2x\) when \(h\ne0\). At x=2 it gives four. Symmetry cancels the quadratic terms. Compare forward differences.

Check the sample domain

At a boundary only one side may be accessible. Runtime rounding can still affect close function values. A precondition can state whether both samples must be supported.[1][2]

Cancel the terms that arrive with opposite sign

For \(f(x)=x^3\) at \(x=2\), the exact derivative is twelve. Expanding both \(f(2+h)\) and \(f(2-h)\) shows their difference is \(24h+2h^3\). Dividing by \(2h\) leaves \(12+h^2\), so halving \(h\) divides the exact truncation error by four. See forward differences.

h=0.2 → estimate 12.04
h=0.1 → estimate 12.01
Error ratio 0.04 ÷ 0.01 = 4

Check whether both evaluations are available

Near the edge of a measured domain a symmetric step can leave the supported range. At tiny \(h\), subtraction and prior rounding can dominate. Test both smooth behavior and the domain boundary.

References

  1. Tobin A. Driscoll and Richard J. Braun, Fundamentals of Numerical Computation ↩
  2. Nicholas J. Higham, Accuracy and Stability of Numerical Algorithms ↩