Mathematical Tools for Physics - Department of Physics - University

(nextflipdebug2) #1
11—Numerical Analysis 271

As usual, the geometric approach doesn’t indicate the size of the error, so it’s back to Taylor’s series.


Given data at pointsx= 0,±h,± 2 h,.... I want the derivativef′(0).


f(h) =f(0) +hf′(0) +


1

2

h^2 f′′(0) +


1

6

h^3 f′′′(0) +···


f(−h) =f(0)−hf′(0) +


1

2

h^2 f′′(0)−


1

6

h^3 f′′′(0) +···


In order to isolate the term inf′(0), it’s necessary to eliminate the larger termf(0), so subtract:


f(h)−f(−h) = 2hf′(0) +


1

3

h^3 f′′′(0) +···,


giving

1

2 h


[

f(h)−f(−h)


]

≈f′(0) +


[ 1

6

h^2 f′′′(0)


] (11.8)


and the last term, in brackets, estimates the error in the straight line approximation.


The most obvious point about this error term is that it varies ash^2 , and so indicates by how


much the error should decrease as you decrease the size of the interval. (How to estimate the factor


f′′′(0)I’ll come to presently.) This method evaluates the derivative at one of the data points; you


can make it more accurate if you evaluate it between the points, so that the distance from where the


derivative is being taken to where the data is available is smaller. As before, leth= 2k, then


1

2 k


[

f(k)−f(−k)


]

=f′(0) +


1

6

k^2 f′′′(0) +···,


or, in terms ofhwith a shifted origin,


1

h


[

f(h)−f(0)


]

≈f′(h/2) +


1

24

h^2 f′′′


(h


2

)

, (11.9)


and the error is only 1/4 as big.
As with interpolation methods, you can gain accuracy by going to higher order in the Taylor
series,


f(h)−f(−h) = 2hf′(0) +


1

3

h^3 f′′′(0) +


1

60

h^5 fv(0) +···


f(2h)−f(− 2 h) = 4hf′(0) +


8

3

h^3 f′′′(0) +


32

60

h^5 fv(0) +···


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)


]

(11.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

Free download pdf