Professional Documents
Culture Documents
4.0.
Introduction
In the conventional calculus the operation of differentiation of a function is a welldefined, formal procedure with the operations highly dependent upon the form of the function
involved. Many different types of rules are needed for different functions. In numerical
(approximate) methods a digital computer is employed which can only perform the standard
arithmetic operations of addition, subtraction, multiplication, division, exponentiation and
certain logical operations. We thus need a technique for (approximately) differentiating
functions by employing only arithmetic operations. The finite difference calculus satisfies this
need.
4.1.
f(x)
actual slope
c h x=c c+h
1 If a function f(x) possesses a derivative at x = c and at every point in some neighborhood of c, the f(x) is said
31
32
h2
h3
f (c) +
f (c) + L
2!
3!
(4.1)
f (c + h) f (c) h
h2
f (c)
f (c) L
h
2
6
or
f (x) x =c =
f (c + h) f (c)
+ O(h)
h
(4.2)
(4.3)
Equation (4.3) represents an expression for f (x) at x = c that is accurate within an error
f (c + h) f (c)
of h. Graphically the expression
approximates the slope of f at the point x = c
h
by the slope of the straight line passing through f(c + h) and f(c); i.e.,
f(x)
forward
difference
approximation
actual slope
c h x=c c+h
Figure 4.2. Forward Difference Approximation to the Slope at x = c.
Clearly, as h is reduced, the approximate slope approaches the exact one. For
convenience and brevity, the following subscript notation is adopted
f (x) x =c f j
(4.4)
f (x) x =c + h f j +1
33
(4.5)
(4.6)
F f j
+ O(h)
h
(4.7)
4h 3
f (c) + L
3
(4.8)
Subtracting two times equation (4.1) from equation (4.8) drops out the f (c) terms,
giving
f (c + 2h) 2 f (c + h) = f (c) + h 2 f (c) + h 3 f (c) + L
(4.9)
f j + 2 2 f j +1 + f j
+ O(h)
h2
(4.10)
(4.11)
2F f j
+ O(h)
h2
(4.12)
It follows that
f (x) x =c =
34
In general, any forward difference may be obtained by starting from the first difference
and by using the following recurrence formula
nF f j = F nF1 f j
(4.13)
That is, any order forward difference can be obtained by taking the forward differences
of the next lower forward differences. In general, the forward difference expression for
derivatives of any order is given by
dn f
dx n
x =c
nF f j
= n + O(h)
h
(4.14)
Example 4.1. Forward difference O(h) for the third derivative of a function.
{ {
3F f j = F 2F f j = F F F f j
{ {
= F F f j +1 f j
= F
{( f
j +2
}} = {
) (
f j +1 f j +1 f j
) (
) (
f j +1 F f j
)} = { f
F
}}
j +2
(1)
2 f j +1 + f j
= f j +3 f j + 2 2 f j + 2 f j +1 + f j +1 f j = f j +3 3 f j + 2 + 3 f j +1 f j
Then according to equation (4.14)
d3 f
dx 3
x =c
3F f j
f 3 f j + 2 + 3 f j +1 f j
= 3 + O(h) = j +3
+ O(h)
h
h3
Forward difference approximations to the first four derivatives are given in Table 4.1.
(2)
35
fj
fj+1
h f (xj ) =
h2 f (xj ) =
fj+2
fj+3
fj+4
1
+ O(h)
h3 f (xj ) =
h4 f iv (xj ) =
The above forward differences are all O(h). However, by including more terms in the
Taylor series expansion, expressions of greater accuracy may be obtained. For example, from
equation (4.2) it follows that
f (c) =
f (c + h) f (c) h
h2
f (c) L
f (c)
h
6
2
(4.15)
The approximation to f (x) x =c is given by equation (4.10), which is now written in the
form
f (c) =
f j + 2 2 f j +1 + f j
hf (c)
h2
(4.16)
Substituting equation (4.16) into equation (4.15), and using exclusively subscript
notation gives
f (x) x =c =
f j +1 f j f j + 2 2 f j +1 + f j h 2
+
f (c) + L
h
2h
3
(4.17)
f j + 2 + 4 f j +1 3 f j
+ O(h)2
2h
(4.18)
or
f (x) x =c =
36
fj
fj+1
fj+2
2h f (xj ) =
h2 f (xj ) =
fj+3
fj+4
fj+5
1
+ O (h)2
2h3 f (xj ) =
18
24
14
h4 f iv (xj ) =
14
26
24
11
Observe from Tables 4.1 and 4.2 that for a given approximation (i.e., a given row in the
tables), the coefficients sum to zero. Why must this be so ? 2
4.2.
Consider an expression for f(c h) by using a Taylor series expansion of f(c) about the
point x = c
f (c h) = f (c) hf (c) +
h2
h3
f (c)
f (c) + L
2!
3!
(4.19)
f (c) f (c h) h
h2
+ f (c)
f (c) + L
h
2
6
or
f (x) x =c =
f j f j 1
+ O(h)
h
(4.20)
(4.21)
2 The coefficients associated with any finite difference approximation must add up to zero so that if a function is
constant over [a, b], the first (and subsequent) derivative must be exactly zero.
37
B f j f j f j 1
(4.22)
B f j
+ O(h)
h
(4.23)
The graphical interpretation of the first backward difference of f at j is the slope of the
straight line connecting f (x) x =c and f (x) x =c + h . That is,
f(x)
backward
difference
approximation
actual slope
ch
c+h
f j 2 f j 1 + f j 2
+ O(h)
h2
(4.24)
or
f (x) x =c
2B f j
= 2 + O(h)
h
(4.25)
In general, any backward difference may be obtained by starting from the first backward
difference and by using the following recurrence formula
38
nB f j B nB1 f j
(4.26)
That is, any order backward difference can be obtained by taking the backward differences of
the next lower backward differences.
In general, the backward difference expression for derivatives of any order is given by
dn f
dx n
x =c
nB f j
= n + O(h)
h
(4.27)
fj 4
fj 3
fj 2
h f (xj ) =
h2 f (xj ) =
fj 1
fj
1
+ O(h)
h3 f (xj ) =
h4 f iv (xj ) =
Higher order backward differences are obtained by simply taking more terms in the
Taylor series expansion. An example of a higher order backward difference approximation for
f (x) x =c is
f (x) x =c =
3 f j 4 f j 1 + f j 2
+ O(h)2
2h
(4.28)
39
fj 5
fj 4
fj 3
2h f (xj ) =
h2 f (xj ) =
fj 2
fj 1
fj
2
+ O (h)2
2h3 f (xj ) =
h4 f iv (xj ) =
14
24
18
11
24
26
14
4.3.
Consider once again the analytic function f(x) shown in Figure 4.1. The forward and
backward Taylor series expansions about x = c are respectively
f (c + h) = f (c) + hf (c) +
h2
h3
f (c) +
f (c) + L
2!
3!
(4.29)
f (c h) = f (c) hf (c) +
h2
h3
f (c)
f (c) + L
2!
3!
(4.30)
Subtracting equation (4.30) from equation (4.29) cancels the even powers of h, giving
f (c + h) f (c h) = 2hf (c) +
h3
f (c) + L
3
(4.31)
f (c + h) f (c h) h 2
f (c) L
2h
6
(4.32)
40
f j +1 f j 1
+ O(h)2
2h
f (x) x =c =
(4.33)
f(x)
central
difference
approximation
actual slope
ch
c+h
To obtain an expression for f (x) x =c that is O(h)2 , add equations (4.29) and (4.30).
The results is
f (c + h) + f (c h) = 2 f (c) + h 2 f (c) +
h 4 iv
f (c) + L
12
(4.34)
or
f (c) =
f (c + h) 2 f (c) + f (c h) h 2 iv
f (c) L
h2
12
(4.35)
Finally, using subscript notation, the central difference representation for f (x) at x j is
given by
f (x) x =c =
f j +1 2 f j + f j 1
+ O(h)2
2
h
(4.36)
41
x=xj
nB f j + 0.5n + nF f j 0.5n
=
+ O(h)2
2h n
nB f j + 0.5(n 1) + nF f j 0.5(n 1)
2h
x=xj
; n even
+ O(h)2
(4.37)
; n odd
(4.38)
Central difference approximations O(h)2 and O(h)4 to the first four derivatives are given
in Tables 4.5 and 4.6, respectively.
fj 1
fj
fj+1
2h f (xj ) =
h2 f (xj ) =
fj 2
fj+2
+ O(h)2
2h3 f (xj ) =
h4 f iv (xj ) =
42
fj 3
fj 2
fj-1
fj
fj+1
fj+2
12h f (xj ) =
12 h2 f (xj ) =
16
16
30
fj+3
+ O(h)4
8h3 f (xj ) =
13
13
6 h4 f iv (xj ) =
12
39
56
39
12
4.4.
f
:
x i, j
f
f i, j
f
= i +1, j
+ O(h)
x i, j
h
(4.39)
f
:
x i, j
f f i 1, j
f
= i, j
+ O(h)
x i, j
h
(4.40)
43
f
:
x i, j
f
f i 1, j
f
= i +1, j
+ O(h)2
x i, j
2h
2 f
x 2
=
i, j
2 f
x 2
(4.41)
:
i, j
f i +1, j 2 f i, j + f i 1, j
+ O(h)2
2
h
(4.42)
f
2 f
and
y i, j
y2
.
i, j
44
4.5.
References
1. L. Leithold. The Calculus with Analytic Geometry. Harper and Row Publishers, New
York, 1972.
2. C. R. Wylie. Advanced Engineering Mathematics, 4th ed. McGraw-Hill Book Co., 1975.