Lab for Numerical Differentiation

Module for Numerical Differentiation

Module for Richardson Extrapolation

   Check out the new Numerical Analysis Projects page.

 

Background. Numerical differentiation formulas can be derived by first constructing the Lagrange interpolating polynomial [Graphics:df.txtgr1.gif] through three points, second differentiating the Lagrange polynomial, and finally evaluating [Graphics:df.txtgr2.gif] at the desired point.

The centered formula for the first derivative, based on three points is:

Three point rule for: [Graphics:df.txtgr3.gif].

 

The centered formula for the first derivative, based on five points is:

Five point rule for: [Graphics:df.txtgr4.gif][Graphics:df.txtgr5.gif].

 

Richardson's extrapolation relates these two formulas:

Richardson's extrapolation: [Graphics:df.txtgr6.gif].

 

The centered formula for the second derivative, based on five points is:

Five point rule for: [Graphics:df.txtgr7.gif].

 

Projects I - IV will investigate these numerical differentiation formulae.

Load in Mathematica's graphics package "Colors".

[Graphics:df.txtgr9.gif][Graphics:df.txtgr8.gif]
 
 
 

Report to be handed in.

Computer Exercises

Project I. Investigate the numerical differentiation formulae [Graphics:df.txtgr10.gif]
and error bound [Graphics:df.txtgr11.gif] where [Graphics:df.txtgr12.gif].

Enter the three point formula for numerical differentiation.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr13.gif]

Enter the function, use [Graphics:df.txtgr14.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr15.gif]
 
 

Exercise 1. Find the formula for the third derivative of f(x).

[Graphics:df.txtgr9.gif][Graphics:df.txtgr16.gif]
 
 

Exercise 2. Graph [Graphics:df.txtgr17.gif]. Find the bound [Graphics:df.txtgr18.gif]. Look at a graph and estimate the value [Graphics:df.txtgr19.gif], be sure to take the absolute value if necessary.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr20.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr21.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr22.gif]

The maximum occurs at x = 0 and the minimum occurs at [Graphics:df.txtgr23.gif] . Now find the formula for the error bound.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr24.gif]
 
 

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 [Graphics:df.txtgr25.gif], use step sizes h = 0.01

3. (b) Compute the four numerical approximations for the derivative with [Graphics:df.txtgr26.gif], use step sizes h = 0.001

3. (c) Plot the numerical approximation [Graphics:df.txtgr27.gif] over the interval [Graphics:df.txtgr28.gif]. Compare with the graph of [Graphics:df.txtgr29.gif] over the interval [Graphics:df.txtgr30.gif].

Using step size h = 0.01 we get:

[Graphics:df.txtgr9.gif][Graphics:df.txtgr31.gif]

Using step size h = 0.001 we get:

[Graphics:df.txtgr9.gif][Graphics:df.txtgr32.gif]

The true values for the derivative are:

[Graphics:df.txtgr9.gif][Graphics:df.txtgr33.gif]

Plot the numerical approximation [Graphics:df.txtgr34.gif] over the interval [Graphics:df.txtgr35.gif]. Compare with the graph of [Graphics:df.txtgr36.gif] over the interval [Graphics:df.txtgr37.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr38.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr39.gif][Graphics:df.txtgr9.gif][Graphics:df.txtgr40.gif]

 

Exercise 4. Plot the absolute error [Graphics:df.txtgr41.gif] over the interval [Graphics:df.txtgr42.gif], and estimate the maximum absolute error over the interval.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr43.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr44.gif]

 

Exercise 5. Find [Graphics:df.txtgr45.gif] and observe that [Graphics:df.txtgr46.gif] over [Graphics:df.txtgr47.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr48.gif]
 
 

Project II. Investigate the numerical differentiation formulae [Graphics:df.txtgr49.gif]
and error bound [Graphics:df.txtgr50.gif] where [Graphics:df.txtgr51.gif].

Enter the five point formula for numerical differentiation.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr52.gif]

Enter the function, use [Graphics:df.txtgr53.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr54.gif]
 
 

Exercise 6. Find the formula for the fifth derivative of f(x).

[Graphics:df.txtgr9.gif][Graphics:df.txtgr55.gif]
 
 

Exercise 7. Graph [Graphics:df.txtgr56.gif]. Find the bound [Graphics:df.txtgr57.gif]. Look at a graph and estimate the value [Graphics:df.txtgr58.gif], be sure to take the absolute value if necessary.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr59.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr60.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr61.gif]

The minimum occurs at x = 0 and the maximum occurs at [Graphics:df.txtgr62.gif] . Now find the formula for the error bound.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr63.gif]
 
 

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 [Graphics:df.txtgr64.gif], use step sizes h = 0.1

8. (b) Compute the four numerical approximations for the derivative with [Graphics:df.txtgr65.gif], use step sizes h = 0.01

8. (c) Plot the numerical approximation [Graphics:df.txtgr66.gif] over the interval [Graphics:df.txtgr67.gif]. Compare with the graph of [Graphics:df.txtgr68.gif] over the interval [Graphics:df.txtgr69.gif].

Using step size h = 0.1 we get:

[Graphics:df.txtgr9.gif][Graphics:df.txtgr70.gif]

Using step size h = 0.01 we get:

[Graphics:df.txtgr9.gif][Graphics:df.txtgr71.gif]
 
[Graphics:df.txtgr9.gif][Graphics:df.txtgr72.gif]
 
[Graphics:df.txtgr9.gif][Graphics:df.txtgr73.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr74.gif][Graphics:df.txtgr9.gif][Graphics:df.txtgr75.gif]

 

Exercise 9. Plot the absolute error [Graphics:df.txtgr76.gif] over the interval [Graphics:df.txtgr77.gif], and estimate the maximum absolute error over the interval.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr78.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr79.gif]

 

Exercise 10. Find [Graphics:df.txtgr80.gif] and observe that [Graphics:df.txtgr81.gif] over [Graphics:df.txtgr82.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr83.gif]
 
 

Exercise 11. Compare the error bounds for the three point and five point formulas.
11. (a) Which is smaller [Graphics:df.txtgr84.gif]?
11. (b) Which is smaller [Graphics:df.txtgr85.gif]? Explain why this is so ?

[Graphics:df.txtgr9.gif][Graphics:df.txtgr86.gif]
 
 

Project III. Investigate extrapolation for numerical differentiation.

 

Exercise 12. In general, show that [Graphics:df.txtgr87.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr88.gif]

Enter the function, use [Graphics:df.txtgr89.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr90.gif]
 
 
 
 

Exercise 13. Find the approximations Dthree[1, 0.02], Dthree[1.0, 0.01] and then use the extrapolation formula [Graphics:df.txtgr91.gif].

Compute Dfive[1.0, 0.01] directly. Finally, compare these numerical approximations for the derivative with [Graphics:df.txtgr92.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr93.gif]
 
 

Project IV. Investigate the numerical differentiation formulae [Graphics:df.txtgr94.gif]
and error bound [Graphics:df.txtgr95.gif] where [Graphics:df.txtgr96.gif].

Enter the formula for numerical differentiation.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr97.gif]

Enter the function, use [Graphics:df.txtgr98.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr99.gif]
 
 

Exercise 14. Find the formula for the fourth derivative of f(x).

[Graphics:df.txtgr9.gif][Graphics:df.txtgr100.gif]
 
 

Exercise 15. Graph [Graphics:df.txtgr101.gif]. Find the bound [Graphics:df.txtgr102.gif]. Look at a graph and estimate the value [Graphics:df.txtgr103.gif], be sure to take the absolute value if necessary.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr104.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr105.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr106.gif]

The minimum occurs at x = 0.785398 and the maximum occurs at x = 0. Now find the formula for the error bound.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr107.gif]
 
 

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 [Graphics:df.txtgr108.gif].

Plot the numerical approximation [Graphics:df.txtgr109.gif] over the interval [Graphics:df.txtgr110.gif]. Compare with the graph of [Graphics:df.txtgr111.gif] over the interval [Graphics:df.txtgr112.gif].

Using step size h = 0.01 we get:

[Graphics:df.txtgr9.gif][Graphics:df.txtgr113.gif]

The true values for the second derivative are:

[Graphics:df.txtgr9.gif][Graphics:df.txtgr114.gif]
 
[Graphics:df.txtgr9.gif][Graphics:df.txtgr115.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr116.gif][Graphics:df.txtgr9.gif][Graphics:df.txtgr117.gif]

 

Exercise 17. Plot the absolute error [Graphics:df.txtgr118.gif] over the interval [Graphics:df.txtgr119.gif], and estimate the maximum absolute error over the interval.

[Graphics:df.txtgr9.gif][Graphics:df.txtgr120.gif]

[Graphics:df.txtgr9.gif][Graphics:df.txtgr121.gif]

 

Exercise 18. Find [Graphics:df.txtgr122.gif] and observe that [Graphics:df.txtgr123.gif] over [Graphics:df.txtgr124.gif].

[Graphics:df.txtgr9.gif][Graphics:df.txtgr125.gif]
 
 

 

 

 

 

(c) John H. Mathews, 1998