Num Chap 5 Edited
Num Chap 5 Edited
INTERPOLATION
Introduction
Suppose we are given the following values of y f (x) for a set of values of x as given
by the table below
x x0 x1 x2 ……….. xn
Y= y0 y1 y2 ….……. yn (1)
f(x)
Then the process of finding the value of y corresponding to any value of x between
be easily found. Conversely, if y f (x) is given with the help of tabulated data as in
(1) above, f (x ) is replaced by another function (x) which assumes the same values as
those of f (x ) at the tabulated set of points. Any other value may be calculated from
that y and p n (x ) agree at the tabulated points. For this let the values of x be equidistant
1
pn ( x) a0 a1 ( x x0 ) a2 ( x x0 )(x x1 ) a3 ( x x0 )(x x1 )(x x2 )
(2)
an ( x x0 )(x x1 )(x x2 ) . . . ( x xn 1 )
Where the constants ai , i 1, 2 , 3 ,, n are to be determines using the idea that y and
pn ( x2 ) y2 a0 a1 ( x2 x0 ) a2 ( x2 x0 )( x2 x1 )
y1 y0
y 2 y0 2h a2 2h.h
h
y2 2 y1 y0 2h 2 a2
y2 2 y1 y0
a2
2h 2
2 y0
a2
2h 2
Similarly on substituting x x3 , x4 , x5 , xn in (2), we get :
3 y 0 4 y 0 n y 0
a3 , a 4 , , a n
3!h 3 4!h 4 n!h n
Substituting these values of a0 , a1 , a2 , an in (2), we get :
y0 2 y0 3 y0
pn ( x) y0 ( x x0 ) ( x x0 )( x x1 ) ( x x0 )( x x1 )( x x2 )
h 2!h 2 3!h 3
n y0
( x x0 )( x x1 )( x x2 )( x xn 1 )
n!h n
(3)
Or, more specially, if it is required to evaluate p n (x ) for x x0 uh where u R ,
then from (3)
2
x x0 uh
x x1 x0 uh ( x0 h) uh h h(u 1)
x x2 x0 uh ( x0 2h) uh 2h hu 2
x xn 1 x0 uh ( x0 (n 1)h) uh (n 1)h h(u (n 1))
Therefore, (2) can be written as:
u u (u 1) 2 u (u 1)(u 2) 3
p n ( x) y 0 y 0 y0 y0
1! 2! 3!
u (u 1)(u 2) (u (n 1)) n ... (4)
y0
n!
x x0
where u
h
(4) is called Newton-Gregory forward interpolation formula or simply Newton’s
forward interpolation formula and it used for interpolating the values of y near the
beginning of a set of tabulated values.
pn ( x) a0 a1 ( x xn ) a2 ( x xn )( x xn 1 ) a3 ( x xn )( x xn 1 )( x xn 2 )
an ( x xn )( x xn 1 )( x xn 2 )( x x1 )
(5)
and then impose the condition that y & p n ( x ) should agree at the tabulated points
xn , xn 1 , xn 2 ,, x 2 , x1 , x0 we obtain
u u (u 1) 2 u (u 1)(u 2) 3
p n ( x) y n y n yn yn
1! 2! 3!
u (u 1)(u 2) (u (n 1)) n
y n … (6)
n!
x xn
where u
h
3
(6) is called Newton’s backward difference interpolation formula and it used for
interpolating the values of y near the end of a set of tabulated values.
Example: - From the following table estimate y when x 1.75 , x 1.85 and x 2.4 .
using Newton’s interpolation formula.
x 1.7 1.8 1.9 2.0 2.1 2.2 2.3
Solution: -
Forming the difference table first,
x y Dy D2y D3 y D4 y D5 y D6 y
1.7 5.474
0.576
1.8 6.05 0.06
0.636 0.007
1.9 6.686 0.067 0
0.703 0.007 0.001
2 7.389 0.074 0.001 -0.002
0.777 0.008 -0.001
2.1 8.166 0.082 0
0.859 0.008
2.2 9.025 0.09
0.949
2.4 9.974
x y Vy V 2y V3 y V4 y V5 y V6 y
x 1.75is near the beginning of the data, therefore we use Newton’s forward formula.
x x0
x0 1.7 , h 0.1 , u 0.5
h
u u (u 1) 2 u (u 1)(u 2) 3
y ( x) p6 ( x) y 0 y 0 y0 y0
1! 2! 3!
u (u 1)(u 2) (u 5) 6
y0
n!
y (1.75) 5.755006
x 1.85is very near the beginning of the data than near the end, therefore we use
Newton’s forward formula.
4
x x0
x0 1.8 , h 0.1 , u 0.5
h
u u (u 1) 2 u (u 1)(u 2) 3 u (u 1)(u 2)(u 3) 4
y ( x) p5 ( x) y 0 y 0 y0 y0 y0
1! 2! 3! 4!
u (u 1)(u 2) (u 4) 5
y0
n!
y (1.85) 6.359997
x 2.4 is very near the end of the data, therefore we use Newton’s backward formula.
x x6
x6 2.3 , h 0.1 , u 1
h
u u (u 1) 2 u (u 1)(u 2) 3
y ( x) p6 ( x) y n y n yn yn
1! 2! 3!
u (u 1)(u 2) (u 5) 6
yn
n!
y (2.4) 11.018021
Example: - From the following table, estimate the number of students who obtained
marks between 40 and 45.
Marks Number of students
30-40 31
40-50 42
50-60 51
60-70 35
70-80 31
We need to find y(45) that is equal to the number of students who got marks less than 45
and for this we use Newton’s forward difference formula(why?).
Forming the difference table first,
5
x y Dy D2y D3 y D4 y
40 31
42
50 73 9
51 -15
60 124 -16 37
35 12
70 159 -4
31
80 190
x x0
x 45 , x0 40 , h 10 , u 0.5
h
u u (u 1) 2 u (u 1)(u 2) 3 u (u 1)(u 2)(u 3) 4
y ( x) p 4 ( x) y 0 y 0 y0 y0 y0
1! 2! 3! 4!
y (45) 47.867 48
Since y (40) is 31, the number of students who scored between 40 and 45 is:
48 – 31 = 17
Exercise: -
1. The population of a certain city in the census was as under
6
Lagrange’s Interpolation Formula
Newton’s forward and backward interpolation formulas posses the disadvantage of being
applicable only to equally spaced values of the arguments. Lagrange’s Interpolation
Formula can be applied whether the values of xi are equally spaced or not.
where ai , i 1,2,3,..., n are coefficients whose values are to be determined here also
using the idea that y and p n (x ) should agree at tabulated points. Thus
pn ( x0 ) a0 ( x0 x1 )( x0 x2 )( x0 xn ) y0
y0
a0
( x0 x1 )( x0 x2 )( x0 xn )
pn ( x1 ) a1 ( x1 x0 )( x1 x2 )( x1 xn ) y1
y1
a1
( x1 x0 )( x1 x2 )( x1 xn )
Preceding in this way we get a n as
pn ( xn ) an ( xn x0 )( xn x1 )( xn xn 1 ) yn
yn
an
( xn x0 )( xn x1 )( xn xn 1 )
Substituting these values of ai ' s in (7)
7
( x x1 )( x x2 ) ( x xn ) ( x x0 )( x x2 ) ( x xn )
p n ( x) y0 y1
( x0 x1 )( x0 x2 ) ( x0 xn ) ( x1 x0 )( x1 x2 ) ( x1 xn )
( x x0 )( x x1 ) ( x xn1 )
yn (8)
( xn x0 )( xn x1 ) ( xn xn1 )
x 2 5 7 10 12
f (x ) 18 180 448 1210 2028
8
saved by using Newton’s Divided Difference Interpolation Formula. Before deriving,g
this formula, we shall first define an operator called The Divided Difference Operator.
x x0 x1 x2 x3 …………. xn
y=f(x) y0 y1 y2 y3 …………. yn
Then the first divided difference for the arguments x 0 and x1 is defined by the relation
y1 y 0
[ x 0 , x1 ]
x1 x 0
Similarly
y 2 y1 y y1 y y n 1
[ x1 , x 2 ] , [ x 2 , x3 ] 3 , . . . , [ x n 1 , x n ] n
x 2 x1 x3 x 2 x n x n 1
Then the second divided difference for the arguments x0 , x1 and x 2 is defined by the
relation
[ x1 , x 2 ] [ x0 , x1 ]
[ x0 , x1 , x 2 ] ,
x 2 x0
[ x 2 , x3 ] [ x1 , x 2 ] [ x3 , x 4 ] [ x 2 , x3 ]
Similarly , [ x1 , x 2 , x3 ] , [ x 2 , x3 , x 4 ] etc.
x3 x1 x4 x2
Then the third divided difference for the arguments x0 , x1 , x 2 and x3 is defined by the
relation
[ x1 , x2 , x3 ] [ x0 , x1 , x2 ]
[ x0 , x1 , x2 , x3 ]
x3 x0
[ x 2 , x3 , x 4 ] [ x1 , x 2 , x3 ]
Similarly , [ x1 , x 2 , x3 , x 4 ] ,
x 4 x1
[ x3 , x 4 , x5 ] [ x 2 , x3 , x 4 ]
[ x 2 , x3 , x 4 , x5 ] etc.
x5 x 2
and so on.
Remarks: -
The divided differences are symmetrical in their arguments i.e. independent of the order
of the arguments for it is easy to write
9
y0 y1
[ x0 , x1 ] [ x1 , x0 ]
x0 x1 x1 x0
y0 y1 y2
[ x0 , x1 , x 2 ]
( x0 x1 )( x0 x 2 ) ( x1 x0 )( x1 x 2 ) ( x 2 x0 )( x 2 x1 )
and so on.
Example: - Construct the forward difference table for the data below
x 5 7 11 13 17
y 150 392 1452 2366 5202
Solution: -
x y D[1] D[2] D[3] D[4]
5 150
121
7 392 24
265 1
11 1452 32 0
457 1
13 2366 42
709
17 5202
y y0
[ x , x0 ]
x x0
So that
y y 0 ( x x0 )[ x , x0 ] . . . (1)
[ x , x0 ] [ x0 , x1 ]
Again [ x , x0 , x1 ]
x x1
Which gives
[ x , x0 ] [ x0 , x1 ] ( x x1 )[ x , x0 , x1 ]
Substituting this value of [ x , x0 ] in (1), we get
y y 0 ( x x0 )[ x0 , x1 ] ( x x0 )( x x1 )[ x , x0 , x1 ] . . . (2)
[ x , x0 , x1 ] [ x0 , x1 , x 2 ]
Also [ x , x0 , x1 , x 2 ]
x x2
10
Which gives
[ x , x0 , x1 ] [ x0 , x1 , x2 ] ( x x2 )[ x , x0 , x1 , x2 ]
y p n ( x) y 0 ( x x 0 )[ x 0 , x1 ] ( x x 0 )( x x1 )[ x 0 , x1 , x 2 ] ( x x 0 )( x x1 )( x x 2 )[ x 0 , x1 , x 2 , x3 ]
. . . ( x x 0 )( x x1 ) . . . ( x x n 1 )[ x 0 , x1 , x 2 , . . . , x n ]
x 5 7 11 13 17
Y=f(x) 150 392 1452 2366 5202
y p n ( x) y 0 ( x x 0 )[ x 0 , x1 ] ( x x 0 )( x x1 )[ x 0 , x1 , x 2 ] ( x x 0 )( x x1 )( x x 2 )[ x 0 , x1 , x 2 , x3 ]
( x x 0 )( x x1 )( x x 2 )( x x3 )[ x 0 , x1 , x 2 , x3 , x 4 ]
y (9) 810
y (12) 1872
y (15) 3600
Exercise: -
1. Find the Divided Difference Polynomial that passes through the points (-4, 1245),
(-1, 33), (0, 5), (2, 9) and (5, 1335).
11
Answer : f x 3x 4 5 x 3 6 x 2 14 x 5
x 2 5 7 10 12
f (x ) 18 180 448 1210 2028
12