You are on page 1of 7

Numerical Differentiation

Numerical differentiation is the process of computing the value of the derivative


of an explicitly unknown function, with given discrete set of points (xi, yi),
i=0,1,2,3,….,n. To differentiate a function numerically, we first determine an
interpolating polynomial and then compute the approximate derivative at the given
point. If x’s are equispaced:
1. Newton's forward interpolation formula is used to find the derivative near the
beginning of the table.
2. Newton's backward interpolation formula is used to compute the derivation near
the end of the table.
3. Stirling’s formula is used to estimate the derivative near the centre of the table.

1. Derivatives Using Newton’s Forward Interpolation Formula:


Newton’s forward interpolation formula for the function y=f(x) is given by:
p( p  1) 2 p( p  1)( p  2) 3 p( p  1)( p  2)( p  3) 4
y  yo  pyo   yo   yo   yo  ....
2! 3! 4!
(1)
x  xo
p differentiating (1) with respect to p
h
dy 2 p 1 2 3 p2  6 p  2 3 4 p 3  18 p 2  22 p  6 4
 yo   yo   yo   yo  .... (2)
dp 2! 3! 4!
dp 1 dy dy dp
Also  …(3) again  …..(4) using (2) and (3) in (4). We get
dx h dx dp dx

dy 1  2 p 1 2 3 p2  6 p  2 3 4 p 3  18 p 2  22 p  6 4 
 yo   yo   yo   yo  ....
dx h  2! 3! 4! 
Now at x = xo , p=0
dy  1 2 yo 3 yo 4 yo 
     
dx  x x h  
y o ...
o
2 3 4 

-1-
2. Derivatives Using Newton’s Backward Interpolation Formula:
Newton’s backward interpolation formula for the function y = f(x) is given by:
p( p  1) 2 p( p  1)( p  2) 3 p( p  1)( p  2)( p  3) 4
y  yn  pyn   yn   yn   yn  ....
2! 3! 4!
(1)
x  xn
p differentiating (1) with respect to p
h
dy 2p 1 2 3 p2  6 p  2 3 4 p 3  18 p 2  22 p  6 4
 yn   yn   yn   yn  .... (2)
dp 2! 3! 4!
dp 1 dy dy dp
Also  …(3) again  …..(4) using (2) and (3) in (4). We
dx h dx dp dx
get:
dy 1  2p 1 2 3 p2  6 p  2 3 4 p 3  18 p 2  22 p  6 4 
 yn   yn   yn   yn  ....
dx h  2! 3! 4! 
Now at x = xn , p=0
dy  1  2 yn  3 yn  4 yn 
 y     ...
dx  x x h 
n
n
2 3 4 
Example (1): Given a cubic polynomial with following data points. Find y' at x =0,
x 0 1 2 3
f(x) 5 6 3 8
Derivative has to be evaluated near the starting of the table, thereby constructing
forward difference table for the function y=f(x),
x y ∆ ∆2 ∆3
0 5
1
1 6 -4
-3 12
2 3 8
5
3 8
To find the derivative at x = 0, taking xo=0 and applying the relation: dy/dx(x=xo)
From table h=1, ∆yo=1, ∆2yo=-4, ∆3yo=12, ∆4yo=0, substituting these values in (1), we
get:

-2-
dy  1 2 yo 3 yo 4 yo 
  yo     ...
dx  x x h 
o
2 3 4 
dy  1  (4) 12 
  1   0  7
dx  x0 1  2 3 
Example (2): Given a polynomial with following data points. Find y' at x =1.1, x=1.5
x 1.0 1.1 1.2 1.3 1.4 1.5 1.6
f(x) 7.989 8.403 8.781 9.129 9.451 9.750 10.031
Derivatives has to be evaluated near the starting as well as towards the end of the
table, thereby constructing difference table for the function y=f(x),
x y ∆ ∆2 ∆3 ∆4 ∆5 ∆6
1.0 7.989
0.414
1.1 8.403 -0.036
0.378 0.006
1.2 8.781 -0.030
0.348 -0.002
1.3 9.129 0.004 0.001
-0.026 -0.001 0.002
0.322 0.003
1.4 9.451 -0.023 0.003
0.299 0.002
1.5 9.750 0.005
-0.018
0.281
1.6 10.031
To find derivative at x=1.1, taking xo=1.1 and applying the relation:
From table h=0.1, ∆yo=0.378, ∆2yo=-0.03, ∆3yo=0.004, ∆4yo=-0.001, ∆5yo=0.003,
substituting these values in (1), we get:
dy  1  (0.03) 0.004 (0.001) 0.003 
 0.378      3.952
dx  x1.1 0.1  2 3 4 5 
To find the derivative at x=1.5, taking xn=1.5 and applying the relation:
From table h=0.1, ∆yn=0.299, ∆2yn=-0.023, ∆3yn=0.003, ∆4yn=-0.001, ∆5yn=0.001,
substituting these values in general equation.
dy  1  (0.023) 0.003 (0.001) 0.001
 0.299      2.8845
dx  x1.5 0.1  2 3 4 5 

-3-
3. Derivatives Using Stirling’s Interpolation Formula
Stirling’s central difference interpolation formula (taking xo as the middle value
of the table) is given by:

 yo  y1  p 2 p( p 2  1)  3 y1  3 y2  p 2 ( p 2  1) 4


   
2
y  yo  p    2!  y1     y2  ....
 2 3!  2  4 !
(1)
x  xo
p differentiating (1) with respect to p
h
dy  yo  y1  (3 p 2  1)  3 y1  3 y2  (4 p 3  2 p) 4

dp 

  p  y1 
2
   
 y2  ....
2 3!  2  4!
(2)
dp 1 dy dy dp
Also  …(3) again  …..(4) using (2) and (3) in (4). We get
dx h dx dp dx

dy 1  yo  y1 
    p 2
y 1       y2   ...
(3 p 2  1)  3 y1  3 y2  (4 p 3  2 p) 4
dx h  2  3!  2  4! 

Now at x = xo , p=0

dy  1  yo  y1  1  3 y1  3 y2  1  5 y2  5 y3  


    
   
 30  
  ...
dx  x x h 
o
2  6 2   2  

Example (3): a slider in a machine moves along a fixed straight rod. Its distance x cm
along the rod is given below for various values of the time. Find the velocity of the
slider when t = 0.3 seconds.
t (second) 0 0.1 0.2 0.3 0.4 0.5 0.6
x (cm) 30.13 31.62 32.62 33.64 33.95 33.81 33.24

Sol.: derivative has to be evaluated towards the center of the table, thereby
constructing central difference table for the function x = f(t). also n xo , n = 1, 2, 3,
4, 5, 6 lie along the dotted line as shown.

-4-
t x ∆ ∆2 ∆3 ∆4 ∆5 ∆6
0.0 30.13
1.49
0.1 31.62 -0.24
1.25 -0.24
0.2 32.87 -0.48
0.77 0.002
0.3 33.64 0.02 -0.27
-0.46 -0.01 0.29
0.31 0.01
0.4 33.95 -0.45 0.02
-0.14 0.01
0.5 33.81 0.02
-0.43
-0.57
0.6 33.24

to find derivative at t = 0.3, taking to= 0.3 and applying the relation:

dx  1  xo  x1  1  3 x1  3 x2  1  5 x2  5 x3  


    
   
 30  
  ...
dt  t t h 
o
2  6 2   2  
From table h=0.1, ∆xo=0.31, ∆x-1=0.77, ∆3x-1=0.01, ∆3x-2=0.02, ∆3x-2=0.02, ∆5x-
2=0.02, ∆5x-3 = -0.27 all the positions have been shown, enclosed in boxes.
Substituting these values in (1), we get:
dx  1  0.31  0.77  1  0.01  0.02  1  0.02  0.27  
          ...  5.33 cm/sec.
dt  t 0.3 0.1  2  6  2  30  2  

Applied Example:
When a fluid flow over a surface, the heat transfer rate q (W) to the surface is given
dT 
by the expression: q  kA
dy  surface
the values of the temperature of an air stream

following above a surface are given below:


Distance normal to the 0.0 0.001 0.002 0.003 0.004
surface y (m)
Temperature T (K) 750 283.33 105.56 50 2.55
At the average temperature, k=0.03 W/m.K. calculate the values of the heat transfer
rate at the surface to a flat plate 10 cm long and 5 cm.
Sol.

-5-
y (m) T(K) ∆T ∆2T ∆3T ∆4T
0 750
-466.67
0.001 283.33 288.9
-177.77 -166.69
0.002 105.56 122.21 52.59
-55.56 -114.1
0.003 50 8.11
-47.45
0.004 2.55
dT  1  288.9 166.69 52.59 
    466.67     679830.833 K/m
dy  0.001  2 3 4 

dT 
 kA   0.03  50  10 4 (679830.833)  101.975 W
dy 

Exercices:
1) A vehicle start from rest and its velocity is measured every second for 4 sec., with
values as follows, find the acceleration at t=4.
Time t (sec.) 0 1 2 3 4
Velocity v (m/s) 0 0.4 1 1.7 2.9

2) For the set of points (0, 2), (2, -2), (3, -1), evaluate the slope at the middle point?

3) Air of viscosity μ =0.00024 N.sec/m2 flow between two parallel plates space
0.0244 m a part, the bottom plate being stationary while the top one moving with
constant velocity. The velocity distributions in laminar flow is measured at several
normal distance away from the bottom plate are given below, use Newton's viscosity
u
law to determine the shear stress τ (N/m2) at the surface of top plate:   
dy
u (m/sec.) 0 0.374 0.563 0.887 1.278
y (m) 0 0.0061 0.0122 0.0183 0.0244

-6-
4) Use the following data to find the velocity at t = 10 seconds:
Time t (s) 0 2 4 6 8 10 12 14 16
Position x (m) 0 0.7 1.8 3.4 5.1 6.3 7.3 8.0 8.4

5) The falling parachutist problem, the velocity is given by: v 


gm
1  e c / m t 
c
Given g = 9.81, m = 70, and c = 12, (a) find the acceleration at t=10 s. (b)
Analytically find the acceleration at t=10.

6) You have to measure the flow rate of water through a small pipe. In order to do it,
you place a bucket at the pipe’s outlet and measure the volume in the bucket as a
function of time as tabulated below. Estimate the flow rate at t = 5 s.
Time t (sec.) 0 1 5 8
Volume V (cm3) 0 1 8 16.4

7) The heat flux q is the quantity of heat flowing through a unit area of a material per
dT
unit time. It can be computed with Fourier’s law, J  k where J has units of
dx
W/m2 and k is a coefficient of thermal conductivity that parameterizes the heat-
conducting properties of the material and has units of W/(°C.m). T = temperature
(°C); and x = distance (m) along the path of heat flow.
x (m) 0 0.08 0.16 0.24
T (°C) 20 17 15 13
If the flux at x = 0 is 60 W/m2, compute k.

-7-

You might also like