Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Differentiation –Discrete

Functions

1
Introduction
 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.

2
Forward Difference
Approximation
lim f x  Δx   f x 
f x  
Δx  0 Δx
For a finite ' Δx'

f x  x   f x 
f x  
x

3
Graphical Representation Of
Forward Difference
Approximation

f(x)

x x+Δx

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

4
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


t v(t)
s 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 .

5
Example 1 Cont.
Solution
To find the acceleration at t  16s, we need to choose the two values
closest to t  16s, that also bracket t  16s to evaluate it. The two
points are t  15s and t  20s.
 ti 1   ti 
ati  
t
ti  15
ti 1  20

t  ti 1  ti
 20  15
5

6
Example 1 Cont.

 20   15
a16  
5
517.35  362.78

5
 30.914 m/s 2

7
Direct Fit Polynomials
In this method, given ' n  1' data points x0 , y 0 , x1 , y1 , x 2 , y 2 ,, x n , y n 
one can fit a n th order polynomial given by
Pn x   a0  a1x    an 1x n 1  an xn

To find the first derivative,

Pnx    a1  2a2 x    n  1an1 x n2  nan x n1


dPn ( x)
dx

Similarly other derivatives can be found.

8
Example 2-Direct Fit Polynomials
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 v(t)
s m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

Using the third order polynomial interpolant for velocity, find the
acceleration of the rocket at t  16 s .

9
Example 2-Direct Fit Polynomials cont.
Solution
For the third order polynomial (also called cubic interpolation), we choose the velocity given by

vt   a0  a1t  a2 t 2  a3t 3


Since we want to find the velocity at t  16 s , and we are using third order polynomial, we need
to choose the four points closest to t  16 s and that also bracket t  16 s to evaluate it.

The four points are to  10, t1  15, t2  20, and t3  22.5.


to  10, vto   227.04

t1  15, vt1   362.78


t2  20, vt2   517.35
t3  22.5, vt3   602 .97
10
Example 2-Direct Fit Polynomials cont.
such that
v10   227 .04  a0  a1 10   a 2 10   a3 10 
2 3

v15  362 .78  a0  a1 15  a2 15  a3 15


2 3

v20   517 .35  a0  a1 20   a2 20   a3 20 


2 3

v22.5  602 .97  a0  a1 22.5  a2 22.5  a3 22.5


2 3

Writing the four equations in matrix form, we have

1 10 100 1000  a0  227 .04


1 15 225 3375   a  362 .78 
  1    
1 20 400 8000  a 2  517 .35 
    
1 22 .5 506 .25 11391  3  
a 602 .97 
11
Example 2-Direct Fit Polynomials cont.
Solving the above four equations gives

a0  4.3810
a1  21.289
a2  0.13065
a3  0.0054606
Hence

vt   a0  a1t  a2t 2  a3t 3


 4.3810  21.289t  0.13065 t 2  0.0054606 t 3 , 10  t  22.5

12
Example 2-Direct Fit Polynomials cont.

Figure 1 Graph of upward velocity of the rocket vs. time.


13
,

Example 2-Direct Fit Polynomials cont.


The acceleration at t=16 is given by

a16  vt  t 16


d
dt
Given that
 t   4.3810  21.289t  0.13065t 2  0.0054606 t 3 ,10  t  22.5
at   vt 
d
dt

d
dt
 4.3810  21.289t  0.13065t 2  0.0054606 t 3 
 21.289  0.26130 t  0.016382 t 2 , 10  t  22.5

a16  21.289  0.26130 16  0.016382 16


2

 29.664 m/s 2
14
Lagrange Polynomial
In this method, given x1 , y1 ,, xn , yn  , one can fit a n  1th order Lagrangian polynomial
given by
n
f n ( x)   L ( x) f ( x )
i 0
i i

where ‘ n ’ in f n (x ) stands for the th


n order polynomial that approximates the function
y  f (x) given at (n  1) data points as x0 , y0 , x1 , y1 ,......,xn1 , y n1 , xn , y n  , and
n x  xj
Li ( x)  
j 0 xi  x j
j i

Li (x) a weighting function that includes a product of (n  1) terms with terms of


j i omitted.

15
Lagrange Polynomial Cont.
Then to find the first derivative, one can differentiate f n  x  once, and so on

for other derivatives.

For example, the second order Lagrange polynomial passing through

x0 , y0 , x1, y1 , x2 , y2  is

f 2 x  
x  x1 x  x2  f x   x  x0 x  x2  f x   x  x0 x  x1  f x 
x0  x1 x0  x2  0 x1  x0 x1  x2  1 x2  x0 x2  x1  2

Differentiating equation (2) gives

16
Lagrange Polynomial Cont.
 2 x  x1  x2  2 x  x0  x2  2 x  x0  x1 
f 2 x   f x0   f x1   f x 
x0  x1 x0  x2  x1  x0 x1  x2  x2  x0 x2  x1  2

Differentiating again would give the second derivative as

f 2x   f x0   f x1   f x2 


2 2 2
x0  x1 x0  x2  x1  x0 x1  x2  x2  x0 x2  x1 

17
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 v(t)
s 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 the second


order Lagrangian polynomial interpolation for velocity.

18
Example 3 Cont.
Solution
 t  t1  t  t 2   t  t0  t  t 2   t  t0  t  t1 
v(t )    v(t 0 )    v(t1 )    v(t 2 )
 t 0  t1  t 0  t 2   t1  t 0  t1  t 2   t2  t0  t 2  t1 
2t  t1  t 2  2t  t 0  t 2 
at    t 0    t1   2t  t0  t1  νt2 
t 0  t1 t 0  t 2  t1  t 0 t1  t 2  t2  t0 t2  t1 
216   15  20 
a16  227.04  216  10  20 362.78  20
216   10  15
517.35
10  1510  20 15  1015  20  10 20  15

 0.06227.04  0.08362.78  0.14517.35

 29.784 m/s 2

19
THE END

20

You might also like