...

Finite differences

by taratuta

on
Category: Documents
118

views

Report

Comments

Transcript

Finite differences
27.5 FINITE DIFFERENCES
many values of ξi for each value of y and 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 of fi and the derivatives of f evaluated at one of the xi . 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 values fi of a function f(x) evaluated at equally
spaced points xi , their separation being h. As before, the basis for our discussion
will be a Taylor series expansion, but on this occasion about the point xi :
fi±1 = fi ± hfi +
h2 h3 (3)
f ± fi + · · · .
2! i
3!
(27.56)
In this section, and subsequently, we denote the nth derivative evaluated at xi
by fi(n) .
From (27.56), three different expressions that approximate fi(1) can be derived.
The first of these, obtained by subtracting the ± equations, is
df
h2
fi+1 − fi−1
− fi(3) − · · · .
=
(27.57)
fi(1) ≡
dx xi
2h
3!
The quantity (fi+1 − fi−1 )/(2h) is known as the central difference approximation
to fi(1) and can be seen from (27.57) to be in error by approximately (h2 /6)fi(3) .
An alternative approximation, obtained from (27.56+) alone, is given by
df
fi+1 − fi
h
=
(27.58)
fi(1) ≡
− fi(2) − · · · .
dx xi
h
2!
The forward difference approximation, (fi+1 − fi )/h, is clearly a poorer approximation, since it is in error by approximately (h/2)fi(2) as compared with (h2 /6)fi(3) .
Similarly, the backward difference (fi − fi−1 )/h obtained 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 derivatives of f in an obvious manner. By adding the two equations (27.56±), a central
difference approximation to fi(2) can be obtained:
2 df
fi+1 − 2fi + fi−1
fi(2) ≡
.
(27.59)
≈
dx2
h2
The error in this approximation (also known as the second difference of f) is
easily shown to be about (h2 /12)fi(4) .
Of course, if the function f(x) is a sufficiently simple polynomial in x, all
1019
Fly UP