Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

MATH 174 B

Laboratory Exercise 9
Numerical Differentiation
ANSWER KEY

Score:

10
10

Do as indicated.
1. Derive a (a) four-point forward and a (b) four-point backward formula both of order three for f 0
together with their error terms. To ensure uniformity in our formulas, set 18 to be the multiplier to
f (x + h) and f (x h).
Solution:
(a) Note that
h3
h4
h2 00
f (x) + f 000 (x) + f iv (x) + ...
2
6
24
2
3
4h
8h
16h4 iv
f (x + 2h) = f (x) + 2hf 0 (x) +
f 00 (x) +
f 000 (x) +
f (x) + ...
2
6
24
27h3 000
81h4 iv
9h2 00
f (x) +
f (x) +
f (x) + ...
f (x + 3h) = f (x) + 3hf 0 (x) +
2
6
24
f (x + h) = f (x) + hf 0 (x) +

36 4 iv
h f (), (x, x + 3h)
24
11f (x) + 18f (x + h) 9f (x + 2h) + 2f (x + 3h) h3 iv
= f 0 (x) =
f ()
6h
4
11f (x) + 18f (x + h) 9f (x + 2h) + 2f (x + 3h)
0
+ O(h3 ).
= f (x) =
6h
3pts for formula, 1pt for error term

= 18f (x + h) 9f (x + 2h) + 2f (x + 3h) = 11f (x) + 6hf 0 (x) +

(b) Similarly,
h2 00
h3
h4
f (x) f 000 (x) + f iv (x) + ...
2
6
24
3
2
8h
16h4 iv
4h
f 00 (x)
f 000 (x) +
f (x) + ...
f (x 2h) = f (x) 2hf 0 (x) +
2
6
24
9h2 00
27h3 000
81h4 iv
f (x 3h) = f (x) 3hf 0 (x) +
f (x)
f (x) +
f (x) + ...
2
6
24
f (x h) = f (x) hf 0 (x) +

11f (x) + 18f (x h) 9f (x 2h) + 2f (x 3h) h3 iv


+ f ()
6h
4
11f (x) + 18f (x h) 9f (x 2h) + 2f (x 3h)
0
= f (x) =
+ O(h3 ).
6h
1pt for formula, 1pt for error term

= f 0 (x) =

5
2. Determine an upper
 bound
 for the error incurred when the formulas were applied to f (x) = x sin x
5

over the interval 0,


with h = .
2
2
Solution: Note that the formulas have error terms of equal absolute values, and hence they share
the same error bound. Further, f iv (x) = 120x sin x which has maximum absolute value 300 1.
Thus, the error is at most
(/2)3
(300 1) 912.241282.
4
3pts

3. Use the formulas you got from #1 to complete the table below. Note that the data was obtained
from the function f (x) = x5 sin x.

1pt
Extra Credit: Derive a three-point centered fromula of order two for f 00 together with its error term.
f (x + h) 2f (x) + f (x h) h2 iv
Answer: f 00 (x) =
f (), (x h, x + h).
h2
12
2pts all or nothing

***end of exercise***

You might also like