Docsity

Approximating Derivatives & Using Undetermined Coefficients in MATH 375 HW 4, Assignments of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
Millersville University
Department of Mathematics
MATH 375, Homework 4
October 7, 2003
The completed assignment is due at class time on 10/16/2003. You may use your textbook,
computer programs, and notes. All numerical approximations must be accurate to within 10−4
unless otherwise stated.
1. For the function
f(x) = e−x/3cos(x2)
and h= 0.01 approximate the following derivatives.
(a) f0(1) using the two-point forward difference formula.
(b) f0(1/2) using the three-point centered difference formula.
(c) f0(3/2) using the five-point centered difference formula.
(d) f00(−1/2) using the three-point formula.
For each of the derivatives approximated above, find the absolute error in the approximation
and the maximum theoretical approximation error.
2. The Method of Undetermined Coefficients can be used to derive numerical differentiation
formulas. In this exercise we will derive a five-point formula for f00(x). Suppose we can
evaluate f(x) at the five values x0−2h,x0−h,x0,x0+h, and x0+ 2h. We will assume that
f00(x0) is approximated by a weighted average of these five function values, i.e.,
f00(x0)≈Af (x0−2h) + Bf (x0−h) + C f (x0) + Df (x0+h) + E f (x0+ 2h).
We can find a polynomials, P(x), of degrees less than or equal to four which interpolate
f(x) at one or more of these five points. Then on the interval [x0−2h, x0+ 2h] we have
f(x0)≈P(x0). Thus f00(x0)≈P00(x0) and P00(x0) is easy to find since P(x) is a polynomial
of degree four or less. For example, if P(x) = 1 (which is a polynomial of degree less than or
equal to four) then we know that
f00(x0)≈P00 (x0) = A+B+C+D+E= 0
since f(x0+jh) = P(x0+j h) for j=−2,−1,0,1,2.
(a) Let P(x) = xand derive a similar equation involving the five unknown coefficients
A, B, C, D , E. Do the same thing for P(x) = xnfor n= 2,3,4.
(b) Solve the system of five linear equations for A, B, C, D, E .
(c) What is the five-point formula for the approximation to f00(x0)?

Partial preview of the text

Download Approximating Derivatives & Using Undetermined Coefficients in MATH 375 HW 4 and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Millersville University Department of Mathematics MATH 375, Homework 4 October 7, 2003

The completed assignment is due at class time on 10/16/2003. You may use your textbook, computer programs, and notes. All numerical approximations must be accurate to within 10−^4 unless otherwise stated.

  1. For the function f (x) = e−x/^3 cos(x^2 ) and h = 0.01 approximate the following derivatives.

(a) f ′(1) using the two-point forward difference formula. (b) f ′(1/2) using the three-point centered difference formula. (c) f ′(3/2) using the five-point centered difference formula. (d) f ′′(− 1 /2) using the three-point formula.

For each of the derivatives approximated above, find the absolute error in the approximation and the maximum theoretical approximation error.

  1. The Method of Undetermined Coefficients can be used to derive numerical differentiation formulas. In this exercise we will derive a five-point formula for f ′′(x). Suppose we can evaluate f (x) at the five values x 0 − 2 h, x 0 − h, x 0 , x 0 + h, and x 0 + 2h. We will assume that f ′′(x 0 ) is approximated by a weighted average of these five function values, i.e.,

f ′′(x 0 ) ≈ Af (x 0 − 2 h) + Bf (x 0 − h) + Cf (x 0 ) + Df (x 0 + h) + Ef (x 0 + 2h).

We can find a polynomials, P (x), of degrees less than or equal to four which interpolate f (x) at one or more of these five points. Then on the interval [x 0 − 2 h, x 0 + 2h] we have f (x 0 ) ≈ P (x 0 ). Thus f ′′(x 0 ) ≈ P ′′(x 0 ) and P ′′(x 0 ) is easy to find since P (x) is a polynomial of degree four or less. For example, if P (x) = 1 (which is a polynomial of degree less than or equal to four) then we know that

f ′′(x 0 ) ≈ P ′′(x 0 ) = A + B + C + D + E = 0

since f (x 0 + jh) = P (x 0 + jh) for j = − 2 , − 1 , 0 , 1 , 2.

(a) Let P (x) = x and derive a similar equation involving the five unknown coefficients A, B, C, D, E. Do the same thing for P (x) = xn^ for n = 2, 3 , 4. (b) Solve the system of five linear equations for A, B, C, D, E. (c) What is the five-point formula for the approximation to f ′′(x 0 )?