Finite Difference Approximations of the First Derivative of a Function

​
f(x)
x
e
sin(x)
3
x
divided differences:
forward
central
backward
x value
0
h
1
Method
Approximation
Absolute true error
forward divided difference
1.7180
0.7183
central divided difference
1.1750
0.1752
backward divided difference
0.6321
0.3679
exact value
1.0000
Derivatives of functions can be approximated by finite difference formulas. In this Demonstration, we compare the various difference approximations with the exact value.

Details

The first derivative of a function
f(x)
is defined as
f'(x)=
lim
h0
f(x+h)-f(x)
h
.
The simplest finite difference formulas for the first derivative of a function are:
f'(x)≈
f(x+h)-f(x)
h
(forward difference)​
f'(x)≈
f(x+h)-f(x-h)
2h
(central difference)​
f'(x)≈
f(x)-f(x-h)
h
(backward difference)
Both forward and backward difference formulas have error
O(h)
, while the central difference formula has error
O(
2
h
)
.
In this Demonstration, we show the difference in values calculated from the three difference formulas and the exact value.
Questions:
1. Does the true error increase proportionally with the step size,
h
, for the forward and backward difference formulas?
2. Does the true error increase proportionally with the square of the step size,
h
, for the central difference formula?

References

[1] A. A. Kaw, D. Nguyen, and E. E. Kalu, Numerical Methods with Applications. http://numericalmethods.eng.usf.edu/publications_book.html.

External Links

The Definition of the Derivative
Finite Difference (Wolfram MathWorld)
Backward Difference (Wolfram MathWorld)
Forward Difference (Wolfram MathWorld)

Permanent Citation

Vincent Shatlock, Autar Kaw
​
​"Finite Difference Approximations of the First Derivative of a Function"​
​http://demonstrations.wolfram.com/FiniteDifferenceApproximationsOfTheFirstDerivativeOfAFunctio/​
​Wolfram Demonstrations Project​
​Published: April 27, 2011