Numerical Differentiation
Central Difference
Approximate the derivative of f(x) using the central difference formula: D = (f(x+h) - f(x-h)) / (2h). Example: f(x)=x³, x=2, h=1 gives D=13; true derivative=12, error=1.
The error is O(h²) — more accurate than forward difference for the same step size.
Example
central-difference
The central difference formula approximates f'(x) symmetrically: D = (f(x+h) - f(x-h)) / (2h)