Mathematical Methods for Physics and Engineering : A Comprehensive Guide

(Darren Dugan) #1

27.5 FINITE DIFFERENCES


many values ofξifor each value ofyand is a very poor approximation if the


wings of the Gaussian distribution have to be sampled accurately. For nearly all


practical purposes a Gaussian look-up table is to be preferred.


27.5 Finite differences

It will have been noticed that earlier sections included several equations linking


sequential values offiand the derivatives offevaluated at one of thexi.In


this section, by way of preparation for the numerical treatment of differential


equations, we establish these relationships in a more systematic way.


Again we consider a set of valuesfiof a functionf(x) evaluated at equally

spaced pointsxi, their separation beingh. As before, the basis for our discussion


will be a Taylor series expansion, but on this occasion about the pointxi:


fi± 1 =fi±hf′i+

h^2
2!

f′′i±

h^3
3!

f(3)i +···. (27.56)

In this section, and subsequently, we denote thenth derivative evaluated atxi


byf(in).


From (27.56), three different expressions that approximatef

(1)
i can be derived.
The first of these, obtained by subtracting the±equations, is


f(1)i ≡

(
df
dx

)

xi

=

fi+1−fi− 1
2 h


h^2
3!

fi(3)−···. (27.57)

The quantity (fi+1−fi− 1 )/(2h) is known as the central difference approximation


tofi(1)and can be seen from (27.57) to be in error by approximately (h^2 /6)f(3)i.


An alternative approximation, obtained from (27.56+) alone, is given by

f(1)i ≡

(
df
dx

)

xi

=

fi+1−fi
h


h
2!

fi(2)−···. (27.58)

Theforward differenceapproximation, (fi+1−fi)/h, is clearly a poorer approxi-


mation, since it is in error by approximately (h/2)f(2)i as compared with (h^2 /6)f(3)i.


Similarly, the backward difference (fi−fi− 1 )/hobtained from (27.56−) is not as


good as the central difference; the sign of the error is reversed in this case.


This type of differencing approximation can be continued to the higher deriva-

tives offin an obvious manner. By adding the two equations (27.56±), a central


difference approximation tofi(2)can be obtained:


fi(2)≡

(
d^2 f
dx^2

)

fi+1− 2 fi+fi− 1
h^2

. (27.59)


The error in this approximation (also known as the second difference off)is


easilyshowntobeabout(h^2 /12)fi(4).


Of course, if the functionf(x) is a sufficiently simple polynomial inx, all
Free download pdf