Numerical Differentiation Approximations and Error Analysis
Numerical Differentiation Approximations and Error Analysis
Question:
Use forward & backward difference approximations of O(h) and a centered difference approximation of
O(h²) to estimate the first derivative of the function:
f(x) = -0.1x⁴ - 0.15x³ - 0.5x² - 0.25x + 1.25
at x = 0.5 using step size h = 0.5. Repeat the computation using h = 0.25.
Note that the derivative can be calculated directly as:
f'(x) = -0.4x³ - 0.45x² - 1.0x - 0.25, (Analytical Derivative)
and can be used to compute the true value as f'(0.5) = -0.9125.
Let:
−1.45 − (−0.9125)
∴ |ε𝑡 | = | | × 100% = 58.9%
−0.9125
Backward Difference:
0.9125 − 1.2
𝑓 ′ (0.5) ≈ = −0.55
0.5
−0.55 − (−0.9125)
∴ |𝜀𝑡 | = | | × 100% = 39.7%
−0.9125
Centered Difference:
0.2 − 1.2
𝑓 ′ (0.5) ≈ = −1.0
2 × 0.5
Forward Difference:
• f'(0.5) ≈ -1.155
• Error | εt | = 26.5%
Backward Difference:
• f'(0.5) ≈ -0.714
• Error | εt | = 21.7%
Centered Difference:
• f'(0.5) ≈ -0.934
• Error | εt | = 2.4%
Conclusion: The centered difference approximation is more accurate than forward or backward
differences.
𝜋 𝜋
Question: Approximate the second derivative of 𝑓(𝑥) = 𝑠𝑖𝑛(𝑥) at 𝑥 = with step size ℎ = .
4 10
Compare forward, backward & centered finite divided difference by estimating the error.
Solution:
1st derivative, 𝑓 ′ (𝑥) = 𝑐𝑜𝑠(𝑥) & 2nd derivative, 𝑓 " (𝑥) = − 𝑠𝑖𝑛(𝑥)
𝜋 𝜋 𝜋
At 𝑥 = , the second derivative of 𝑓(𝑥) = 𝑠𝑖𝑛(𝑥) 𝑖𝑠 𝑓 " ( ) = − 𝑠𝑖𝑛( ) ≈ − 0.7071
4 4 4
Or, = 24.98%
0.987688 − 2 × 0.891007 + 0.7071068
𝑓 " (𝑥𝑖 ) =
𝜋 2
( )
10