Chapter 02.03 Differentiation of Discrete Functions
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
f x x f x f x lim x x
For a finite x ,
f x x f x f x
x
f (x ) x x x x Figure 1 Graphical representation of forward difference approximation of first derivative.
So given n
1 data points x , y , x , y , x , y , , x , y , the value of f (x ) for
1 1 2 2 n n x x x , i ,..., n i i 1 1 , is given by f x f x i 1 i f x
i x x i 1 i
Example 1 The upward velocity of a rocket is given as a function of time in Table 1.
Velocity as a function of time.
Table 1
t (s) v (t ) ( m/s )
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 t 16 s .
Solution
To find the acceleration at t 16 s , we need to choose the two values of velocity closest to
t
16 s , that also bracket t 16 s to evaluate it. The two points are t 15 s and t 20 s
v t t i 1 i a t i
t 15 t i 20 t i 1
t t t
i 1 i
20
15
5 20
15
a
16
5 517 . 35 362 .
78
5 2 = 30.914 m/s
Direct Fit Polynomials th
In this method, given n
1 data points x , y , x , y , x , y , , x , y , one can fit a n
1 1 2 2 n norder polynomial given by n 1 n
P x a a x a x a x n 1 n 1 n
To find the first derivative,
dP ( x ) n n 2 n 1
P x a n 1 2 a x n 2 n 1 a x na x 1 n dx 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.
t (s) v (t ) ( m/s )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
t 16 s .
Solution
For the third order polynomial (also called cubic interpolation), we choose the velocity given by 2 3
v t a a t a t a t 1 2 3 Since we want to find the velocity at t 16 s , and we are using a third order polynomial, we need to choose the four points closest to t
16 and that also bracket t 16 to evaluate it.
The four points are t 10 , t 15 , and t 22 . 5 .
t 1 2 20 3
t 10 , v t 227 .
04
t 1 15 , v t 362 . 1
78 t 20 , v t 517 .
35 2 2 t 22 .
5 , v t 602 .
97 3 3 such that 2 3
v 10 227 . 04 a a 1 10 a 2
10 a
2 310 3 v 15 362 . 78 a a 1 15 a 2
15 a
2 315 3 v 20 517 . 35 a a 1 20 a 2
20 a
3 220 3 v 22 . 5 602 . 97 a a 1 22 . 5 a 2
22 .
5 a 3 22 . 5 Writing the four equations in matrix form, we have
1 10 100 1000 a 227 .
04
1 15 225 3375 a 362 . 1
78
1 20 400 8000 a 517 . 2 35 1 22 . 5 506 . 25 11391 a 602 . 3
97 Solving the above four equations gives 3810 a 4 .
a 21 . 289 1 a . 13065 2 0054606 a . 3
Hence 2 3
v t a a t a t a t 1 2 3 2 3
4 . 3810 21 . 289 t . 13065 t . 0054606 t , 10 t 22 .
5 The acceleration at t
16 is given by d a
16 v t
t 16 dt 2 3 Given that v t
4 . 3810 21 . 289 t . 13065 t . 0054606 t , 10 t 22 . 5 ,
d a t v t
dt d
2
3 4 . 3810 21 . 289 t . 13065 t . 0054606 t
dt 2
21 . 289 . 26130 t . 016382 t , 10 t 22 .
5 2
a
16 21 . 289 . 26130 16 . 016382
16
2
29 . 664 m/s
Lagrange Polynomial th
In this method, given x , y , , x , y , one can fit a n order Lagrangian polynomial n n given by n
f ( x ) L ( x ) f ( x ) n i i i th
where n in f (x ) stands for the n order polynomial that approximates the function n
y f (x ) and n x x j L ( x ) i
j x x j i i j
L (x ) is a weighting function that includes a product of n i 1 terms with terms of j i omitted.
Then to find the first derivative, one can differentiate f x once, and so on for other n derivatives. For example, the second order Lagrange polynomial passing through
x , y , x , y , and x , y is 1 1 2 2
x x x x x x x x x x x x 1 2 2 1
f x f x f x f x
2 1 2 x x x x x x x x x x x x 1 2 1 1 2 2 2 1 Differentiating the above equation gives 2 x x x 1 2 2 x x x 2 2 x x x 1 f x f x f x f x 2 1 2
x x x x x x x x x x x x 1 2 1 1 2 2 2 1 Differentiating again would give the second derivative as
2
2
2
f x f x f x f x
2 1 2 x x x x x x x x x x x x 1 2 1 1 2 2 2 1 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.
t (s) v (t ) ( m/s )
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 t 16 s using second order Lagrangian polynomial interpolation for velocity.
Solution
t t t t
t t t t t t t t
1 2 2 1v ( t ) v ( t ) v ( t ) v ( t )
1 2
t t t t t t t t t t t t
1 2 1 1 2 2 2 1
2 t t t 2 t t t 1 2 2 t t t 2 1 a t t t t 1 2
t t t t t t t t t t t t
1 2 11
2 2 2 12 16 15 20 2 16 10 20
a 16 227 .
04 362 .
78
10 15 10 20 15 10 15 20 2 16 10 15 517 .
35
20 10 20 15 .
06 227 . 04 . 08 362 . 78 . 14 517 .
35 2
29 . 784 m/s 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