Published by: Dikshya
Published date: 20 Jul 2023
Numerical differentiation is a technique used to approximate the derivative of a function when an analytical expression for the derivative is either not available or too complex to compute. The derivative of a function at a given point represents the rate of change or the slope of the function at that point. Numerical differentiation uses discrete data points and finite difference formulas to approximate the derivative at a specific location.
Here are some common numerical differentiation formulas:
1. Forward Difference:
The forward difference formula approximates the derivative of a function f(x) at a point x₀ using the function values at x₀ and x₀ + h, where h is a small step size.
Formula: f'(x₀) ≈ (f(x₀ + h) - f(x₀)) / h
The forward difference formula has an error on the order of O(h), where h is the step size.
2. Backward Difference:
The backward difference formula approximates the derivative of a function f(x) at a point x₀ using the function values at x₀ and x₀ - h.
Formula: f'(x₀) ≈ (f(x₀) - f(x₀ - h)) / h
Similar to the forward difference, the backward difference formula also has an error on the order of O(h).
3. Central Difference:
The central difference formula provides a more accurate approximation of the derivative by using function values on both sides of the point x₀. It uses f(x₀ + h) and f(x₀ - h) to compute the derivative.
Formula: f'(x₀) ≈ (f(x₀ + h) - f(x₀ - h)) / (2 * h)
The central difference formula has an error on the order of O(h^2), making it more accurate than the forward and backward difference methods.
4. Five-Point Method: The five-point method is an even more accurate approach that uses function values at x₀ + 2h and x₀ - 2h in addition to the central points.
Formula: f'(x₀) ≈ (f(x₀ - 2h) - 8f(x₀ - h) + 8f(x₀ + h) - f(x₀ + 2h)) / (12 * h)
The five-point method has an error on the order of O(h^4), making it more accurate than the three-point central difference method.
5. Richardson Extrapolation: Richardson extrapolation is a technique that uses multiple approximations of the derivative obtained from different step sizes to improve the accuracy of the result. It can be applied to any of the basic difference formulas mentioned above.
By taking two approximations with different step sizes, h₁ and h₂ (where h₂ < h₁), the Richardson extrapolation formula is given by:
f'(x₀) ≈ (4f'(x₀, h₁) - f'(x₀, h₂)) / 3
This method reduces the truncation error and provides a more accurate estimation of the derivative.
It's important to note that while numerical differentiation is a useful tool when an analytical derivative is not readily available, it is sensitive to the choice of the step size (h). A small step size may reduce the truncation error but can introduce significant rounding errors, while a large step size may lead to less accurate approximations. Finding an appropriate step size that balances both sources of error is often a crucial aspect of obtaining accurate numerical derivatives.