![]()
![]()
Lab for Numerical Differentiation
![]()
Background. Numerical
differentiation formulas can be derived by first constructing the
Lagrange interpolating polynomial
through three points, second differentiating the Lagrange polynomial,
and finally evaluating
at the desired point.
The centered formula for the first derivative, based on three points
is:
Three point rule for:
.
The centered formula for the first derivative, based on five
points is:
Five point rule for: ![]()
.
Richardson's extrapolation relates these two formulas:
Richardson's extrapolation:
.
The centered formula for the second derivative, based on five
points is:
Five point rule for:
.
Projects I - IV will investigate these numerical differentiation
formulae.
Load in Mathematica's graphics package "Colors".
Report to be handed in.
Computer Exercises
Project I. Investigate the
numerical differentiation formulae ![]()
and error bound
where
.
Enter the three point formula for numerical differentiation.
Enter the function, use
.
Exercise 1. Find the formula for the third derivative of f(x).
Exercise 2. Graph
.
Find the bound
.
Look at a graph and estimate the value
,
be sure to take the absolute value if necessary.
![]()
![[Graphics:df.txtgr21.gif]](df.txtgr21.gif)
The maximum occurs at x = 0 and the minimum occurs at
. Now find the formula for the error bound.
Exercise 3. Show the details
for finding numerical approximations to the derivative at x = 0, 1,
2, 3 using the three point rule.
3. (a) Compute the four numerical
approximations for the derivative with
,
use step sizes h = 0.01
3. (b) Compute the four
numerical approximations for the derivative with
,
use step sizes h = 0.001
3. (c) Plot the numerical
approximation
over the interval
.
Compare with the graph of
over the interval
.
Using step size h = 0.01 we get:
Using step size h = 0.001 we get:
The true values for the derivative are:
Plot the numerical approximation
over the interval
.
Compare with the graph of
over the interval
.
![]()
![[Graphics:df.txtgr39.gif]](df.txtgr39.gif)
![]()
![[Graphics:df.txtgr40.gif]](df.txtgr40.gif)
Exercise 4. Plot the absolute
error
over the interval
,
and estimate the maximum absolute error over the interval.
![]()
![[Graphics:df.txtgr44.gif]](df.txtgr44.gif)
Exercise 5. Find
and observe that
over
.
Project II. Investigate the
numerical differentiation formulae ![]()
and error bound
where
.
Enter the five point formula for numerical differentiation.
Enter the function, use
.
Exercise 6. Find the formula for the fifth derivative of f(x).
Exercise 7. Graph
.
Find the bound
.
Look at a graph and estimate the value
,
be sure to take the absolute value if necessary.
![]()
![[Graphics:df.txtgr60.gif]](df.txtgr60.gif)
The minimum occurs at x = 0 and the maximum occurs at
. Now find the formula for the error bound.
Exercise 8. Show the details
for finding numerical approximations to the derivative at x = 0, 1,
2, 3 using the five point rule.
8. (a) Compute the four
numerical approximations for the derivative with
,
use step sizes h = 0.1
8. (b) Compute the four
numerical approximations for the derivative with
,
use step sizes h = 0.01
8. (c) Plot the numerical
approximation
over the interval
.
Compare with the graph of
over the interval
.
Using step size h = 0.1 we get:
Using step size h = 0.01 we get:
![]()
![[Graphics:df.txtgr74.gif]](df.txtgr74.gif)
![]()
![[Graphics:df.txtgr75.gif]](df.txtgr75.gif)
Exercise 9. Plot the absolute
error
over the interval
,
and estimate the maximum absolute error over the interval.
![]()
![[Graphics:df.txtgr79.gif]](df.txtgr79.gif)
Exercise 10. Find
and observe that
over
.
Exercise 11. Compare the
error bounds for the three point and five point formulas.
11. (a) Which is smaller
?
11. (b) Which is smaller
?
Explain why this is so ?
Project III. Investigate
extrapolation for numerical differentiation.
Exercise 12. In general, show
that
.
Enter the function, use
.
Exercise 13. Find the
approximations Dthree[1, 0.02], Dthree[1.0, 0.01] and
then use the extrapolation formula
.
Compute Dfive[1.0, 0.01] directly. Finally, compare these
numerical approximations for the derivative with ![]()
Project IV. Investigate the
numerical differentiation formulae ![]()
and error bound
where
.
Enter the formula for numerical differentiation.
Enter the function, use
.
Exercise 14. Find the formula for the fourth derivative of f(x).
Exercise 15. Graph
.
Find the bound
.
Look at a graph and estimate the value
,
be sure to take the absolute value if necessary.
![]()
![[Graphics:df.txtgr105.gif]](df.txtgr105.gif)
The minimum occurs at x = 0.785398 and the maximum occurs at x = 0. Now find the formula for the error bound.
Exercise 16. Show the details
for finding numerical approximations to the second derivative at x =
0, 1, 2, 3. Compare the four numerical approximations for the
derivative with
.
Plot the numerical approximation
over the interval
.
Compare with the graph of
over the interval
.
Using step size h = 0.01 we get:
The true values for the second derivative are:
![]()
![[Graphics:df.txtgr116.gif]](df.txtgr116.gif)
![]()
![[Graphics:df.txtgr117.gif]](df.txtgr117.gif)
Exercise 17. Plot the
absolute error
over the interval
,
and estimate the maximum absolute error over the interval.
![]()
![[Graphics:df.txtgr121.gif]](df.txtgr121.gif)
Exercise 18. Find
and observe that
over
.
![]()
![]()
(c) John H. Mathews, 1998