Numerical Differentiation
Forward Difference
Approximate the derivative of f(x) using the forward difference formula: D = (f(x+h) - f(x)) / h. Example: f(x)=x², x=3, h=1 gives D=7; true derivative=6, error=1.
The error is O(h) — the approximation improves as h shrinks.
Example
forward-difference
The forward difference formula approximates f'(x) using one step ahead: D = (f(x+h) - f(x)) / h