11—Numerical Analysis 325
The error for expression (b) requires another expansion,
error (b) =hf(h)−
∫h
0
dxf(x)
=h
[
f(0) +hf′(0) +···
]
−
[
hf(0) +
1
2
h^2 f′(0) +···
]
≈
1
2
h^2 f′(0). (17)
Since this is the opposite sign from the previous error, it is immediately clear that the error in (d) will be less,
because (d) is the average of (a) and (b).
error (d) =
[
f(0) +f(0) +hf′(0) +
1
2
h^2 f′′(0) +···
]h
2
−
[
hf(0) +
1
2
h^2 f′(0) +
1
6
h^3 f′′(0) +···
]
≈
(
1
4
−
1
6
)
h^3 f′′(0) =
1
12
h^3 f′′(0). (18)
Similarly, the error in (c) is
error (c) =h
[
f(0) +
1
2
hf′(0) +
1
8
h^2 f′′(0) +···
]
−
[
hf(0) +
1
2
h^2 f′(0) +
1
6
h^2 f′′(0) +···
]
≈−
1
24
h^3 f′′(0). (19)
The errors in the (c) and (d) formulas are both therefore the order ofh^3.
Notice that just as the errors in formulas (a) and (b) canceled to highest order when you averaged them,
the same happens between formulas (c) and (d). Here however you need a weighted average, with twice as much
of (c) as of (d). [ 1 / 12 − 2 /24 = 0]
1
3
(d) +
2
3
(c) =
[
f(x 0 ) +f(x 0 +h)
]h
6
+f
(
x 0 +h/ 2
) 4
6
h. (20)