Page 221 - Applied Numerical Methods Using MATLAB
P. 221
210 NUMERICAL DIFFERENTIATION/ INTEGRATION
Subtracting f(x) from both sides and dividing both sides by the step size h yields
f(x + h) − f(x) h (2) h 2 (3)
D f 1 (x, h) = = f (x) + f (x) + f (x) +· · ·
h 2 3!
= f (x) + O(h) (5.1.4)
where O(g(h)),called‘big Ohof g(h)’, denotes a truncation error term propor-
tional to g(h) for |h|≺ 1. This means that the error of the forward difference
approximation (5.1.2) of the first derivative is proportional to the step size h,or,
equivalently, in the order of h.
Now, in order to derive another approximation formula for the first derivative
having a smaller error, let’s remove the first-order term with respect to h from
Eq. (5.1.4) by substituting 2h for h in the equation
f(x + 2h) − f(x) 2h (2) 4h 2 (3)
D f 1 (x, 2h) = = f (x) + f (x) + f (x) +· · ·
2h 2 3!
and subtracting this result from two times the equation. Then, we get
f(x + h) − f(x) f(x + 2h) − f(x)
2D f 1 (x, h) − D f 1 (x, 2h) = 2 −
h 2h
2h 2
(3)
= f (x) − f (x) +· · ·
3!
2D f 1 (x, h) − D f 1 (x, 2h)
D f 2 (x, h) =
2 − 1
−f(x + 2h) + 4f(x + h) − 3f(x)
=
2h
2
= f (x) + O(h ) (5.1.5)
which can be regarded as an improvement over Eq. (5.1.4), since it has the
2
truncation error of O(h ) for |h|≺ 1.
How about the backward difference approximation?
f(x) − f(x − h)
D b1 (x, h) = ≡ D f 1 (x, −h) (h is step size) (5.1.6)
h
This also has an error of O(h) and can be processed to yield an improved version
2
having a truncation error of O(h ).
2D b1 (x, h) − D b1 (x, 2h) 3f(x) − 4f(x − h) + f(x − 2h)
D b2 (x, h) = =
2 − 1 2h
2
= f (x) + O(h ) (5.1.7)
In order to derive another approximation formula for the first derivative, we
take the Taylor series expansion of f(x + h) and f(x − h) up to the fifth order