3.2 Interpolation With Unevenly Spaced Points
3.2 Interpolation With Unevenly Spaced Points
M
1
yn(xn) = yn gives an yn
( xn x0 )( xn x1 )...( xn xn-1 )
Substituting in (6), we obtain
( x x0 )( x x2 )...( x xn ) ( x x0 )( x x2 )...( x xn )
yn ( x ) y0 y1 ...
( x0 x1 )( x0 x2 )...( x0 xn ) ( x1 x0 )( x1 x2 )...( x1 xn )
( x x0 )( x x1 )...( x xn1 )
yn .
( xn x0 )( xn x1 )...( xn xn 1 )
This is called Lagrange’s interpolation formula.
Example 1: The values of x and log10 x are (300, 2.4771), (304, 2.4829), (305,
2.4843) and (307, 2.4871). Find log10 301.
Solution:
( 3)( 4)( 6) (1)( 4)( 6)
log10 301 (2.4771) (2.4829)
(4)( 5)( 7) (4)( 1)( 3)
(1)( 3)( 6) (1)(3)( 4)
(2.4843) (2.4871)
(5)(1)(2) (7)(3)(2)
2.4786.
Example 2: Find the Lagrange’s interpolating polynomial approximating the
function y = log x defined by the following table of values. Hence determine the
value of log 2.7
x 2 2.5 3.0
log x 0.69315 0.91629 1.09861
Solution:
y ( x ) (2 x 2 11x 15)(0.69315) (4 x 2 20 x 24)(0.91629) (2 x 2 9 x 10)(1.09861)
0.08164 x 2 0.81366 x 0.60761,
which is the required quadratic polynomial.
Putting x = 2.7, we get log 2.7 y (2.7) 0.9932518.
Example 3: The function y sin x is tabulated below
x 0 π/4 π/2
y 0 0.70711 1.0
Using Lagrange’s interpolation formula, find the value of sin π/6)
Solution:
(π/6 0)(π/6 π/2) (π/6 0)(π/6 π/4)
sin(π/6) (0.70711)+ (1)
(π/4 0)(π/4 π/2) (π/2 0)(π/2 π/4)
0.51743.
Example 4: Using Lagrange’s interpolation formula, find y as polynomial in x
from the following table:
x 0 1 3 4
y -12 0 12 24
x
y y1 y y2 ... y yn x y y0 y y2 ... y yn x .....
y0 y1 y0 y2 ... y0 yn 0 y1 y0 y1 y2 ... y1 yn 1
Example 1: If y1 4, y3 12, y4 19 and y x 7, find x.
Solution:
(5)(12) (3)(12) (3)( 5)
x (1) (3) (4)
(8)(15) (8)(7) (15)(7)
1.86.
Exercise 4.3
1. Applying Lagrange’s formula, find a cubic polynomial which approximates
the following data:
x -2 -1 2 3
y(x) -12 -8 3 5
2. Given the data points (1,-3), (3,9), (4,30) and (6,132) satisfying the function
y = f(x), compute f(5) .
3. Given the table values
x 50 52 54 56
3
x 3.684 3.732 3.779 3.825
y1 y0
x0 , x1
x1 x0
Similarly,
y2 y1 y y2 y yn 1
x1, x2 , x2 , x3 3 , …, xn 1 , xn n .
x2 x1 x3 x2 xn xn1
The second order divided differences are defined as
x1, x2 x0 , x1 x , x x1, x2 , … ,
x0 , x1, x2 , x1, x2 , x3 2 3
x2 x0 x3 x1
x0 , x1
x1 y1
x0 , x1, x2
x1 , x2
x2 y2
x1, x2 , x3
x2 , x3
x3 y3
. .
. . …… x0 , x1,, xn
. .
. .
. .
. .
xn 2 , xn1 xn3 , xn2 , xn1
xn1 yn 1
Note: The divided differences are symmetric and independent of the order of the
arguments. That is,
[ x0 , x1 ] [ x1 , x0 ] ,
[ x0 , x1 , x2 ] [ x2 , x1 , x0 ] [ x0 , x2 , x1 ] [ x1 , x2 , x0 ] [ x1 , x0 , x2 ] [ x2 , x0 , x1 ]
and similarly for higher order differences.
Newton’s Divided Difference Interpolation Formula:
Let y0 , y1 ,, yn be the values of y = f(x) corresponding to the arguments
Also, from
x, x0 , x1 - x0 , x1, x2
x, x0 , x1, x2
x - x2
x, x0 , x1 x0 , x1 , x2 ( x - x2 ) x, x0 , x1 , x2
x x0 x x1 x x2 x, x0 , x1 , x2 .
x x0 x x1 x x2 x, x0 , x1 , x2
This is called Newton’s divided difference interpolation formula, the last term
being the remainder term after (n + 1) terms.
Example 1:
Given the values
x 5 7 11 13 17
f(x) 150 392 1452 2366 5202
Evaluate f(9) using Newton's divided difference formula.
Solution:
x f(x) First Order Second Third order Fourth
Differences Order Differences order
Differences Differences
5 150
121
24
7 392
265 1
32
11 1452 0
457
13 2366 42 1
709
17 5202
x 0 2 3 6
f(x) 4 2 14 158
Solution:
x y First Order Second Third order
Differences Order Differences
Differences
0 4
2 2 3
12 1
3 14 9
48
6 158
Solution:
x y First Order Second Third order
Differences Order Differences
Differences
0 2
1
1 3 4
9 1
2 12 9
45
5 147
Example 4: Find the Newton’s divided differences polynomials for the data and
also find f(2.5).
x 3 1 0 3 5
f(x) 30 22 12 330 3458
x f(x) First Order Second Third order Fourth
Differences Order Differences order
Differences Differences
3 30
1 22 2
10 4
0 12 26 5
114
3 330 44
290
1564
5 3458
2. Construct the interpolation polynomial for the data given below using
Newton’s general interpolation formula for the divided differences
x 2 4 5 6 8 10
y 10 96 196 350 868 1746
4. Fit a polynomial to the data (-4, 1245), (-1, 33), (0, 5), (2, 9), (5, 1335). Hence
find f(1) and f(7)