Mathematical Tools for Physics

(coco) #1
11—Numerical Analysis 322

To eliminate the largest source of error, theh^3 term, multiply the first equation by 8 and subtract the second.


8


[


f(h)−f(−h)

]



[


f(2h)−f(− 2 h)

]


= 12hf′(0)−

24


60


h^5 fv(0) +···,

or


f′(0)≈

1


12 h

[


f(− 2 h)− 8 f(−h) + 8f(h)−f(2h)

]


+


{ 1


30


h^4 fv(0)

}


. (10)


with an error term of orderh^4.
As an example of this method, letf(x) = sinxand evaluate the derivative atx= 0. 2 by the 2-point
formula and the 4-point formula with h=0.1:


2-point:

1


0. 2


[0. 2955202 − 0 .0998334] = 0. 9784340


4-point:

1


1. 2


[0. 0 − 8 × 0 .0998334 + 8× 0. 2955202 − 0 .3894183]


= 0. 9800633


cos 0.2 = 0. 9800666

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)

]


= 48f′(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)

and the coefficient of the error term is much smaller.

Free download pdf