Interpolation - Arpit (1) 3
Interpolation - Arpit (1) 3
Submitted by
Ayush Tiwari
2110011015926
6th semester.
Acknowledgement
My profound thanks goes out to Dr.Anupama Rastogi for his great advice
and assistance during this project's development. His knowledge and
guidance have greatly influenced the course of my work. I express my
gratitude to Lucknow University for furnishing a favorable academic
atmosphere and essential resources that enabled the successful fulfillment of
this undertaking. Finally, I would like to express my gratitude to everyone
who helped with this project, whether directly or indirectly. Your assistance
has been invaluable, and I appreciate the cooperative attitude that made this
experience even more enjoyable.
Ayush Tiwari
3
INTERPOLATION
Objectives
Introduction
Stirling's formula
Bessel's formula
Everett's formula
Divided differences
Introduction
y: Y0 y1 y 2 ⋯ y n.
in (1), we get
y 0=a0 , y 1=a0 + a1 ( x 1−x 0 ) , y 2=a 0 +a1 ( x 2−x 0 ) +a2 ( x 2−x 0 ) ( x 2−x 1)
and so on.
Also
Δ y 1 ¿ y 2− y1 =a1 ( x 2−x1 ) + a2 ( x2 −x 0) ( x 2−x 1 ) 1 1 2
Also a2=¿ 2 ( Δ y 1−Δ y 0) = Δ y0 ¿
¿ ¿ 2h 2! h
2
1 3
Similarly a 3= 3 Δ y 0 and so on.
3! h
Obs. 2. The first two terms of this formula give the linear
interpolation while the first three terms give a parabolic
interpolation and so on.
Example :
The table gives the distance in nautical miles of the visible
horizon for the given heights in feet above the earth's
surface:
x =
100 150 200 250 300 350 400
height:
8
y=¿
10.6 13.0 15.0 16.8 18.4 19.9 21.2
distance
3 3 4 1 2 0 7
:
Find the values of y when
10 10.6
0 3
2.4
0
15
13.03 -0.39
0
0.1
2.01
5
-
20 15.0
−0.24 0.0
0 4
7
1.7
0.08
7
25 16.8
-0.16 0.05
0 1
1.6 0.0
1 3
-
30 18.4
-0.13 0.0
0 2
1
9
(ii) Since x=410 is near the end of the table, we use Newton's
backward interpolation formula.
x−x n 10
∴ Taking x n=400 , p= = =0.2
h 50
p ( p+1) 2
y 410 = y 400 +¿ p ∇ y 400 + ∇ y 400
2! 0.2(1.2) 0.2(1.2)(2.2
+ p ( p+1)(p +2) 3 p( p+1)( p+2)( p+3) 4 21.27+0.2(1.37)+ (−0.11)¿+
Δ y 400 + ∇ y 400 +⋯ 2! 3!
3! 4!
¿
Example:
No. of
31 42 51 35 31
students:
10
Solution:
First we prepare the cumulative frequency table, as follows:
No. of students 3 7 12 15 19
( y x ): 1 3 4 9 0
40 31
42
50 73 9
51 −25
60 124 −16 37
35 12
70 159 −4
31
80 190
x−x 0 5
p= = =0.5[∵ h=10 ]
h 10
Example
Using Newton's backward difference formula, construct an
interpolating polynomial of degree 3 for the data:
(−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
12
2 3
x y Δy Δ y Δ y
-
-
0.071812
0.75
5
0.047062
5
- 0.31262
-0.02475
0.50 5
0.359687
0.09375
5
- 0.334937
0.400375
0.25 5
0.7660625
0 1.10100
x−0 x
taking x 3=0 , p= h = 0.25 =4 x [∵h=0.25]
13
4 x (4 x +1)
y (x )=¿ 1.10100+ 4 x (0.7660625)+ (0.400375)
2 2 3
+ 4 x (4 x+1)( 4 x+ 2) 1.101+3.06425 x+ 3.251 x +0.81275 x+ x + 0.75 x
(0.09375)
6
¿
−1
Put x= 3 , so that
( ) ( ) ( ) ( )
3 2
−1 −1 −1 −1
y ¿ +4.001 + 4.002 +1.101
3 3 3 3
¿ ¿
x 0−2 h y −2
Δ y−2 ¿
2
x 0−h y −1 Δ y −¿ ( ¿ Δ y
2
−1 )¿
x0 y0 Δ 2 y −1 ( ¿ Δ2 y 0 ) Δ 3 y −2 ( ¿ Δ4 y 0 )
x 0 +h y1 Δ y 0 ( ¿ Δ y 1/ 2 ) Δ 3 y −1 ( ¿ Δ3 y 1/ 2 )
Δ y1 ( ¿ Δ y3 / 2)
x 0 +2 h y2
i.e.,
15
2 2 3
Δ y 0 =Δ y−1 + Δ y−1
Similarly
3 3 4
Δ y 0 =Δ y−1 + Δ y−1
Δ y 0= Δ4 y −1 + Δ 5 y−1 etc.
4
Also
3 3 4
Δ y −1−Δ y −2 =Δ y−2
i.e.,
3 3 4
Δ y −1=Δ y −2 + Δ y −2
Similarly
4 4 5
Δ y−1= Δ y −2 + Δ y−2 etc.
i.e.,
2
Δ y 0=Δ y −1+ Δ y−1
Similarly
2 2 3
Δ y 0 =Δ y−1 + Δ y −1
Δ y 0=Δ 3 y −1 + Δ4 y −1 etc.
3
i.e., Δ 3 y −1=Δ 3 y −2 + Δ4 y −2
Stirling's Formula
Gauss's forward interpolation formula is
( p+1) 2 +(p+ 1) p( p−1) 3
y p= y 0+ p Δ y 0 + Δ y−1 Δ y−1
2! 3!
¿ ¿
( ) p ( p2 −1 )
( )
Δ y−1+ Δ y−2 p2 ( p 2−1 ) 4
3 3
Δ y 0 + Δ y −1 p2 2
y p= y 0+ p + Δ y−1 + ¿× + Δ y −2 +⋯
2 2! 3! 2 4!
For
1 1
2
( Δ y 0+ Δ y−1 )= ( δ y 1 /2 +δ y −1 /2 ) =μδ y 0
2
1 3 1
2
( Δ y−1 + Δ3 y −2 )= 2 (δ 3 y 1/ 2+ δ3 y−1/ 2 )=μ δ3 y 0 etc.
( ) ( ) ( )
3 5
Δ y −1 Δ y Δ y
⋯ y0⋯ ⋯ Δ2 y−1 ⋯ 3 −2 ⋯ Δ 4 y−2 ⋯ 5 −1 ⋯ Δ6 y−3 ⋯
Δ y0 Δ y−1 Δ y0
19
Central line.
Bessel's Formula
i.e.,
2 2 3
Δ y −1=Δ y 0− Δ y−1
p ( p2−1 ) 3
y p= y 0 + p Δ y 0 +
2! (
p ( p−1) 1 2
2
1 2
Δ y−1 + Δ y −1 +
2 3!) Δ y −1 y + p Δ y + 1 p ( p+1) Δ2 y + 1 p ( p−1) Δ
0 0
2 2!
−1
2 2!
(
¿ ¿
Hence
y p= y 0+ p Δ y 0 +
2
p( p−1) Δ y−1+ Δ y 0
+
2 ( p− 12 ) p ( p−1) Δ y
3
−1
2! 2 3!
y p= y 0+ pδ y 1 /2 +
p ( p−1) 2
μ δ y 1 /2
+ p−( 1
2)p ( p−1)
3
δ y 1 /2
2! 2!
¿ ¿
for
20
1 2 1 4
2
( Δ y−1+ Δ y 0 ) =μ δ y 1/ 2 , ( Δ y −2 + Δ y−1 ) =μ δ y 1 /2 etc.,
2 2
2
4 4
{ } { } { }
2 4 6
Δ y−1 Δ y−2 Δ y −1
y0 Δ y0 2
Δ 3 y−1 4
Δ 5 y−2 6
Δ 7 y −3 Central line
Δ y0 Δ y−1 Δ y0
Laplace-Everett's Formula
Gauss's forward interpolation formula is
( p−1) p 2 ( p +1) p( p−1) 3
y p= y 0 + p Δ y 0 + Δ y−1+ Δ y−1
2! 3!
¿ ¿
× ( Δ y−1−Δ y−2 ) +⋯
4 4
¿
Example:
Find f (22) from the Gauss forward formula:
x: 20 25 30 35 40 45
35 33 29 26 23 20
f (x):
4 2 1 0 1 4
Solution:
Taking x 0=25 , h=5, we have to find the value of f (x) for x=22.
x−x 0 22−25
i.e., for p= = =−0.6
h 5
23
x p yp Δ yp 2
Δ yp
3
Δ yp
4
Δ yp
5
Δ yp
- 354 ( ¿ y −1 )
20 -22
1
35 2 260 ( ¿ y 2 ) -29 2 0 8
40 3 231 ( ¿ y 3 ) -27 2
45 4 204 ( ¿ y 4 )
Hence f (22)=347.983.
Example:
Use Gauss's forward formula to evaluate y 30, given that
y 21=18.4708, y 25=17.8144 , y 29=17.1070 , y 33=16.3432 and y 37=15.5154 .
24
Solution
Taking x 0=29 , h=4 , we require the value of y for x=30
x−x 0 30−29
i.e., for p= = =0.25
h 4
2 3 4
x p yp Δ yp Δ yp Δ yp Δ yp
2 18.470
-2
1 8
-
0.6564
2 17.814 -
-1
5 4 0.0510
- -
0.7074 0.7074
2 17.107 - -
0
9 0 0.0564 0.0022
- -
0.7638 0.0076
3 16.343 -
1
3 2 0.0640
25
-
0.8278
3 15.515
2
7 4
Example:
Using Gauss backward difference formula, find y (8) from
the following table.
1 1 2 2
x 0 5
0 5 0 5
1 1 1 2 3
y 7
1 4 8 4 2
Solution:
Taking x 0=10 , h=5, we have to find y for x=8 , i.e., for
x−x 0 8−10
p= = =−0.4.
h 5
2 3 4 5
x p yp Δ yp Δ yp Δ yp Δ yp Δ yp
0 2 7
5 1 11 -1
3 2
10 0 14 1 -1
4 1 0
15 1 18 2 -1
6 0
20 2 24 2
25 3 32
Hence y (8 )=12.826
27
EXAMPLE
Population:
12 15 20 27 39 52
(in
thousands)
Solution:
Taking x 0=1969 , h=10, the population of the town is to be found
for
1974−1969
p= =0.5
10
28
2 3 4 5
x p yp Δ yp Δ yp Δ yp Δ yp Δ yp
193 - 1
3 2 0 3 -10
9 3 2
194 - 1
9 2 5
195 - 2
2
9 1 0
7 3
196 2
0 5 -7
9 7
12 -4
197 3
1 1
9 9
13
198 5
Gauss 2
9 2
backward formula is
( p+1) p 2 ( p+1) p( p−1) 3
y p= y 0 + p Δ y−1 + Δ y−1 + Δ y−2
2! 3!
+( p+2)( p+1) p( p−1)(p−2) 5
¿ Δ y 3 +⋯ 27+3.5+1.875−0.1875+0.2743−0.1172 ¿=¿ 32.
5!
(1.5)(0.5) (1.5)(0.5)(−0.5)
y 0.5 =27 +(0.5)(7)+ (5)+
2 6
¿ ¿
EXAMPLE
29
Solution:
is
x−28
Taking the origin at x 0=28 , h=8, we have p= 8 . The central
table
2 3
x p y Δy Δ y Δ y
20 -1 2854
308
28 0 3162 3618
3926 -6648
36 1 7088 -3030
896
44 2 7984
30−28
At x=30 , p= 8 =0.25 and q=1− p=0.75
Everett's formula is
p ( p −1 ) 2
2 2
p ( p −1 ) ( p −2 ) 4
2 2 2 2 (0.75)+(3162)+ (3618)+ ⋯¿+ 0.25+(
+ p y 1+ Δ y 0+ Δ y−2+ ⋯ 6
3! 5!
¿
Hence f (30)=3884.4
Example
Find the polynomial f (x) by using Lagrange's formula and
hence find f (3) for
x: 0 1 2 5
1 14
f (x): 2 3
2 7
Solution:
Lagrange's formula is
Divided Differences
y −y y −y
Similarly [ x 1 , x 2 ] or Δ x y 0= x −x and [ x 2 , x 3 ] or Δ y3 = x −x
2 1 3 2
2
2 1 3 2
[ x 1 , x 2 ]− [ x 0 , x 1 ]
[ x 0 , x 1 , x 2 ] or 2
Δx , x =
1 2
x 2−x 0
[ x 1 , x 2 , x 3 ]− [ x 0 , x 1 , x 2 ]
[ x0 , x1 , x2 , x3 ] or Δ
x 1, x 2 , x 3
3
0 y0=
x 2−x 0
¿ ¿ [ x 1 , x 2 , x 0 ] or [ x 2 , x 0 , x1 ] and so on
y 1− y 0 Δ y 0
[ x0 , x1] ¿
x 1−x 0
=
h
[ x0 , x1 , x2 ] ¿
[ x 1 , x 2 ]−[ x 0−x 1 ] 1 Δ y 1 Δ y 0
x 2−x 0
=
2h h
−
h { }
¿ ¿
also be constant
i.e.,
Δ { a u x +b v x } =a Δ u x + b Δ v x
( a u x +b v x ) −( a u x + b v x )
We have Δ ( a u x + b v x ) = 1 1 0 0
x1
0 0
x1 −x 0
¿a
{ u x −u x
1
x 1−x 0
+b 0
x 1−x 0} {
v x −v x 1 0
}
¿ a Δ u x +b Δ v x 0 0
x1 x0
So that
y= y 0+ ( x−x 0 ) [ x , x 0 ]
[ x , x 0 ]− [ x 0 , x 1 ]
Again [ x , x 0 , x1 ]=
x−x 1
which gives [ x , x 0 ]= [ x 0 , x1 ]+ ( x− x1 ) [ x , x 0 , x 1 ]
[ x . x 0 , x1 ]− [ x . x 0 , x 2 ]
Also [ x , x 0 , x1 , x2 ] =
x−x 2
35
Also
y −y
[ x 0 , x 1 ]= x 1−x 0
1 0
Δy
Similarly [ x 1 , x 2 ]= 1
h
[ x 1 , x 2 ] −[ x 0 , x 1 ]
Now [ x 0 , x 1 , x 2 ]=
x 2−x 0
Δ y 1 /h− Δ y 0 /h
¿
2h
[ ∵ x 2−x 0=2 h ]
Δ y 1− Δ y 0
¿ 2
¿
2h
36
2
Δ y0
Thus [ x 0 , x 1 , x 2 ]= 2
2!h
2
Δ y1
Similarly [ x 0 , x 1 , x 2 ]= 2
2!h
2 2 2 2 2 2
Δ y 1 /2 h −Δ y 0 /2 h Δ y 1− Δ y 0
∴ [ x 0 , x 1 , x 2 , x 3 ]= = [ ∵ x3 −x 0=3 h ]
x 3−x 0 2
2 h (3)
3
Δ y0
Thus [ x 0 , x 1 , x 2 , x 3 ]= 3
3!h
n
Δ y0
In general, [ x 0 , x 1 ,⋯ x n ]= n
n!h
x: 5 7 11 13 17
15 39 14 23 52
f (x):
0 2 52 66 02
Solution:
The divided differences table is
x y Δy 2
Δ y
3
Δ y
392−150
5 150 7−5
=121
37
265−121
7 392 11−5
=24
1 145 1452−392
=265
32−24
=1
1 2 11−7 13−5
1 236 2366−1452
=457
457−265
=32
3 6 13−11 13−7
5202−2366 709−457
=709 =42
17−13 17−11
1 520
7 2
we obtain
f (9) ¿ 150+(9−5)×121+(9−5)( 9−7) ×24 +( 9−5)(9−7)(9−11)× 1
¿ ¿
Example:
Using Newton's divided differences formula, evaluate f (8)
and f (15) given:
x: 4 5 7 10 11 13
4 10 29 90 121 202
y=f (x ):
8 0 4 0 0 8
38
Solution:
The divided differences table is
2 3 4
x f (x) Δy Δ y Δ y Δ y
4 48 0
5 100 15
97 1
7 294 21 0
202 1
10 900 27 0
310 1
11 1210 33
13 409
Similarly f (15)=3150.
Example:
Using Newton's divided difference formula, find the missing
value from the table:
x: 1 2 4 5 6
y: 14 15 5 … 9
39
Solution:
The divided difference table is
2 3
x y Δy Δ y Δ y
1
1
4
15−14
=1
2−1
1 −5−1
2 =−2
5 4−1
5−15 7/4 +2 3
=−5 =
4−2 6−1 4
2 3
x y Δy Δ y Δ y
2+5 7
4 5 =
6−2 4
9−6
=2
6−4
6 9
40
Example:
Using Lagrange's formula, express the function
2
3 x + x+1
as
( x−1)(x−2)(x−3)
um of partial fractions.
Solution:
Let us evaluate y=3 x 2 + x+ 1 for x=1 , x=2 and x=3
Lagrange's formula is
Thus
42
2
3 x + x+1 15.5(x−1)(x−2)
¿
( x−1)(x−2)(x−3) (x−1)(x−2)( x−3)
¿ ¿
Example:
Find the missing term in the following table using
interpolation:
x: 0 1 2 3 4
8
y: 1 3 9 …
1
Solution:
Example:
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
2 1 1 1
v:
1 5 2 0
Solution:
[ ]
4 4
ds
∴ Distance moved s=∫ ❑ vdt=∫ ❑ (−5 t + 38 t −105 +252 ) ∵ v =
3 2 t
0 0 dt
( )
4 3 2 4
1 −5 t 38 t 105 t
¿ + − +252 t
12 4 3 2 0
1
12
¿
−320+
3(
2432
−840+1008 =54.9 )
dv 1
Also acceleration = = (−15 t 2+76 t−105+ 0)
dt 2
1
Hence acceleration at (t=4)= 2 (−15±+76 (4 )−105)=−3.4