Page 227 - Applied Numerical Methods Using MATLAB
P. 227
216 NUMERICAL DIFFERENTIATION/ INTEGRATION
5.3 DIFFERENCE APPROXIMATION FOR SECOND
AND HIGHER DERIVATIVE
In order to obtain an approximation formula for the second derivative, we take
the Taylor series expansion of f(x + h) and f(x − h) up to the fifth order to
write
h 2 h 3 h 4 h 5
(2) (3) (4) (5)
f(x + h) = f(x) + hf (x) + f (x) + f (x) + f (x) + f (x) + ···
2 3! 4! 5!
h 2 h 3 h 4 h 5
(2) (3) (4) (5)
f(x − h) = f(x) − hf (x) + f (x) − f (x) + f (x) − f (x) + ···
2 3! 4! 5!
Adding these two equations (to remove the f (x) terms) and then subtracting
2
2f(x) from both sides and dividing both sides by h yields the central difference
approximation for the second derivative as
f(x + h) − 2f(x) + f(x − h)
(2)
D (x, h) =
c2 2
h
h 2 2h 4
= f (2) (x) + f (4) (x) + f (6) (x) +· · · (5.3.1)
12 6!
2
which has a truncation error of O(h ).
Richardson’s extrapolation can be used for manipulating this equation to
2
remove the h term, which yields an improved version
(2)
(2)
2
2 D (x, h) − D (x, 2h) −f(x + 2h) + 16f(x + h) − 30f(x) + 16f(x − h) − f(x − 2h)
c2 c2 =
2 − 1 12h 2
2
h 4
= f (2) (x) − f (5) (x) + ···
90
−f(x + 2h) + 16f(x + h) − 30f(x) + 16f(x − h) − f(x − 2h)
(2)
D (x, h) =
c4
12h 2
4
= f (2) (x) + O(h ) (5.3.2)
4
which has a truncation error of O(h ).
The difference approximation formulas for the first and second derivatives
derived so far are summarized in Table 5.3, where the following notations are
used:
(N) (N) (N)
D /D /D is the forward/backward/central difference approximation for
fi bi ci
i
the Nth derivative having an error of O(h )(h is the step size)
f k = f(x + kh)