0% found this document useful (0 votes)
38 views5 pages

Finite Difference Formulas for Derivatives

- Numerical differentiation is a process to estimate the derivative of a function at a given point using finite difference formulas. - The document describes various finite difference formulas for estimating the first, second, third, and fourth derivatives using forward, backward, and central differences with different point stencils. - The accuracy of each formula, represented by the truncation error term, depends on the step size h with higher-order formulas having smaller error terms.

Uploaded by

GarudaOzo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views5 pages

Finite Difference Formulas for Derivatives

- Numerical differentiation is a process to estimate the derivative of a function at a given point using finite difference formulas. - The document describes various finite difference formulas for estimating the first, second, third, and fourth derivatives using forward, backward, and central differences with different point stencils. - The accuracy of each formula, represented by the truncation error term, depends on the step size h with higher-order formulas having smaller error terms.

Uploaded by

GarudaOzo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

3.

Numerical Differentiation (Finite Difference Formulas)

Numerical differentiation is a process to find an estimate of a derivative of a given function at a


given point.
3.5.1

Finite difference approximation of the derivative

The derivative of a function f(x) is defined by the limit


df x
f x x f x
f ' x lim
.

0
dx
x

If x is sufficiently small, equation above can be rewritten as


f ' x

f x x f x
x

with x represents a small change in x and it can be either positive or negative.


To estimate the value of f ' x , we uses the forward, backward, and central finite difference
formulas. Three such formulas are presented as follows with the derivative is calculated from the
values of two points, as in Figure 3.7, by setting xi x , xi 1 x x , and xi 1 x x .
f (x)
C

B
A
0

xi-1

xi

xi+1

Figure 3.7. Finite Difference Approximation of First Derivative

Forward difference is the slope of the line that connects points B and C:
f ' xi

f xi 1 f xi f xi 1 f xi

xi 1 xi
x

Backward difference is the slope of the line that connects points A and B:
f ' xi

f xi f xi 1 f xi f xi 1

xi xi 1
x

Central difference is the slope of the line that connects points A and C:
f ' xi

f xi 1 f xi 1 f xi 1 f xi 1

xi 1 xi 1
2x

3.5.2

Finite difference formulas using Taylor series expansion

The forward, backward, and central finite difference formulas are also can be derived by using
Taylor series expansion as,
f xi 1 f xi hf ' xi

h2
h3
h 4 (4)
h m m
f ' ' xi
f ' ' ' xi
f xi
f xi Rm xi
2!
3!
4!
m!

(1)

and
f xi 1 f xi hf ' xi

n
h2
h3
h 4 4
n h
f ' ' xi
f ' ' ' xi
f xi 1
f n xi Rn xi (2)
2!
3!
4!
n!

where h x is the step size. Rm and Rn , called the remainders, are given by
Rm xi

h j j
f xi and Rn xi
j m 1 j!

j n 1

j!

h
1 j

f j xi .

Subtracting Equation (2) from Equation (1) can produce the two-point central difference formula.
2h3
f xi1 f xi1 2hf ' xi
f ' ' ' xi
3!
f xi1 f xi1 h 2
f ' xi

f ' ' ' xi


2h
3!
f xi1 f xi1

O h2
2h
Hence it is showing that a more accurate formula as the error is of the order of O h 2 has been
obtained.

3.5.3

Summary of finite difference formulas

We can use the following difference formulas to compute the various derivatives.
First Derivative
Differenc
e Type
Twopoint
forward
Twopoint
backward
Twopoint
central
Threepoint
forward
Threepoint
backward
Fourpoint
central

Formula

Truncatio
n Error

f ' xi

f x i 1 f x i
h

O h

f ' xi

f x i f x i 1
h

O h

f ' x i

f x i 1 f x i 1
2h

O h2

f ' x i

f x i 2 4 f x i 1 3 f x i
2h

O h2

f ' x i

3 f x i 4 f x i 1 f x i 2
2h

O h2

f ' xi

f x i 2 8 f x i 1 8 f x i 1 f xi 2
12h

O h4

Second Derivative
Differenc
e Type
Threepoint
forward
Threepoint
backward
Threepoint
central
Fourpoint
forward
Fourpoint
backward
Five-point
central

Formula

Truncatio
n Error

f ' ' x i

f x i 2 2 f x i 1 f x i
h2

O h

f ' ' x i

f x i 2 f x i 1 f x i 2
h2

O h

f ' ' x i

f x i 1 2 f x i f x i 1
h2

O h2

f ' ' x i

f x i 3 4 f x i 2 5 f x i 1 2 f x i
h2

O h2

f ' ' xi

2 f x i 5 f x i 1 4 f x i 2 f xi 3
h2

O h2

f ' ' x i

f x i 2 16 f x i 1 30 f x i 16 f xi 1 f x i 2
12h 2

O h4

Third Derivative
Differenc
e Type
Fourpoint
forward
Fourpoint
backward
Fourpoint
central

Formula

Truncatio
n Error

f ' ' ' xi

f x i 3 3 f x i 2 3 f x i 1 f x i
h3

O h

f ' ' ' xi

f x i 3 f x i 1 3 f x i 2 f x i 3
h3

O h

f ' ' ' xi

f x i 2 2 f x i 1 2 f x i 1 f x i 2
2h 3

O h2

Five-point
forward

f ' ' ' xi

3 f x i 4 14 f xi 3 24 f x i 2 18 f x i 1 5 f x i
2h 3

O h2

Five-point
backward

f ' ' ' xi

5 f x i 18 f x i 1 24 f x i 2 14 f x i 3 3 f x i 4
2h 3

O h2

Six-point
central

f ' ' ' xi

f x i 3 8 f xi 2 13 f x i 1 13 f x i 1 8 f x i 2 f x i 3
8h 3

O h4

Fourth Derivative
Differenc
e Type

Formula

Truncatio
n Error

Five-point
forward

f 4 x i

f x i 4 4 f x i 3 6 f x i 2 4 f x i 1 f x i
h4

O h

Five-point
backward

f 4 x i

f x i 4 f x i 1 6 f x i 2 4 f x i 3 f x i 4
h4

O h

Five-point
central

f 4 x i

f x i 2 4 f x i 1 6 f x i 4 f x i 1 f x i 2
h4

O h2

Six-point
forward

f 4 x i

2 f x i 5 11 f x i 4 24 f x i 3 26 f x i 2 14 f x i 1 3 f x i
h4

O h2

Six-point
backward

f 4 x i

3 f xi 14 f x i 1 26 f x i 2 24 f x i 3 11 f x i 4 2 f x i 5
h4

O h2

Sevenpoint
central

f 4 x i

f x i 3 12 f x i 2 39 f x i 1 56 f x i 39 f x i 1 12 f x i 2 f x i 3
O h4
6h 4

Example 3.19
Calculate the first derivative for the function f x 3 x 3 2 x 2 x at point x = 5 numerically
with the forward, backward and central finite difference formulas by using
(i) points x = 4, x = 5, and x = 6.
(ii) points x = 4.75, x = 5, and x = 5.25.
Compare the results with the exact (analytical) derivative.
Solution
Analytical differentiation:
f ' x 9 x 2 4 x 1
when x 5, f ' 5 246

Numerical differentiation:
(i)
x:
f(x):

Forward finite difference:


f 6 f 5 726 430
f ' 5

296
65
1
Backward finite difference:
f 5 f 4 430 228
f ' 5

202
54
1
Central finite difference:
f 6 f 4 726 228
f ' 5

249
64
2

4
228

5
430

6
726

error

296 246
100 20.33%
246

error

202 246
100 17.89%
246

error

249 246
100 1.22%
246

(ii)
x:
f(x):

Forward finite difference:

4.75
371.390625

5
430

5.25
494.484375

f ' 5

f 5.25 f 5 494.484375 430

257.9375
5.25 5
0.25

Backward finite difference:


f 5 f 4.75 430 371.390625
f ' 5

234.4375
5 4.75
0.25

error

257.9375 246
100 4.85%
246

error

234.4375 246
100 4.70%
246

Central finite difference:


f 5.25 f 4.75 494.484375 371.390625
f ' 5

246.1875
5.25 4.75
0. 5
246.1875 246
error
100 0.08%
246
The results show that the central finite difference formula gives a more accurate
approximation. In addition, smaller step size h gives a significantly more accurate approximation.
Example 3.20
The following table lists the population of Malaysia from 1980 2010.
Table 3.4. The Population of Malaysia in years 1980 2010
Year
Population (millions)

1980
13.9

1985
15.9

1990
18.1

1995
20.7

2000
23.5

2005
26.5

2010
28.3

Calculate the rate of growth of the population in millions per year for 2010.
(i) Use two-point backward difference formula.
(ii) Use three-point backward difference formula.
(iii) Based on part (ii) above, apply the two-point central difference formula to predict the
population in the year 2015.
Solution
(i)

f ' 2010

f 2010 f 2005 28.3 26.5

0.36 millions per year


2010 2005
5

3 f 2010 4 f 2005 f 2000 328.3 426.5 23.5

25
10
0.24 millions per year

(ii) f ' 2010

f 2015 f 2005
25
f 2015 26.5
0.24
10
f 2015 28.9 millions

(iii) f ' 2010

You might also like