Page 224 - Applied Numerical Methods Using MATLAB
P. 224
APPROXIMATION ERROR OF FIRST DERIVATIVE 213
The right-hand side of this inequality is minimized to yield the optimum step
size h o as
d ε |K 2 | 2 ε |K 2 | 3ε
+ h =− + h = 0, h o = 3 (5.2.3)
dh h 6 h 2 3 |K 2 |
Similarly, we can derive the total error of the central difference approximation
(5.1.9) as
8e 1 − 8e −1 − e 2 + e −2 |K 4 |
4
|D c4 (x, h) − f (x)|≤ + h
12h 30
18ε |K 4 | 4 (5)
≤ + h with K 4 = f (x)
12h 30
and find out the optimum step size h o as
d 3ε |K 4 | 4 3ε 2|K 4 | 3 45ε
+ h =− + h = 0, h o = 5 (5.2.4)
dh 2h 30 2h 2 15 4|K 4 |
From what we have seen so far, we can tell that, as we make the step size h
smaller, the round-off error may increase, while the truncation error decreases.
This is called ‘step-size dilemma’. Therefore, there must be some optimal step
size h o for the difference approximation formulas, as derived analytically in
Eqs. (5.2.2), (5.2.3), and (5.2.4). However, these equations are only of theoretical
value and cannot be used practically to determine h o because we usually don’t
have any information about the high-order derivatives and, consequently, we
cannot estimate K 1 ,K 2 ,. .. . Besides, noting that h o minimizes not the real error,
but its upper bound, we can never expect the true optimal step size to be uniform
for all x even with the same approximation formula.
Now, we can verify the step-size dilemma and the existence of some optimal
step size h o by computing the numerical derivative of a function, say, f(x) =
sin x, whose analytical derivatives are well known. To see how the errors of the
difference approximation formulas (5.1.4) and (5.1.8) depend on the step size h,
we computed their values for x = π/4 together with their errors as summarized
in Tables 5.1 and 5.2. From these results, it appears that the errors of (5.1.4) and
−5
(5.1.8) are minimized with h ≈ 10 −8 and h ≈ 10 , respectively. This may be
justified by the following facts:
ž Noting that the number of significant bits is 52, which is the number of man-
tissa bits (Section 1.2.1), or, equivalently, the number of significant digits
3
is about 52 × 3/10 ≈ 16 (since 2 10 ≈ 10 ), and the value of f(x) = sin x is
less than or equal to one, the round-off error is roughly
ε ≈ 10 −16 /2