Interpolation PDF
Interpolation PDF
O Iterative method
O Objective type of questions
7.1 Introduction
Suppose we are given the following values of y f(x) for a set of values
of x:
x: x0 x1 x2 xn
y: Y0 y1 y y.
2 n
y( x) a0 a1 ( x – x0 ) a2 ( x – x0 )( x – x1 ) a3 ( x – x0 )( x – x1 )( x – x2 )
an ( x – x0 )( x – x1 )( x – xn–1 ) (1)
Putting x x0, x1, , xn successively in (1), we get
y0 a0 , y1 a0 a1 ( x1 – x0 ), y2 a0 a1 ( x2 – x0 ) a2 ( x2 – x0 )( x2 – x1 )
and so on.
From these, we find that a0 y0 , y0 y1 – y0 a1 ( x1 – x0 ) a1 h
1
a1 y0
h
Also y1 y2 y1 a1 ( x2 x1 ) a2 ( x2 x0 )( x2 x1 )
a1 h a2 hh y0 2h2 a2
1
a2 2
y1 y0 1 2 2 y0
2h 2! h
1
Similarly a3 3 y0 and so on.
3! h3
Substituting these values in (1), we obtain
y0 2 y0 3 y0
y( x) y0 ( x x0 ) ( x x0 )( x x1 ) ( x x0 )( x x1 )( x x2 )
h 2! h2 3! h3
(2)
Now if it is required to evaluate y for x x0 ph, then
( x x0) ph, x x1 x x0 ( x x0) ph h ( p 1) h,
( x x0 ) x x0 ( x x0 ) (p 1)h h (p 2)h
etc.
Hence, writting y(x) = y(x0 + ph) = yp, (2) becomes
p(p 1) 2 p(p 1)(p 2) 3
yp y0 py0 y0 y0
2! 3!
p(p 1) p n - 1
n y0 (3)
3!
It is called Newton’s forward interpolation formula as (3) contains y0
and the forward differences of y0
Otherwise: Let the function y f(x) take the values y0, y1, y2, corre-
sponding to the values x0, x0 h, x0 2h, of x. Suppose it is required to
evaluate f(x) for x x0 ph, where p is any real number.
276 • NUMERICAL METHODS IN ENGINEERING AND SCIENCE
yp f ( x0 ph) E p f ( x0 ) (1 )p y0 [ E 1 ]
p(p 1) 2 p(p 1)(p 2) 3
1 p y0 y0 (4)
2! 3!
[Using binomial theorem]
p(p 1) 2 p(p 1)(p 2) 3
i.e., yp y0 py0 y0 y0
2! 3!
If y f(x) is a polynomial of the nth degree, then n1y0 and higher dif-
ferences will be zero.
Hence (4) will become
p(p 1) 2 p(p 1)(p 2) 3
yp y0 py0 y0 y0
2! 3!
p(p 1) p n 1 n
y0
3!
Which is same as (3)
EXAMPLE 7.1
The table gives the distance in nautical miles of the visible horizon for
the given heights in feet above the earth’s surface:
x height: 100 150 200 250 300 350 400
y distance: 10.63 13.03 15.04 16.81 18.42 19.90 21.27
Find the values of y when
(i) x 160 ft. (ii) x 410.
Solution:
The difference table is as under:
x y 2 3 4
100 10.63
2.40
150 13.03 – 0.39
2.01 0.15
200 15.04 – 0.24 – 0.07
1.77 0.08
250 16.81 – 0.16 – 0.05
1.61 0.03
300 18.42 – 0.13 – 0.01
1.48 0.02
350 19.90 – 0.11
1.37
400 21.27
(i) If we take x0 160, then y0 13.03, y0 2.01, 2y0 – 0.24,
0.08, 4 y0 – 0.05
3
278 • NUMERICAL METHODS IN ENGINEERING AND SCIENCE
x x0 10
Since x 160 and h 50, p 0.2
h 50
Using Newton’s forward interpolation formula, we get
p(p 1) 2 p(p 1)(p 2) 3
y218 yp y0 py0 y0 y0
2! 3!
p(p 1)(p 2)(p 3) 4
y0
4!
y160 13.03 0.402 0.192 0.0384 0.00168 13.46 nautical miles
(ii) Since x 410 is near the end of the table, we use Newton’s back-
ward interpolation formula.
x xn 10
Taking xn 400, p 0.2
h 50
Using the line of backward difference
yn 21.27, yn 1.37, 2 yn – 0.11, 3 yn 0.02 etc.
Newton’s backward formula gives
p p 1 2
y410 y400 py400 y400
2!
p(p 1)(p 2) 3 p(p 1)(p 2)(p 3) 4
y400 y400
3! 4!
0.2 1.2
21.27 0.2 1.37 0.11
2!
0.2 1.2 2.2 0.2 1.2 2.2 3.2
0.02 0.01
3! 4!
21.27 0.274 0.0132 0.0018 0.0007
21.53 nautical miles
EXAMPLE 7.2
From the following table, estimate the number of students who ob-
tained marks between 40 and 45:
Marks: 30—40 40—50 50—60 60—70 70—80
No. of students: 31 42 51 35 31
INTERPOLATION • 279
Solution:
First we prepare the cumulative frequency table, as follows:
Marks less than (x): 40 50 60 70 80
No. of students (yx): 31 73 124 159 190
Now the difference table is
x yx yx 2 yx 3yx 4yx
40 31
42
50 73 9
51 – 25
60 124 – 16 37
35 12
70 159 –4
31
80 190
We shall find y45, i.e., the number of students with marks less than 45.
Taking x0 40, x 45, we have
x x0 5
p 0.5 [ h 10]
h 10
Using Newton’s forward interpolation formula, we get
p(p 1) 2 p(p 1)(p 2) 3
y45 y40 py40 y40 y40
2! 3!
p(p 1)(p 2)(p 3) 4
y40
4!
0.50.5 0.50.515
31 0.5 42 9 25
2 6
0.50.5152.5
37
24
31 21 – 1.125 – 1.5625 – 1.4453
47.87, on simplification.
The number of students with marks less than 45 is 47.87, i.e., 48. But
the number of students with marks less than 40 is 31.
Hence the number of students getting marks between 40 and 45
48 – 31 17.
280 • NUMERICAL METHODS IN ENGINEERING AND SCIENCE
EXAMPLE 7.3.
Find the cubic polynomial which takes the following values:
x: 0 1 2 3
f(x): 1 2 1 10
Hence or otherwise evaluate f(4).
Solution:
The difference table is
x f(x) f(x) 2f(x) 3f(x)
0 1
1
1 2 –2
–1 12
2 1 10
9
3 10
x0
We take x0 0 and p x [ h 1]
h
Using Newton’s forward interpolation formula, we get
x x( x 1) 2 x( x 1)( x 2) 3
f ( x) f (0) f (0) f (0) f (0)
1 1.2 1.2.3
x( x 1) x( x 1)( x 2)
1 x 1 2 12
2 6
2 x3 7 x2 6 x 1
which is the required polynomial.
x xn
To compute f(4), we take xn 3, x 4 so that p 1 [ h 1]
h
EXAMPLE 7.4
Using Newton’s backward difference formula, construct an interpolat-
ing polynomial of degree 3 for the data: f (– 0.75) – 0.0718125, f (– 0.5)
– 0.02475, f (– 0.25) 0.3349375, f (0) 1.10100. Hence find f (– 1/3).
Solution:
The difference table is
x y y 2y 3y
– 0.75 – 0.0718125
0.0470625
– 0.50 – 0.02475 0.312625
0.3596875 0.09375
– 0.25 0.3349375 0.400375
0.7660625
0 1.10100
We use Newton’s backward difference formula
p p(p 1) 2 p(p 1)(p 2) 3
y( x) y3 y3 y3 y3
1! 2! 3!
x0 x h 0.25
taking x3 0, p 4x
h 0.25
4 x(4 x 1)
y x 1.10100 4 x(0.7660625) 0.400375
2
4 x(4 x 1)(4 x 2)
(0.09375)
6
1.101 3.06425 x 3.251 x2 0.81275 x x3 0.75 x2 0.125 x
x3 4.001 x2 4.002 x 1.101
1
Put x , so that
3
282 • NUMERICAL METHODS IN ENGINEERING AND SCIENCE
1 1 1 2 1
y 34.001 4.002 1.101
3 3 3 3
0.1745
EXAMPLE 7.5
In the table below, the values of y are consecutive terms of a series of
which 23.6 is the 6th term. Find the first and tenth terms of the series:
x: 3 4 5 6 7 8 9
y: 4.8 8.4 14.5 23.6 36.2 52.8 73.9
Solution:
The difference table is
x y y 2y 3y 4y
3 4.8
3.6
4 8.4 2.5
6.1 0.5
5 14.5 3.0 0
9.1 0.5
6 23.6 3.5 0
12.6 0.5
7 36.2 4.0 0
16.6 0.5
8 52.8 4.5
21.1
9 73.9
To find the first term, use Newton’s forward interpolation formula with
x0 3, x 1, h 1, and p – 2. We have
2 2 3 2 34
y(1) 4.8 3.6 2.5 0.5 3.1
1 1.2 1.2.3
To obtain the tenth term, u se Newton’s backward interpolation for-
mula with xn 9, x 10, h 1, and p 1.This gives
1 1 2 1(2) 3
y 10 73.9 21.1 4.5 0.5 100
1 1.2 1.2.3
INTERPOLATION • 283
EXAMPLE 7.6
Using Newton’s forward interpolation formula show
2
n(n 1)
n3
2
Solution:
If sn sn3, then sn1 (n 1)3
sn sn1 sn n 1 n3 3
n 1
3
3 3
Then 2 sn sn1 sn n 2 n 1 3n2 9 n 7
3 sn 2 sn1 2 sn
3 n 9 n 7 6 n 12
3 n 1 9 n 1 7
2 2
4 sn 3 sn1 3 sn 6 n 1 12 6 n 12 6
and 5 sn 5 sn ...... 0
Since the first term of the given series is 1, therefore taking n 1, s1 1,
s1 8, 2 s1 19, 3s1 18, 4 s1 6.
Substituting these in the Newton’s for war d interpolation formula, i.e.,
(n 1)(n 2) 2 (n 1)(n 2)(n 3) 3
s s(n – 1)s1 s1 s1
2! 3!
(n 1)(n 2)(n 3)(n 4) 4
s1
4!
19
sn 1 8(n – 1) (n – 1)(n – 2) 3(n – 1)(n – 2)(n – 3)
2
1 1 4 3 2 n(n 1)2
(n – 1)(n – 2)(n – 3)(n – 4) (n 2 n n )
4 4 2
Exercises 7.1
11. From the following data, estimate the number of persons having in-
comes between 2000 and 2500:
Income Below 500 500–1000 1000–2000 2000–3000 3000–4000
No. of persons 6000 4250 3600 1500 650
12. Construct Newton’s forward interpolation polynomial for the following
data:
x: 4 6 8 10
y: 1 3 8 16
Hence evaluate y for x 5.
13. Find the cubic polynomial which takes the following values:
y(0) 1, y(1) 0, y(2) 1 and y(3) 10.
Hence or otherwise, obtain y(4).
Evaluate f (0.6)
15. Apply Newton’s backward difference formula to the data below, to ob-
tain a polynomial of degree 4 in x:
x: 1 2 3 4 5
y: 1 –1 1 –1 1
16. The following table gives the population of a town during the last six
censuses. Estimate the increase in the population during the period
from 1976 to 1978:
Year: 1941 1951 1961 1971 1981 1991
Population: 12 15 20 27 39 52
(in thousands)
17. In the following table, the values of y are consecutive terms of a series of
which 12.5 is the fifth term. Find the first and tenth terms of the series.
x: 3 4 5 6 7 8 9
y: 2.7 6.4 12.5 21.6 34.3 51.2 72.9
306 • NUMERICAL METHODS IN ENGINEERING AND SCIENCE
EXAMPLE 7.17
Given the values
x: 5 7 11 13 17
f(x): 150 392 1452 2366 5202
evaluate f(9), using Lagrange’s formula
Solution:
(i) Here x0 5, x1 7, x2 11, x3 13, x4 17
and y0 150, y1 392, y2 1452, y3 2366, y4 5202.
Putting x 9 and substituting the above values in Lagrange’s formula,
we get
(9 7)(9 11)(9 13)(9 17) (9 5)(9 11)(9 13)(9 17)
f (9) 150 392
(5 7)(5 11)(5 13)(5 17) (7 5)(7 11)(7 13)(7 17)
(9 5)(9 7)(9 13)(9 17)
1452
(11 5)(11 7)(11 13)(11 17)
(9 5)(9 7)(9 11)(9 17)
2366
(13 5)(13 7)(13 11)(13 17)
(9 5)(9 7)(9 11)(9 13)
5202
(17 5)(17 7)(17 11)(17 13)
50 3136 3872 2366 578
810
3 15 3 3 5
308 • NUMERICAL METHODS IN ENGINEERING AND SCIENCE
EXAMPLE 7.18
Find the polynomial f (x) by using Lagrange’s formula and hence find
f(3) for
x: 0 1 2 5
f (x): 2 3 12 147
Solution:
Here x0 0, x1 1, x2 2, x35
and y0 2, y1 3, y2 12, y3147.
Lagrange’s formula is
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 )
y y0 y
( x0 x1 )( x0 – x2 )( x0 x3 ) ( x1 – x0 )( x1 – x2 )( x1 x3 ) 1
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 )
y y
( x2 – x0 )( x2 – x1 )( x2 x3 ) 2 ( x3 – x0 )( x3 – x1 )( x3 x2 ) 3
( x 1)( x 2)( x 5) ( x 0)( x 2)( x 5)
(2) (3)
(0 1)(0 2)(0 5) (1 0)(1 2)(1 5)
( x 0)( x 1)( x 5) ( x 0)( x 1)( x 2)
12 (147)
(2 0)(2 1)(2 5) (5 0)(5 1)(5 2)
3 2
Hence f ( x) x x – x 2
f (3) 27 9 – 3 2 35
EXAMPLE 7.19
A curve passes through the points (0, 18), (1, 10), (3, –18) and (6, 90).
Find the slope of the curve at x 2.
Solution:
Here x0 0, x1 1, x2 3, x3 6 and y0 18, y1 10, y2 –18, y3 90.
Since the values of x are unequally spaced, we use the Lagrange’s for-
mula:
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 )
y y0 y
( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x1 x3 ) 1
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 )
y2 y
( x2 – x0 )( x2 – x1 )( x2 x3 ) ( x3 – x0 )( x3 – x1 )( x3 x2 ) 3
INTERPOLATION • 309
EXAMPLE 7.20
3 x2 x 1
Using Lagrange’s formula, express the function as
a sum of partial fractions. x 1 x 2 x 3
Solution:
Let us evaluate y 3x2 x 1 for x 1, x 2 and x 3
These values are
x: x0 1 x1 2 x2 3
y: y0 5 y1 15 y2 31
Lagrange’s formula is
( x x1 )( x x2 ) ( x x0 )( x x2 ) ( x x0 )( x x1 )
y y0 y1 y
( x0 x1 )( x0 x2 ) ( x1 x0 )( x1 x2 ) ( x2 – x0 )( x2 – x1 ) 2
EXAMPLE 7.21
Find the missing term in the following table using interpolation:
x: 0 1 2 3 4
y: 1 3 9 ... 81
Solution:
Since the given data is unevenly spaced, therefore we use Lagrange’s
interpolation formula:
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 )
y y0 y
( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x1 x3 ) 1
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 )
y2 y
( x2 – x0 )( x2 – x1 )( x2 x3 ) ( x3 – x0 )( x3 – x1 )( x3 x2 ) 3
Here we have x0 0 x1 1 x2 2 x3 4
y0 1 y1 3 y2 9 y3 81
( x 1)( x 2)( x 4) ( x 0)( x 2)( x 4)
y 1 3
(0 1)(0 2)(0 4) (1 0)(1 2)(1 4)
( x 0)( x 1)( x 4) ( x 0)( x 1)( x 2)
9 (81)
(2 0)(2 1)(2 4) (4 0)(4 1)(4 2)
When x 3, then
(3 1)(3 2)(3 4) 3(3 1)(3 4) 9
y 3(3 2)(3 4)
8 4
3(3 1)(3 2) 1 27 81
(81) 3 31
24 4 2 24
Hence the missing term for x 3 is y 31.
EXAMPLE 7.22
Find the distance moved by a particle and its acceleration at the end of
4 seconds, if the time verses velocity data is as follows:
t: 0 1 3 4
v: 21 15 12 10
INTERPOLATION • 311
Solution:
Since the values of t are not equispaced, we use Lagrange’s formula:
(t t1 )(t t2 )(t t3 ) (t t0 )(t t2 )(t t3 )
v v v
(t0 t1 )(t0 t2 )(t0 t3 ) 0 (t1 t0 )(t1 t2 )(t1 t3 ) 1
(t t0 )(t t1 )(t t3 ) (t t0 )(t t1 )(t t3 )
v2 v
(t1 t0 )(t1 t2 )(t1 t3 ) (t1 t0 )(t1 t2 )(t1 t3 ) 3
(t 1)(t 3)(t 4) t(t 3)(t 4)
i.e. , v (21) (15)
(1)(2)(4) (1)(2)(3)
t(t 1)(t 4) t(t 1)(t 3)
(12) (10)
(3)(2)(1) (4)(3)(1)
1
i.e., v (–5t 3 38 t 2 – 105t 252)
12
4 4 ds
Distance moved s 0 vdt 0 (–5t 3 38 t 2 – 105t 252) v dt
1 5t 4 38 t 3 105t 2 4
– – 252 t
12 4 3 2 0
1 2432
–320 – 840 1008 54.9
12 3
dv 1
Also acceleration 15t 2 76 t 105 0
dt 2
1
Hence acceleration at (t 4) 15 76 4 105 3.4
2
Exercises 7.3
yo
1
2 8 2
y1 y1 1 1 y3 y1 1 y1 y3 .
2
[Hint: Here x0 – 3, x1 – 1, x2 1, x3 3.]