Sie sind auf Seite 1von 7

# 02.03.

1

Chapter 02.03
Differentiation of Discrete Functions

After reading this chapter, you should be able to:

1. find approximate values of the first derivative of functions that are given at
discrete data points, and
2. use Lagrange polynomial interpolation to find derivatives of discrete functions.

To find the derivatives of functions that are given at discrete points, several methods are
available. Although these methods are mainly used when the data is spaced unequally, they
can be used for data that is spaced equally as well.

Forward Difference Approximation of the First Derivative
We know
( )
( ) ( )
x
x f x x f
x f
x
A
A +
= '
A 0
lim
For a finite x A ,
( )
( ) ( )
x
x f x x f
x f
A
A +
~ '
02.03.2 Chapter 02.03

Figure 1 Graphical representation of forward difference approximation of first derivative.

So given 1 + n data points ( ) ( ) ( ) ( )
n n
y x y x y x y x , , , , , , , ,
2 2 1 1 0 0
, the value of ) (x f ' for
1 +
s s
i i
x x x , 1 ,..., 0 = n i , is given by
( )
( ) ( )
i i
i i
i
x x
x f x f
x f

~ '
+
+
1
1

Example 1
The upward velocity of a rocket is given as a function of time in Table 1.

Table 1 Velocity as a function of time.
(s) t ) m/s ( ) (t v
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

Using forward divided difference, find the acceleration of the rocket at s 16 = t .
Solution
To find the acceleration at s 16 = t , we need to choose the two values of velocity closest to
s 16 = t , that also bracket s 16 = t to evaluate it. The two points are s 15 = t and s 20 = t

) (x f
x x A +
x
x
Differentiation of Discrete Functions 02.03.3

( )
( ) ( )
t
t t v
t a
i i
i
A

~
+
v
1

15 =
i
t
20
1
=
+ i
t

5
15 20
1
=
=
= A
+ i i
t t t

( )
( ) ( )
5
15 20
16
v v
~ a

5
78 . 362 35 . 517
=

=
2
m/s 30.914

Direct Fit Polynomials
In this method, given 1 + n data points ( ) ( ) ( ) ( )
n n
y x y x y x y x , , , , , , , ,
2 2 1 1 0 0
, one can fit a
th
n
order polynomial given by
( )
n
n
n
n n
x a x a x a a x P + + + + =

1
1 1 0

To find the first derivative,
( ) ( )
1 2
1 2 1
1 2
) (

+ + + + = = '
n
n
n
n
n
n
x na x a n x a a
dx
x dP
x P
Similarly, other derivatives can also be found.

Example 2
The upward velocity of a rocket is given as a function of time in Table 2.

Table 2 Velocity as a function of time.
(s) t ) m/s ( ) (t v
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Using a third order polynomial interpolant for velocity, find the acceleration of the rocket at
s 16 = t .

Solution
For the third order polynomial (also called cubic interpolation), we choose the velocity given
by
( )
3
3
2
2 1 0
t a t a t a a t v + + + =
02.03.4 Chapter 02.03

Since we want to find the velocity at s 16 = t , and we are using a third order polynomial, we
need to choose the four points closest to 16 = t and that also bracket 16 = t to evaluate it.
The four points are , 15 , 10
1 0
= = t t 20
2
= t and 5 . 22
3
= t .
( ) 04 . 227 , 10
0 0
= = t v t
( ) 78 . 362 , 15
1 1
= = t v t
( ) 35 . 517 , 20
2 2
= = t v t
( ) 97 . 602 , 5 . 22
3 3
= = t v t

such that
( ) ( ) ( ) ( )
3
3
2
2 1 0
10 10 10 04 . 227 10 a a a a v + + + = =
( ) ( ) ( ) ( )
3
3
2
2 1 0
15 15 15 78 . 362 15 a a a a v + + + = =
( ) ( ) ( ) ( )
3
3
2
2 1 0
20 20 20 35 . 517 20 a a a a v + + + = =
( ) ( ) ( ) ( )
3
3
2
2 1 0
5 . 22 5 . 22 5 . 22 97 . 602 5 . 22 a a a a v + + + = =
Writing the four equations in matrix form, we have

(
(
(
(

=
(
(
(
(

(
(
(
(

97 . 602
35 . 517
78 . 362
04 . 227
11391 25 . 506 5 . 22 1
8000 400 20 1
3375 225 15 1
1000 100 10 1
3
2
1
0
a
a
a
a

Figure 2 Graph of upward velocity of the rocket vs. time.
Differentiation of Discrete Functions 02.03.5

Solving the above four equations gives
3810 . 4
0
= a
289 . 21
1
= a
13065 . 0
2
= a
0054606 . 0
3
= a
Hence
( )
3
3
2
2 1 0
t a t a t a a t v + + + =
5 . 22 10 , 0054606 . 0 13065 . 0 289 . 21 3810 . 4
3 2
s s + + + = t t t t
The acceleration at 16 = t is given by
( ) ( )
16
16
=
=
t
t v
dt
d
a
Given that ( ) 5 . 22 10 , 0054606 . 0 13065 . 0 289 . 21 3810 . 4
3 2
s s + + + = t t t t t v ,
( ) ( ) t v
dt
d
t a =
( )
3 2
0054606 . 0 13065 . 0 289 . 21 3810 . 4 t t t
dt
d
+ + + =
5 . 22 10 , 016382 . 0 26130 . 0 289 . 21
2
s s + + = t t t
( ) ( ) ( )
2
16 016382 . 0 16 26130 . 0 289 . 21 16 + + = a

2
m/s 664 . 29 =

Lagrange Polynomial
In this method, given ( ) ( )
n n
y x y x , , , ,
0 0
, one can fit a
th
n order Lagrangian polynomial
given by

=
=
n
i
i i n
x f x L x f
0
) ( ) ( ) (
where n in ) (x f
n
stands for the
th
n order polynomial that approximates the function
) (x f y = and
[
=
=

=
n
i j
j j i
j
i
x x
x x
x L
0
) (
) (x L
i
is a weighting function that includes a product of 1 n terms with terms of i j =
omitted.
Then to find the first derivative, one can differentiate ( ) x f
n
once, and so on for other
derivatives.
For example, the second order Lagrange polynomial passing through
( ) ( ) ( )
2 2 1 1 0 0
, and , , , , y x y x y x is

02.03.6 Chapter 02.03

( )
( )( )
( )( )
( )
( )( )
( )( )
( )
( )( )
( )( )
( )
2
1 2 0 2
1 0
1
2 1 0 1
2 0
0
2 0 1 0
2 1
2
x f
x x x x
x x x x
x f
x x x x
x x x x
x f
x x x x
x x x x
x f

+

+

=

Differentiating the above equation gives

( )
( )
( )( )
( )
( )
( )( )
( )
( )
( )( )
( )
2
1 2 0 2
1 0
1
2 1 0 1
2 0
0
2 0 1 0
2 1
2
2 2 2
x f
x x x x
x x x
x f
x x x x
x x x
x f
x x x x
x x x
x f

+
+

+
+

+
=
'

Differentiating again would give the second derivative as

( )
( )( )
( )
( )( )
( )
( )( )
( )
2
1 2 0 2
1
2 1 0 1
0
2 0 1 0
2
2 2 2
x f
x x x x
x f
x x x x
x f
x x x x
x f

+

+

= ' '

Example 3
The upward velocity of a rocket is given as a function of time in Table 3.

Table 3 Velocity as a function of time.
(s) t ) m/s ( ) (t v
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

Determine the value of the acceleration at s 16 = t using second order Lagrangian polynomial
interpolation for velocity.
Solution
) ( ) ( ) ( ) (
2
1 2
1
0 2
0
1
2 1
2
0 1
0
0
2 0
2
1 0
1
t v
t t
t t
t t
t t
t v
t t
t t
t t
t t
t v
t t
t t
t t
t t
t v
|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

+
|
|
.
|

\
|

|
|
.
|

\
|

=
( )
( )
( )( )
( )
0
2 0 1 0
2 1
2
t
t t t t
t t t
t a v

+
=
( )
( )( )
( )
1
2 1 0 1
2 0
2
t
t t t t
t t t
v

+
+
( )
( )( )
( )
2
1 2 0 2
1 0
2
t
t t t t
t t t
v

+
+

( )
( ) ( )
( )( )
( ) 04 . 227
20 10 15 10
20 15 16 2
16

+
= a
( ) ( )
( )( )
( ) 78 . 362
20 15 10 15
20 10 16 2

+
+

( ) ( )
( )( )
( ) 35 . 517
15 20 10 20
15 10 16 2

+
+
( ) ( ) ( ) 35 . 517 14 . 0 78 . 362 08 . 0 04 . 227 06 . 0 + =

2
m/s 784 . 29 =
Differentiation of Discrete Functions 02.03.7

DIFFERENTIATION
Topic Differentiation of Discrete Functions
Summary These are textbook notes differentiation of discrete functions
Major General Engineering
Authors Autar Kaw, Luke Snyder
Date December 23, 2009
Web Site http://numericalmethods.eng.usf.edu