Numerical Analysis-5
Numerical Analysis-5
Numerical Analysis-5
Numerical Analysis-5
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
where
(x − x0 )(x − x1 ) · · · (x − xi−1 )(x − xi+1 ) · · · (x − xn )
`i (x) = .
(xi − x0 )(xi − x1 ) · · · (xi − xi−1 )(xi − xi+1 ) · · · (xi − xn )
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
where
(y − y0 )(y − y1 ) · · · (y − yi−1 )(y − yi+1 ) · · · (y − yn )
`i (y) = .
(yi − y0 )(yi − y1 ) · · · (yi − yi−1 )(yi − yi+1 ) · · · (yi − yn )
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Example
Certain corresponding values of x and log10 x are (300, 2.4771),
(304, 2.4829), (305, 2.4843) and (307, 2.4871). Find log10 301.
Solution
Using Lagrange’s interpolation formula, we have
3
X
P3 (x) = `i (x) yi
i=0
(x − x1 )(x − x2 )(x − x3 )
= (y0 )
(x0 − x1 )(x0 − x2 )(x0 − x3 )
(x − x0 )(x − x2 )(x − x3 )
+ (y1 )
(x1 − x0 )(x1 − x2 )(x1 − x3 )
(x − x0 )(x − x1 )(x − x3 )
+ (y2 )
(x2 − x0 )(x2 − x1 )(x2 − x3 )
(x − x0 )(x − x1 )(x − x2 )
+ (y3 )
(x3 − x0 )(x3 − x1 )(x3 − x2 )
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Solution
According to given problem, we have
x0 x1 x2 x3
x 300 304 305 307
y 2.4771 2.4829 2.4843 2.4871
y y0 y1 y2 y3
Therefore,
(301 − 304)(301 − 305)(301 − 307)
P3 (301) = log10 301 = (2.4771)
(300 − 304)(300 − 305)(300 − 307)
(301 − 300)(301 − 305)(301 − 307)
+ (2.4829)
(304 − 300)(304 − 305)(304 − 307)
(301 − 300)(301 − 304)(301 − 307)
+ (2.4843)
(305 − 300)(305 − 304)(305 − 307)
(301 − 300)(301 − 304)(301 − 305)
+ (2.4871)
(307 − 300)(307 − 304)(307 − 305)
= 1.2739 + 4.9658 − 4.4717 + 0.7106
= 2.4786.
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Example
Interpolate by means of Lagrange’s interpoation formula and find the value
of f (5), from the following data
Solution: 32.9333.
Example
The function y = f (x) is given at the points (7, 3), (8, 1), (9, 1) and (10, 9).
Find the value of y for x = 9.5 using Lagrange’s interpolation formula.
Solution: 3.625.
Example
If y(1) = −3, y(3) = 9, y(4) = 30 and y(6) = 132, find the four point
Lagrange’s interpolation polynomial that takes the same values as the
function y at the given points.
Solution: x3 − 3x2 + 5x − 6.
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Example
Solution
According to given problem, we have
x0 x1 x2
x 1 3 4
y 4 12 19
y y0 y1 y2
And y = 7. Then, using inverse inperpolation formula, we obtain
2
X
x= `i (y) xi = `0 (y) x0 + `1 (y) x1 + `2 (y) x2
i=0
(7 − 12)(7 − 19) (7 − 4)(7 − 19) (7 − 4)(7 − 12)
x= (1) + (3) + (4)
(4 − 12)(4 − 19) (12 − 4)(12 − 19) (19 − 4)(19 − 12)
1 27 4 26
= + − = = 1.86
2 14 7 14
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Even if the arguments are equal, the divided differences may still have a
meaning. We then set x1 = x0 + h so that
y(x0 + h) − y(x0 )
[x0 , x1 ] = lim [x0 , x0 + h] = lim
h→0 h→0 h
0
= y (x0 ), if y(x) is differenctiable.
Similarly,
y r (x0 )
[x0 , x0 , · · · , x0 ] = .
| {z } r!
(r+1) argumetnts
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
and in general,
1
[x0 , x1 , · · · , xn ] = ∆n y0 . (4)
hn n!
Note: If the tabulated function is a polynomial of nth degree, then ∆n y0
would be a constant and hence the nth divided difference would also be a
constant.
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
so that
y = y0 + (x − x0 )[x, x0 ].
Again
[x, x0 ] − [x0 , x1 ]
[x, x0 , x1 ] =
x − x1
which gives
[x, x0 ] = [x0 , x1 ] + (x − x1 )[x, x0 , x1 ].
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Example
Construct a divided difference table for the following data:
x 1 2 4 7
f (x) 22 30 82 106
Solution
The divided difference table is
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Example
Using the following table find f (x) as a polynomial in x:
x -1 0 3 6 7
f (x) 3 -6 39 822 1611
Solution
The divided difference table is
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)
Interpolation with unevenly spaced points
Solution
Therefore,
Dr. S.D. Purohit, UD, RTU, Kota B.Tech. III Semester (ME/P&I)