Differentiation of discrete Function

Differentiation-Discrete
Functions
Industrial Engineering Majors
Authors: Autar Kaw, Sri Harsha Garapati
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
7/29/2017
http://numericalmethods.eng.usf.edu
1
Differentiation –Discrete
Functions
http://numericalmethods.eng.usf.edu
Forward Difference
Approximation
f x  Δx   f x 
f  x  
Δx  0
Δx
lim
For a finite ' Δx'
f x  x   f x 
f  x  
x
3
http://numericalmethods.eng.usf.edu
Graphical Representation Of
Forward Difference
Approximation
f(x)
x
x+Δx
Figure 1 Graphical Representation of forward difference approximation of first derivative.
4
http://numericalmethods.eng.usf.edu
Example 1
The failure rate ht  of a direct methanol fuel cell (DMFC) is given by
the formula
R' t 
ht  
Rt 
Where Rt  is the reliability at a certain time t , and the values of the
reliability are given in Table 1.
Table 1 Reliability of DMFC system.
t hrs  0 1
Rt 
10
100
1000 2000 3000 4000 5000
1 0.9999 0.9998 0.9980 0.9802 0.9609 0.9419 0.9233 0.9050
Using the forward divided difference method, find the failure rate of the
DMFC system at t  50 hours.
5
http://numericalmethods.eng.usf.edu
Example 1 Cont.
Solution
Rti 1   Rti 
t
ti  10
R' ti  
ti 1  100
t  ti 1  ti
 100  10
 90
R100  R10
90
0.9980  0.9998

90
 2.0000 10 5
R' 50 
6
http://numericalmethods.eng.usf.edu
Example 1 Cont.
The reliability Rt  at hours t  50 is
R100   R10
50  10  R10
100  10
  2.0000 10 5 40  0.9998
R50 


 0.999
The failure rate ht  at t  50 hours is then
R ' 50 
h50   
R 50 
  2.0000  10 5 

 
0.999


 2.0020  10 5
7
http://numericalmethods.eng.usf.edu
Direct Fit Polynomials
In this method, given ' n  1' data points x0 , y0 , x1 , y1 , x2 , y 2 ,, xn , y n 
one can fit a
n th order polynomial given by
Pn x   a0  a1 x    an 1 x n 1  an x n
To find the first derivative,
Pn x  
dPn ( x )
 a1  2a 2 x    n  1a n 1 x n 2  na n x n 1
dx
Similarly other derivatives can be found.
8
http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials
The failure rate ht  of a direct methanol fuel cell (DMFC) is given by
the formula

ht  
R' t
Rt 
Where Rt  is the reliability at a certain time t , and the values of the
reliability are given in Table 2.
Table 2 Reliability of DMFC system.
t hrs  0 1
Rt 
10
100
1000 2000 3000 4000 5000
1 0.9999 0.9998 0.9980 0.9802 0.9609 0.9419 0.9233 0.9050
Using a third order polynomial interpolant for reliability Rt  , find the
failure rate of the DMFC system at t  50 hours.
9
http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials cont.
Solution
For the third order polynomial (also called cubic interpolation), we choose the reliability
given by
2
3
Rt   a0  a1t  a2t  a3t
Since we want to find the reliability at t  50 , and we are using third order polynomial,
we need to choose the four points closest to t  50 and that also bracket t  50 to
evaluate it.
The four points are t0  1 , t1  10 , t2  100 and t3  1000 hours.
to  1, Rto   0.9999
t1  10, Rt1   0.9998
t 2  100, Rt 2   0.9980
t3  1000, Rt3   0.9802
10
http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials cont.
such that
R1  0.9999  a0  a1 1  a2 1  a3 1
2
3
R10  0.9998  a0  a1 10  a2 10 2  a3 10
3
R100  0.9980  a0  a1 100   a2 100   a3 100 
2
3
R1000   0.9802  a0  a1 1000  a2 1000  a3 1000
2
3
Writing the four equations in matrix form, we have
1
1
1   a0  0.9999
1
1 10
  a  0.9998
100
1000

 1   

6
1 100 10000 1 10  a2  0.9980
 


6
9 
a
1
1000
1

10
1

10
0
.
9802

 3  

11
http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials cont.
Solving the above four equations gives
a0  0.9991
a1  1.0023  10 5
a2  9.9788  10 8
a3  9.0101 10 11
Hence
Rt   a0  a1t  a2t 2  a3t 3
 0.99991  1.0023 105 t  9.9788 108 t 2  9.01011011t 3 , 1  t  1000
12
http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials cont.
Figure 2 Graph of reliability as a function of time.
13
http://numericalmethods.eng.usf.edu
,
Example 2-Direct Fit Polynomials cont.
The reliability at t  50 is given by,
R' 50 
d
Rt  t 50
dt
Given that
Rt   0.99991  1.0023 105 t  9.9788 108 t 2  9.01011011t 3 , 1  t  1000
R ' t  
d
R t 
dt
d

0.99991  1.0023  10 5 t  9.9788  10 8 t 2  9.0101 10 11 t 3
dt
 1.0023  10 5  1.9958  10 7 t  2.7030  10 10 t 2 , 1  t  1000

14

http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials cont.
R' 50  1.0023 105  1.9958 107 50  2.7030 1010 50
2
 1.9326 105
Using the same function, we can also calculate the value of Rt  at t  50.
Rt   0.99991  1.0023 10 5 t  9.9788 10 8 t 2  9.010110 11 t 3 , 1  t  1000
R50  0.99991  1.0023 10 5 50  9.9788 10 8 50  9.010110 11 50
2
 0.99917
The failure rate is then
ht   
3
R' t 
Rt 
 1.9326 10 

5
0.99917
 1.9343 10 5
15
http://numericalmethods.eng.usf.edu
Lagrange Polynomial
In this method, given x1 , y1 ,, xn , yn  , one can fit a n  1th order Lagrangian polynomial
given by
f n ( x) 
where ‘ n ’ in
n
 L ( x) f ( x )
i 0
i
i
f n (x) stands for the n th 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
Li ( x)  
j 0
j i
x  xj
xi  x j
Li (x) a weighting function that includes a product of (n  1) terms with terms of
ji
16
omitted.
http://numericalmethods.eng.usf.edu
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 
f 2 x  
is
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
17
http://numericalmethods.eng.usf.edu
Lagrange Polynomial Cont.
2 x  x0  x2 
2 x  x0  x1 
2 x  x1  x2 

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  
18
2
x0  x1 x0  x2 
f x0  
2
x1  x0 x1  x2 
f x1  
2
x2  x0 x2  x1 
f x2 
http://numericalmethods.eng.usf.edu
Example 3
The failure rate ht  of a direct methanol fuel cell (DMFC) is given by
the formula

ht  
R' t
Rt 
Where Rt  is the reliability at a certain time t , and the values of the
reliability are given in Table 3.
Table 3 Reliability of DMFC system.
t hrs  0 1
Rt 
10
100
1000 2000 3000 4000 5000
1 0.9999 0.9998 0.9980 0.9802 0.9609 0.9419 0.9233 0.9050
Determine the value of the failure rate at t  50 hours using the second
order Lagrangian polynomial interpolation for reliability.
19
http://numericalmethods.eng.usf.edu
Example 3 Cont.
Solution
For second order Lagrangian polynomial interpolation, we choose the
reliability given by
 t  t1  t  t2 
 t  t0  t  t2 
 t  t0  t  t1 

 R(t0 )  


 R(t1 )  
 R(t2 )
R(t )  
 t0  t1  t0  t2 
 t1  t0  t1  t2 
 t2  t0  t2  t1 
Since we want to find the reliability at t  50 , and we are using a second
order Lagrangian polynomial, we need to choose the three points closest
to t  50 that also bracket t  50 to evaluate it.
The three points are t0  1 , t1  10 , and t2  100.
Differentiation the above equation gives.
2t  t0  t 2 
2t  t0  t1 
2t  t1  t 2 
R' t  
Rt0  
Rt1  
Rt 2 
t0  t1 t0  t2 
t1  t0 t1  t2 
t2  t0 t2  t1 
20
http://numericalmethods.eng.usf.edu
Example 3 Cont.
Hence
R' 50 
250  10  100
0.9999  250  1  100 0.9998  250  1  10 0.9980
1  101  100
10  110  100
100  1100  10
 1.9102 105
We must also find the value of R
t  at
t  50.
 50  10  50  100 
 50  1  50  100 
R50  

0.9999   

0.9998
1

10
1

100
10

1
10

100






 50  1  50  10 


0.9980
 100  1  100  10 
 0.99918
21
http://numericalmethods.eng.usf.edu
Example 3 Cont.
The failure rate is then
ht   
R' t 
Rt 

 1.9102 10 

5
0.99918
 1.9118 10 5
22
http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit
http://numericalmethods.eng.usf.edu/topics/discrete_02
dif.html
THE END
http://numericalmethods.eng.usf.edu