11—Numerical Analysis 323
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) +··· (12)
Notice that the numerical approximation forf′′(0)is even inhbecause the second derivative is unchanged ifx
is 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. (13)
Similarly, the third and higher derivatives can be computed. The numbers that appear in these numerical deriva-
tives are simply the binomial coefficients, Eq. (2.13).