You are on page 1of 19

Numerical Differentiation

Let xj, j = 0,1,2,…,n be the equal spaced arguments with step length ‘h’.
Let f(xj) = fj, j = 0,1,2,…,n
df d 2 f
Aim : To find the approximate values of , ,... at a tabular point xi without
dx dx 2
finding the expression for f(x) or f(x) ≈ p(x) where p(x) is the interpolating polynomial
for the given data.
Derivatives in terms of forward differences :
We have ∆f ( x) = f ( x + h) − f ( x) … (1)
By Taylor series expansion, we have
h2
f ( x + h) = f ( x) + hf ′( x) + f ′′( x ) + ...
2!
d
If D ≡ , then
dx
h2 2
f ( x + h) = f ( x ) + hDf ( x) + D f ( x ) + ...
2!
 h2 D2 
= 1 + hD + + ...  f ( x)
 2! 
∴ f ( x + h) = e hD f ( x )

Now (1)  ( )
∆f ( x) = e hD f ( x ) − f ( x) = e hD − 1 f ( x)

∴ ∆ ≡ e hD − 1 or e hD = 1 + ∆
∆2 ∆3 ∆4
 hD ≡ log e (1 + ∆ ) ≡ ∆ − + − + ...
2 3 4
1 ∆ 2 ∆3 ∆ 4 
 D ≡ ∆ − + − + ... 
h 2 3 4 
If we want to find the derivative of f(x) at xi , then f ′( xi ) = Df ( x) x = x
i

1 ∆ 2 ∆3 ∆ 4 
i.e., f ′ ( xi ) =  ∆ − + − + ...  f ( xi )
h 2 3 4 
1 ∆ 2 ∆3 ∆ 4 
 Dfi =  ∆ − + − + ...  fi ... (2)
h 2 3 4 
∆ 2 ∆3 ∆ 4
 hD ≡ ∆ − + − + ...
2 3 4
2

2 2∆ 2 ∆3 ∆ 4 
∴ h D ≡ ∆ − + − + ... 
 2 3 4 
1 2  1 1
≡ ∆ 2 − ∆ 3 +  +  ∆ 4 +  − −  ∆5 + ...
4 3  2 3
1  2 11 5 
 D2 ≡ 2 
∆ − ∆ 3 + ∆ 4 − ∆5 + ... 
h  12 6 
1  11 5 
∴ D 2 f i = 2  ∆ 2 − ∆ 3 + ∆ 4 − ∆5 + ...  f i ... (3)
h  12 6 
Similarly higher order derivatives can be obtained at any tabular point xi.

hD h 2 D 2 h3 D 3
We have ∆≡e − 1 = hD + + + ...
2 6
2
2 h 2 D 2 h3 D 3  1 1
∆ ≡  hD + + + ...  = h 2 D 2 + h3 D3 +  +  h 4 D 4 + ...
 2 6   4 3
7
 ∆ 2 ≡ h 2 D 2 + h3 D3 + h 4 D 4 + ...
12
Similarly we can find
3
∆3 ≡ h3 D3 + h 4 D 4 + ...
2
4 4 4
∆ ≡ h D + ...
If we ignore the terms after the first term in (2), we get
1
Dfi ≈ ∆fi
h
The error associated with this formula is given by

1  ∆2 ∆3 ∆ 4 
 − + − + ...  fi
h 2 3 4 
1 1 2 2 1 
= 
h 2
( 3
) (
− h D + ... + h3 D 3 + ... + ... fi )

1 1
= − h 2 D 2 fi + ... = − hD 2 f i + ... = O( h)
2h 2
∴ By retaining only one term in the forward difference expansion of Dfi , we get the
1
approximation for Dfi as Dfi ≈ ∆fi with an error of O(h).
h
If we ignore the terms after the first two terms in (2), we get
1 ∆2 
Df i ≈  ∆ −  fi
h 2 

1  ∆3 ∆ 4 
with error =  − + ...  fi
h 3 4 
1 1 3 3 1 4 4 
= 
h 3
h( D + ) (
... −
4
)
h D + ... ... fi

1
= h 2 D3 f i + ... = O( h 2 )
3
∴ By retaining two terms in the forward difference expansion of Dfi , we get the
1 ∆2 
approximation for Dfi as Df i ≈  ∆ −  fi with an error of O(h2).
h 2 

Continuing in this manner, finally we get if m terms are retained in the forward
difference expansion of Dfi , we get the approximation for Dfi as
1 ∆ 2 ∆3 ∆ 4 m ∆ 
m
m
Df i ≈  ∆ − + − + ... + ( −1)  fi with an error O(h ).
h 2 3 4 m 
Approximations for the second derivative in terms of forward differences :
We have
1  2 11 5 
D 2 fi = 2 
∆ − ∆3 + ∆ 4 − ∆5 + ...  fi … (3)
h  12 6 
If we retain only the first term in the r.h.s. of the above equation, we get
1 2
D 2 fi ≈ ∆ fi
h2
1  3 11 4 5 5 
with error = 2 
−∆ + ∆ − ∆ + ...  fi
h  12 6 
1  11 4 4 
=
h2
( 3 3
) ( )
 − h D + ... + 12 h D + ... − ... f i
= − hD 3 fi + ... = O(h)
∴ By retaining only one term in the forward difference expansion of D2fi , we get the
1 2
approximation for D2fi as D 2 f i ≈ ∆ fi with an error of O(h).
h2
If we retain only the first two terms in the r.h.s. of the equation (3), we get
1 2
D 2 fi ≈
h
(
2
∆ − ∆3 fi )
1  11 4 5 5 
with error = 2 
∆ − ∆ + ...  fi
h  12 6 
1  11 4 4 5 
= 2 
h 12
( 6
) ( 
)
h D + ... − h5 D5 + ... + ... fi

11
= h 2 D 4 f i + ... = O(h 2 )
12
Continuing in this manner, finally we get if m terms are retained in the forward
difference expansion of D2fi , we get the approximation with O(hm).
Note : In general if we retain m terms in the forward difference expansion of
derivatives, we get an approximation with an error O(hm).
Derivatives in terms of backward differences :
We have ∇f ( x) = f ( x) − f ( x − h) … (1)
By Taylor series expansion, we have
h2 h3
f ( x − h) = f ( x ) − hf ′( x) + f ′′( x) − f ′′′( x )...
2! 3!
d
If D ≡ , then
dx
h2 2 h3 3
f ( x − h) = f ( x ) − hDf ( x) + D f ( x ) − D f ( x)...
2! 3!
 h 2 D 2 h3 D 3 
= 1 − hD + − ...  f ( x)
 2! 3! 
∴ f ( x − h) = e − hD f ( x )

Now (1)  ( )
∇f ( x ) = f ( x) − e − hD f ( x ) = 1 − e − hD f ( x )

∴ ∇ ≡ 1 − e − hD or e − hD = 1 − ∇
 ∇ 2 ∇3 ∇ 4 
 − hD ≡ log e (1 − ∇ ) ≡ −  ∇ + + + + ... 
 2 3 4 
1 ∇ 2 ∇3 ∇ 4 
 D ≡ ∇ + + + + ... 
h 2 3 4 

1 ∇ 2 ∇3 ∇ 4 
 Dfi =  ∇ + + + + ...  fi … (2)
h 2 3 4 
∇ 2 ∇3 ∇ 4
We have hD ≡ ∇ + + + + ... , then we have
2 3 4
11 4
h 2 D 2 ≡ ∇ 2 + ∇3 + ∇ + ...
12
3
h3 D3 ≡ ∇3 + ∇ 4 + ...
2
4 4 4
h D ≡ ∇ + ...
Also we have

− hD h 2 D 2 h3 D 3 h 4 D 4
∇ ≡1− e = hD − + − + ...
2 6 24
∇ 2 ≡ h 2 D 2 − h3 D3 + ...
∇3 ≡ h3 D3 + ...
∇ 4 ≡ h 4 D 4 + ...
If we retain only first term in the r.h.s. of the equation (2), we get
1
Df i ≈ ∇fi
h
1  ∇ 2 ∇3 ∇ 4 
with error =  + + + ...  fi
h 2 3 4 
1 1 2 2 1 3 3 
= 
h 2
h (
D − h 3 3
D + ... ) (
+
3
)
h D + ... + ... fi

1 2 2 1
= h D fi + ... = hD 2 fi + ... = O( h)
2h 2
If we retain only first two terms in the r.h.s. of the equation (2), we get
1 ∇2 
Df i ≈  ∇ +  fi
h 2 

1  ∇3 ∇ 4 
with an error =  + + ...  fi
h 3 4 
1 1 3 3 1 
= 
h 3
( ) 4
( )
h D + ... + h 4 D 4 + ... + ... fi

1
= h 2 D3 fi + ... = O(h 2 )
3
Continuing in this manner, finally we get if m terms are retained in the backward
difference expansion of Dfi , we get the approximation for Dfi as
1 ∇ 2 ∇3 ∇m  m
Dfi =  ∇ + + + ... +  f i with an error O(h ).
h 2 3 m 
Approximations for the second derivative in terms of backward differences :
We have seen that
11 4
h 2 D 2 ≡ ∇ 2 + ∇3 + ∇ + ...
12
1  2 11 
 D 2 fi ≡ 2 
∇ + ∇3 + ∇ 4 + ...  f i … (3)
h  12 
Proceeding as in the case of approximations for the first derivative in terms of
backward differences, if m terms are retained in the backward difference expansion of
D2fi in (3), we get the approximation for D2fi with an error O(hm).

Note : In general if we retain m terms in the backward difference expansion of


derivatives, we get an approximation with an error O(hm).
Derivatives in terms of central differences :
Define the shift operator E such that
Ekf(x) = f(x+kh) where k need not be an integer.
We have seen already
 h  h
δ f ( x) = f  x +  − f  x − 
 2 
2  
1  h  h 
µ f ( x) =  f  x +  + f  x − 
2  2  2 
Now consider
δ f ( x) = E1/ 2 f ( x) − E −1/2 f ( x) = ( E1/ 2 − E −1/ 2 ) f ( x)
 δ ≡ E1/ 2 − E −1/ 2 ... (1)
1 1
µ f ( x ) =  E1/2 f ( x) + E −1/ 2 f ( x)  = ( E1/ 2 + E −1/ 2 ) f ( x )
2 2
1
 (
µ ≡ E1/ 2 + E −1/ 2
2
)
 2µ ≡ E1/ 2 + E −1/ 2 ... (2)
Consider
2 2
(
4 µ 2 − δ 2 ≡ E1/2 + E −1/ 2 ) − (E 1/ 2
− E −1/ 2 ) = 4 E1/ 2 E −1/ 2 = 4
1 δ2
 2 2
µ ≡ 4 + δ ≡ 1+
4
( 4
) ... (3)

1 1/2 1
Consider µδ ≡
2
(
E + E −1/ 2 )( E 1/ 2
− E −1/2 = ) 2
(E − E −1 ) ... (4)

d
We have Ef(x) = f(x+h) = ehD f(x) where D ≡
dx
∴ E ≡ e hD … (5)
Substituting (5) in (4), we get
e hD − e − hD
µδ ≡ = sinh ( hD ) ... (6)
2
h3 D 3 h5 D 5
 µδ ≡ hD + + + ... ... (7)
3! 5!
2
δ 2 ≡ ( E1/ 2 − E −1/2 ) ≡ E + E −1 − 2 ≡ ehD + e− hD − 2
h 4 D 4 h6 D 6
 2
δ ≡h D + 2 2
+ + ... ... (8)
12 360
Using (7) and (8), we get
 h3 D 3 h5 D 5  h 4 D 4 h6 D 6 
µδ 3 = ( µδ )(δ 2 ) =  hD + + + ...   h 2 D 2 + + + ... 
 6 120  12 360 
 1 1
= h3 D 3 +  +  h5 D 5 + ...
 12 6 
1
 µδ 3 = h3 D3 + h5 D 5 + ...
4
2
2 2  h 4 D 4 h6 D 6  h6 D 6
δ = (δ
4
) =  h2 D 2 + + + ...  = h 4 D 4 + + ...
 12 360  6
µδ 5 = h5 D5 + ...
δ 6 = h6 D 6 + ...
x3 3 5
By Maclaurin series expansion, we have sinh −1 x = x − + x + ...
6 40
∴ From (6), we have
1 3
hD = sinh −1 ( µδ ) = µδ − µ 3δ 3 + µ 5δ 5 − ...
6 40
1 3 2
= µδ − µµ 2δ 3 + µ µ 2 δ 5 − ...
6 40
( )
2
1  δ2  3 3  δ2  5
= µδ − µ 1 +  δ + µ 1 +  δ − ... (by using (3) )
6  4  40  4 
1  δ2  3 3  δ4 δ2  5
= µδ − µ 1 +  δ + µ 1 + +  δ − ...
6  4  40  16 2 
1  1 3 
= µδ − µδ 3 +  − +  µδ 5 + ...
6  24 40 
1 1
 hD = µδ − µδ 3 + µδ 5 + ... ... (9)
6 30
 1 1 
or hD = µ  δ − δ 3 + δ 5 + ... 
 6 30 
  δ   2 1 4 17 6
2 2
 1 1 
∴ h 2 D 2 = µ 2  δ − δ 3 + δ 5 + ...  = 1 + δ − δ + δ + ... 
 6 30   4  3 180 
1 1
 h 2 D 2 = δ 2 − δ 4 + δ 6 + ... ... (10)
12 90
Approximations for the first derivative in terms of central differences :
We have seen that
1 1
hD = µδ − µδ 3 + µδ 5 + ...
6 30
1 1 1 
D =  µδ − µδ 3 + µδ 5 + ... 
h 6 30 
1 1 1 
Dfi =  µδ − µδ 3 + µδ 5 + ...  fi ... (11)
h 6 30 
If we retain only the first term on the r.h.s. of the above equation, we have
1
Df i ≈ µδ fi
h
1 1 3  1 3 3 2
with error =  − µδ f i + ...  = − h D f i + ... = O( h )
h 6  6h
If we retain only the first two terms on the r.h.s. of the equation (11), we have
1 1 
Df i ≈  µδ f i − µδ 3 f i 
h 6 
1 1 5  1 1 5 5  4
with error =  µδ f i + ...  =  h D fi + ...  =O(h )
h  30  h  30 
Proceeding in this manner, finally we get that in general if we retain m terms in the
central difference expansion of first order derivative, we get an approximation with an
error O(h2m).
Approximations for the second derivative in terms of central differences :
We have seen that
1 4 1 6
h2 D 2 = δ 2 − δ + δ + ...
12 90
1  2 1 4 1 6
D2 = 2 
δ − δ + δ + ... 
h  12 90 
1  1 1 
D 2 fi = 2  δ 2 − δ 4 + δ 6 + ...  f i … (12 )
h  12 90 
If we retain only the first term on the r.h.s. of the above equation, we have
1 2
D 2 fi ≈ δ fi
h2
with error
1  1 4  1  1 4 4  1 2 4 2
=  − δ f i + ...  = 2  − (h D f i + ...) + ...  = − h D fi + ... = O(h )
h 2  12  h  12  12
If we retain only the first two terms on the r.h.s. of the equation (12), we have
1  2
δ fi − δ 4 f i 
1
D 2 fi ≈ 2 
h  12 
1  1 6
δ fi + ...  = 2  (h6 D 6 fi + ... )+...  = O( h 4 )
1 1
with error = 2 
h  90  h  90 
Proceeding in this manner, finally we get that in general if we retain m terms in the
central difference expansion of second order derivative, we get an approximation with
an error O(h2m).

Note : In general if we retain m terms in the central difference expansion of


derivatives, we get an approximation with an error O(h2m).
dy d2y
Ex : Find and at x = 1.1 and x = 1.6 using the following table of values.
dx dx 2
x 1.0 1.1 1.2 1.3 1.4 1.5 1.6
y(x) 7.989 8.403 8.781 9.129 9.451 9.750 10.031
Solution:
x y(x) 1st order differences 2nd order differences 3rd order differences
1.0 (x0) 7.989
∆y0 = ∇y1 = 0.414
1.1 (x1) 8.403 ∆ 2 y0 = ∇ 2 y2 = −0.036
∆y1 = ∇y2 = 0.378 ∆3 y0 = ∇3 y3 = 0.006
1.2 (x2) 8.781
∆ 2 y1 = ∇ 2 y3 = −0.030
∆y2 = ∇y3 = 0.348 ∆3 y1 = ∇3 y4 = 0.004
1.3 (x3) 9.129
∆ 2 y2 = ∇ 2 y4 = −0.026
∆y3 = ∇y4 = 0.322 ∆3 y2 = ∇3 y5 = 0.003
1.4 (x4) 9.451
∆y4 = ∇y5 = 0.299 ∆ 2 y3 = ∇ 2 y5 = −0.023
1.5 (x5) 9.750 ∆3 y3 = ∇3 y6 = 0.005
∆y5 = ∇y6 = 0.281 ∆ 2 y4 = ∇ 2 y6 = −0.018
1.6 (x6) 10.031
4th order differences 5th order differences 6th order differences
∆ 4 y0 = ∇ 4 y4 = −0.002
∆5 y0 = ∇5 y5 = 0.001
∆ 4 y = ∇ 4 y = −0.001 ∆ 6 y0 = ∇ 6 y6 = 0.002
1 5
∆5 y1 = ∇5 y6 = 0.003
∆ 4 y2 = ∇ 4 y6 = 0.002
Here h = 0.1 and we have
 dy  1 1 1 1 1 1 
  =  ∆yi − ∆ 2 yi + ∆3 yi − ∆ 4 yi + ∆ 5 yi − ∆ 6 yi + ...
 dx  x = xi h  2 3 4 5 6 

 dy  1 1 1 1 1 1 
  = ∇yi + ∇ 2 yi + ∇3 yi + ∇ 4 yi + ∇5 yi + ∇6 yi + ...
 dx  x = xi h  2 3 4 5 6 

 d2y  1  2 3 11 4 5 5 137 6 
 2 = 2  ∆ yi − ∆ yi + 12 ∆ yi − 6 ∆ yi + 180 ∆ yi + ...
 dx  x = xi h

 d2y  1  2 3 11 4 5 5 137 6 
 2 = 2  ∇ yi + ∇ yi + ∇ yi + ∇ yi + ∇ yi + ...
 dx  x = xi h 12 6 180 
In the given data, x1 = 1.1 and x6 = 1.6
 dy  1 1 1 1 1 
  ≈  ∆y1 − ∆ 2 y1 + ∆3 y1 − ∆ 4 y1 + ∆5 y1  = ... = 3.9518
 dx  x = x1 h  2 3 4 5 

 dy  1 1 1 1 1 1 
  ≈ ∇y6 + ∇ 2 y6 + ∇3 y6 + ∇ 4 y6 + ∇5 y6 + ∇6 y6  = ... = 2.751
 dx  x = x6 h  2 3 4 5 6 

 d2y  1  2 3 11 4 5 5 
 2 ≈ 2  ∆ y1 − ∆ y1 + ∆ y1 − ∆ y1  = ... = -3.7416
 dx  x = x1 h 12 6 

 d2y  1  2 3 11 4 5 5 137 6 
 2 ≈ 2  ∇ y 6 + ∇ y6 + ∇ y 6 + ∇ y6 + ∇ y6  = ... = -0.7144
 dx  x = x6 h 12 6 180 
Ex : If x represents the speed of the vehicle, then find the velocity and acceleration of
the vehicle at time t = 0.1, 0.3, 0.5 for the following data.
t (in sec.) 0 0.1 0.2 0.3 0.4 0.5 0.6
x (in meters) 30.13 31.62 32.87 33.64 33.95 33.81 33.24
Solution :
t x 1st order differences 2nd order differences
0 (t0) 30.13
∆x0 = ∇x1 = δ x1/ 2 = 1.49
0.1 (t1) 31.62 ∆ 2 x0 = ∇ 2 x2 = δ 2 x1 = −0.24
∆x1 = ∇x2 = δ x3/ 2 = 1.25
0.2 (t2) 32.87 ∆ 2 x1 = ∇ 2 x3 = δ 2 x2 = −0.48
∆x2 = ∇x3 = δ x5/ 2 = 0.77
0.3 (t3) 33.64
∆ 2 x2 = ∇ 2 x4 = δ 2 x3 = −0.46
∆x3 = ∇x4 = δ x7/ 2 = 0.31
0.4 (t4) 33.95 ∆ 2 x3 = ∇ 2 x5 = δ 2 x4 = −0.45
∆x4 = ∇x5 = δ x9/2 = −0.14
0.5 (t5) 33.81
∆ 2 x4 = ∇ 2 x6 = δ 2 x5 = −0.43
∆x5 = ∇x6 = δ x11/ 2 = −0.57
0.6 (t6) 33.24
3rd order differences 4th order differences
∆ 3 x0 = ∇3 x3 = δ 3 x3/2 = −0.24
∆ 4 x0 = ∇ 4 x4 = δ 4 x2 = 0.26
∆3 x1 = ∇3 x4 = δ 3 x5/ 2 = 0.02
∆ 4 x1 = ∇ 4 x5 = δ 4 x3 = −0.01
∆ 3 x2 = ∇3 x5 = δ 3 x7/ 2 = 0.01
∆ 4 x2 = ∇ 4 x6 = δ 4 x4 = 0.01
∆ 3 x3 = ∇3 x6 = δ 3 x9/2 = 0.02

5th order differences 6th order differences


∆5 x0 = ∇5 x5 = δ 5 x5/ 2 = −0.27
∆ 6 x0 = ∇ 6 x6 = δ 6 x3 = 0.29
∆ 5 x1 = ∇5 x6 = δ 5 x7/2 = 0.02
If x is the speed of the vehicle and t is the time, then velocity and acceleration are
dx d2x
given by and 2 respectively.
dt dt

Here h = 0.1 and we have


 dx  1 1 2 1 3 1 4 1 5 1 6 
  =  ∆xi − ∆ xi + ∆ xi − ∆ xi + ∆ xi − ∆ xi + ...
 dt t =ti h  2 3 4 5 6 

 dx  1 1 2 1 3 1 4 1 5 1 6 
  = ∇xi + ∇ xi + ∇ xi + ∇ xi + ∇ xi + ∇ xi + ...
 dt t =ti h  2 3 4 5 6 

 dx  1 1 3 1 5 
  =  µδ xi − µδ xi + µδ xi + ...
 dt t =ti h  6 30 
1  δ xi +1/ 2 + δ xi −1/ 2 1  δ 3 xi +1/2 + δ 3 xi −1/ 2  1  δ 5 xi +1/ 2 + δ 5 xi −1/2  
=  −  +   + ...
h  2 6 2  30  2  
 d2x  1  2 3 11 4 5 5 137 6 
 2  = 2  ∆ xi − ∆ xi + ∆ xi − ∆ xi + ∆ xi + ...
 dt t =ti h 12 6 180

 d2x  1  2 3 11 4 5 5 137 6 
 2  = 2 ∇ xi + ∇ xi + 12 ∇ xi + 6 ∇ xi + 180 ∇ xi + ...
 dt t =t h
i

 d2x  1  2 1 4 1 6 
 2  = 2 δ xi − 12 δ xi + 90 δ xi + ...
 dt t =t h
i

In the given data, t1 = 0.1, t3 = 0.3 and t5 = 0.5


 dx  1 1 2 1 3 1 4 1 5 
  ≈  ∆x1 − ∆ x1 + ∆ x1 − ∆ x1 + ∆ x1  = ... =
 dt t =t1 h  2 3 4 5 

 dx  1  δ x7/ 2 + δ x5/ 2 1  δ 3 x7/2 + δ 3 x5/ 2  1  δ 5 x7/ 2 + δ 5 x5/2  


  ≈  −  +    = ... =
 dt t =t3 h  2 6 2  30  2  

 dx  1 1 2 1 3 1 4 1 5 
  ≈ ∇x5 + ∇ x5 + ∇ x5 + ∇ x5 + ∇ x5  = ... =
 dt t =t5 h  2 3 4 5 

 d2x  1  2 3 11 4 5 5 
 2  ≈ 2  ∆ x1 − ∆ x1 + 12 ∆ x1 − 6 ∆ x1  = ... =
 dt t =t h
1

 d2x  1  2 1 4 1 6 
 2  ≈ 2 δ x3 − δ x3 + δ x3  = ... =
 dt t =t3 h  12 90 
 d2x  1  2 3 11 4 5 5 
 2  ≈ 2  ∇ x5 + ∇ x5 + ∇ x5 + ∇ x5  = ... =
 dt t =t5 h 12 6 

To get the derivatives at a point which is not tabulated :


Let xs be a point which is not a tabulated point.
Let xj, j = 0,1,2,…,n be the given arguments.
Let fj = f(xj), j = 0,1,2,…,n
With the given data, find the interpolating polynomial p(x). Then differentiate the
df dp
interpolating polynomial w.r.t’x’, we get ≈ . Evaluate this at the given point xs.
dx dx
Here the arguments need not be equally spaced.
Ex : Find f ′(10) from the following data.
x 3 5 11 27 34
f(x) -13 23 899 17315 35606
Solution :
In the given data, the arguments x = 3,5,11,27,34 are not equally spaced.
To find the interpolating polynomial, we have to use either Newton’s divided
differences interpolation formula or Lagrange’s interpolation formula.
Let us the Newton’s divided differences interpolation formula.
x f(x) 1st order divided difference 2nd order divided difference
3 (x0) -13
f1 − f 0
f [ x0 , x1 ] = = 18
x1 − x0 f [ x1 , x2 ] − f [ x0 , x1 ]
5 (x1) 23 f [ x0 , x1 , x2 ] = = 16
f − f1 x2 − x0
f [ x1 , x2 ] = 2 = 146
x2 − x1
11 (x2) 899 f [ x2 , x3 ] − f [ x1 , x2 ]
f [ x1 , x2 , x3 ] = = 40
f3 − f 2 x3 − x1
f [ x2 , x3 ] = = 1026
x3 − x2
27 (x3) 17315 f [ x3 , x4 ] − f [ x2 , x3 ]
f [ x2 , x3 , x4 ] = = 69
f 4 − f3 x4 − x2
f [ x3 , x4 ] = = 2613
x4 − x3
34 (x4) 35606
3rd order divided difference
f [ x1 , x2 , x3 ] − f [ x0 , x1 , x2 ]
f [ x0 , x1 , x2 , x3 ] = =1
x3 − x0

f [ x2 , x3 , x4 ] − f [ x1 , x2 , x3 ]
f [ x1 , x2 , x3 , x4 ] = =1
x4 − x1
Given arguments are 5 and 4th order divided differences are zero.
∴ The interpolating polynomial is an exact polynomial.
The interpolating polynomial is given by
f ( x) = f 0 + ( x − x0 ) f [ x0 , x1 ] + ( x − x0 ) ( x − x1 ) f [ x0 , x1 , x2 ]
+ ( x − x0 )( x − x1 )( x − x2 ) f [ x0 , x1 , x2 , x3 ]

( )
=f 0 + ( x − x0 ) f [ x0 , x1 ] + x 2 − ( x0 + x1 ) x + x0 x1 f [ x0 , x1 , x2 ]

( )
+ x 3 − ( x0 + x1 + x2 ) x 2 + ( x0 x1 + x0 x2 + x1 x2 ) x − x0 x1 x2 f [ x0 , x1 , x2 , x3 ]

f ′( x)=f [ x0 , x1 ] + ( 2 x − ( x0 + x1 ) ) f [ x0 , x1 , x2 ]

( )
+ 3 x 2 − 2 ( x0 + x1 + x2 ) x + ( x0 x1 + x0 x2 + x1 x2 ) f [ x0 , x1 , x2 , x3 ]

Substituting the required values and x = 10, we get


f ′(10) = 233
If the given arguments xj, j = 0,1,2,…,n are equally spaced with step length ‘h’, then
we may proceed in the following manner.
Let xs be a point which is not tabulated.
x − xi
Let s = where x = xs
h
If xs is a point nearer to starting point x0, then we use forward differences interpolating
polynomial
∆ 2 f0 ∆3 f0
f ( x) ≈ p ( x) = f 0 + s∆f 0 + s ( s − 1) +s ( s − 1)( s − 2 ) + ...
2! 3!
∆ n f0
+s ( s − 1)( s − 2 ) ...( s − (n − 1) )
n!
If xs is a point nearer to ending point xn, then we use backward differences
interpolating polynomial
∇2 fn ∇3 f n
f ( x) ≈ p ( x) = f n + s∇f n + s ( s + 1) +s ( s + 1)( s + 2 ) + ...
2! 3!
∇n fn
+s ( s + 1)( s + 2 ) ...( s + ( n − 1) )
n!
If xs is a point nearer to middle point of the given argumnts, then we use Sterling’s
formula

δ 2 f0 δ 3 f1/ 2
f ( x) ≈ p ( x)=f 0 + sδ f1/2 + s ( s − 1)
2!
(
+ s s −12
) 3!
4
δ f0
( )
+s s 2 − 1 ( s − 2 )
4!
+ ...

In all the above cases, we have


dp ds ds 1
f ′( x ) ≈ p ′( x ) = where =
ds dx dx h
1 dp 1 dp
∴ f ′( x ) ≈ p ′( x ) =  f ′( xs ) ≈ p ′( xs ) =
h ds h ds s
Ex : From the following table of values, find f ′(3.5)
x 3 4 5 6 7 8
f(x) 0.204 0.240 0.259 0.262 0.250 0.224
Solution :
x y=f(x) 1st 2nd 3rd
3 0.204
0.036
4 0.240 -0.017
0.019 0.001
5 0.259 -0.016
0.003 0.001
6 0.262 -0.015
-0.012 0.001
7 0.250 -0.014
-0.026
8 0.224
∆ 2 f0 ∆3 f 0
f ( x) = p ( x) = f 0 + s∆f 0 + s ( s − 1) +s ( s − 1)( s − 2 )
2! 3!
1 dp 1  ∆ 2 f0 ∆3 f0 
f ′( x ) = p′( x) = =  ∆f 0 + ( 2 s − 1)
h ds h  2!
2
(
+ 3s − 6 s + 2
3! 
 )
3.5 − 3
Here h = 1 and s = = 0.5
1
Substituting these values of h and s, we get f ′(3.5).
(Exercise)

You might also like