36
2. Basic Finite-Difference Methods
ferentiable function that is defined on a discrete grid; then the preceding expressions must be evaluated using a finite value of !i.x . The approximations to the true
derivative obtained by evaluating the algebraic expressions on the right side of
(2.1 )-(2.3) using finite !i.x are known as finite differences. The basic idea behind
finite-difference methods is to convert the differential equation into a system of
algebraic equations by replacing each derivative with a finite difference.
When !i.x is finite, the finite-difference approximations (2.1)-(2.3) are not equivalent; they differ in their accuracy, and when they are substituted for derivatives in
differential equations they generate different algebraic equations. The differences
in the structures of these algebraic equations can have a great infiuence on the
stability of the numerical solution. In this chapter, we will examine the stability
and accuracy of basic finite-difference methods.
2.1 Accuracy and Consistency
The exact derivative can be calculated to within an arbitrarily small error using
any one of (2.1 )-(2.3) by insuring that !i.x is sufficiently smalI. However, since
computer capacities always place a practicallimit on the numerical resolution, it is
necessary to consider the case when !i.x is small but finite and to inquire whether
one of the finite-difference formulas (2.1)-(2.3) is likely to be more accurate than
the others. If I(x) is sufficiently smooth, this question can be answered by expan ding the terms 1ike I(xo ± !i.x) in Taylor series about Xo and substituting
these expansions into the finite -difference formula. For example, when
df
(!i.x)2 d 2 I
(!i.x)3 d 3 I
I(xo + !i.x) = I(xo) +!i.x dx (xo) + - 2 - dx 2 (xo) + -6- dx 3 (xo) + ...
is substituted into (2.1), one finds that
I(xo + !i.x) - I(xo) _ dl (xo) = !i.x d
2 I (xo) + (!i.x)2 d
3 I (xo) + .. '. (2.4)
!i.x
dx
2 dx 2
6 dx 3
The right side of (2.4) is known as the truncation error. The lowest power of
Sx in the truncation error determines the order 01 accuracy of the finite difference. Inspection of its truncation error shows that the one-sided difference (2.1) is
first-order accurate. In contrast, the truncation error associated with the centered
difference (2.3) is
(!i.X)2 d 3 I
(!i.x)4 d5 I
----(xo) + ----(xo) + .. .
6 dx 3
120 dx 5
'
and the centered difference is therefore second-order accurate. If the higher-order
derivatives of I are bounded in some interval about Xo (i.e., I is "smooth") and
the grid spacing is reduced, the error in the second-order difference (2.3) will approach zero more rapidly than the error in the first-order difference (2.1) . The fact
Précédent

- 51/476

Suivant