11—Numerical Analysis 272
Again, you have a more accurate formula by evaluating the derivative between the data points:
h= 2k
f(k)−f(−k) = 2kf′(0) +
1
3
k^3 f′′′(0) +
1
60
k^5 fv(0)
f(3k)−f(− 3 k) = 6kf′(0) +
27
3
k^3 f′′′(0) +
243
60
k^5 fv(0)
27
[
f(k)−f(−k)
]
−
[
f(3k)−f(− 3 k)
]
= 48kf′(0)−
216
60
k^5 fv(0)
Changingktoh/ 2 and translating the origin gives
1
24 h
[
f(−h)− 27 f(0) + 27f(h)−f(2h)
]
=f′(h/2)−
3
640
h^4 fv(h/2), (11.11)
and the coefficient of the error term is much smaller.
The previous example of the derivative ofsinxatx= 0. 2 withh= 0. 1 gives, using this formula:
1
2. 4
[0. 0499792 − 27 × 0 .1494381 + 27× 0. 2474040 − 0 .3428978] = 0. 9800661 ,
and the error is less by a factor of about 7.
You can find higher derivatives the same way.
f(h) =f(0) +hf′(0) +
1
2
h^2 f′′(0) +
1
6
h^3 f′′′(0) +
1
24
h^4 f′′′′(0)
f(h) +f(−h) = 2f(0) +h^2 f′′(0) +
1
12
h^4 f′′′′(0) +···
f′′(0) =
f(−h)− 2 f(0) +f(h)
h^2
−
1
12
h^2 f′′′′(0) +··· (11.12)
Notice that the numerical approximation forf′′(0)is even inhbecause the second derivative is un-
changed ifxis changed to−x.
You can get any of these expressions for higher derivatives recursively, though finding the error
estimates requires the series method. The above expression forf′′(0)can be viewed as a combination
of first derivative formulas:
f′′(0)≈
[
f′(h/2)−f′(−h/2)
]
/h
≈
1
h
[
f(h)−f(0)
h
−
f(0)−f(−h)
h
]
=
[
f(h)− 2 f(0) +f(−h)
]
/h^2 (11.13)
Similarly, the third and higher derivatives can be computed. The numbers that appear in these numerical
derivatives are simply the binomial coefficients, Eq. (2.18).
11.4 Integration
The basic definition of an integral is the limit of a sum as the intervals approach zero.