You are on page 1of 3

Numerical Methods

11 July 2016
Forward, Backward, and Central Differences
u u x, y
Suppose
is a function of two variables that we only know at grid points
xi , y j .
ui , j u xi , y j .
We will use the notation
We can suppose that the grid points are evenly
h
spaced, with an increment of in the x direction and k in the y direction. The central difference
formulas for the partial derivatives would be
1
1
u x xi , y j
ui 1, j ui 1, j
u y xi , y j
ui , j 1 ui , j 1 .
2h
2k
and

The second partial derivatives are


1
u xx xi , y j 2 ui 1, j 2ui , j ui 1, j
h

u yy xi , y j
and

1
ui , j 1 2ui , j ui , j 1 .
k2

and the mixed partial derivative is

u xy xi , y j

1
ui 1, j 1 ui 1, j 1 ui 1, j 1 ui 1, j 1 .
4hk

Lets consider an example. Let the values of u at


5.1 6.5

5.5 6.8
uij
5.5 6.9

5.4 9.6

xi , y j
7.5
7.8
9.0
9.1

be recorded in the matrix


8.1 8.4

8.3 8.9
8.4 9.1

8.6 9.4

Assume the indices begin at 1, i is the index for rows and j the index for column. Suppose that
u y x2 , y4
h 0.5
k 0.2.
and
Then
would be approximated by the central difference
u u
8.9 7.8
u y x2 , y4 2,5 2,3
2.75
2k
2 0.2

u xx x2 , y4
The partial derivative
u xx x2 , y4

is approximated by
u u u u
9.1 9.0 8.4 7.5
3,5 3,3 1,5 1,3
2
4hk
4 0.5
0.2

Exercises:
1. Suppose you are given the data in the following table.
t

0.5

1.0

1.5

2.0

0.19

0.26

0.29

0.31
f ' 1 .

a. Give the forward, backward and central difference approximations of


4
f 1 , f 1
f 1 .
b. Give the central difference approximations of
and
u x, y

xi , y j

2. Suppose values of
at points
are given in the matrix in the previous page.
h 0.1
k 0.5.
Suppose that
and
Approximate the following derivatives by central
differences:
u x x2 , y4
a.
u xx x3 , y2
b.
u yy x3 , y2
c.
u xy x2 , y3
d.

You might also like