Graphics Programs Reference

In-Depth Information

Central difference approximationsfor otherderivatives can beobtained from

Eqs. (a)-(h) in a similar manner. For example, eliminating
f
(
x
)fromEqs. (f ) and (h)

and solving for
f
(
x
) yield

f
(
x

+

2
h
)

−

2
f
(
x

+

h
)

+

2
f
(
x

−

h
)

−

f
(
x

−

2
h
)

f
(
x
)

(
h
2
)

=

+
O

(5.3)

2
h
3

The approximation

+

−

+

+

−

−

+

−

f
(
x

2
h
)

4
f
(
x

h
)

6
f
(
x
)

4
f
(
x

h
)

f
(
x

2
h
)

f
(4)
(
x
)

(
h
2
)

=

+
O

(5.4)

h
4

is available fromEq. (e) and (g) after eliminating
f
(
x
). Table 5.1 summarizes the

results.

−

−

+

+

f
(
x

2
h
)

f
(
x

h
)

f
(
x
)

f
(
x

h
)

f
(
x

2
h
)

2
hf
(
x
)

−

1

0

1

h
2
f
(
x
)

1

−

2

1

2
h
3
f
(
x
)

−

1

2

0

−

2

1

h
4
f
(4)
(
x
)

1

−

4

6

−

4

1

Table 5.1.
Coefficients of central finite difference approximations

of

O

(
h
2
)

First Noncentral Finite Difference Approximations

Central finite difference approximations are not always usable.For example, consider

the situationwhere the functionis givenat the
n
discrete points
x
1
,

x
2
,...,

x
n
.Since

central differences use values of the function on each sideof
x
, we wouldbe unable to

compute the derivatives at
x
1
and
x
n
.Clearly, there is aneed for finite difference

expressionsthat requireevaluations of the function only on onesideof
x
. These

expressions arecalled
forward
and
backward
finite difference approximations.

Noncentral finite differences can also beobtained fromEqs. (a)-(h).Solving

Eq. (a)for
f
(
x
) we get

h
2

6

h
3

4!

f
(
x

+

h
)

−

f
(
x
)

h

2
f
(
x
)

f
(
x
)

f
(
x
)

f
(4)
(
x
)

=

−

−

−

−···

h

Keeping only the first term on the right-hand sideleads to the
first forward difference

approximation

f
(
x

+

h
)

−

f
(
x
)

f
(
x
)

=

+
O

(
h
)

(5.5)

h

Similarly, Eq. (b) yields the
first backward difference approximation

f
(
x
)

−

f
(
x

−

h
)

f
(
x
)

=

+
O

(
h
)

(5.6)

h

Search WWH ::

Custom Search