Académique Documents
Professionnel Documents
Culture Documents
x x1 x x0
y P1( x) y0 y1
x0 x1 x1 x0
( x0 , y 0 ) , ( x1, y1) , ( x2 , y 2 ) , . . . . . , ( xn , yn )
n
( x x )( x x ).....( x x )( x x )....(x x )
y Pn ( x) yi ( xi x00)( xi x11)....(xi xii11)( xi xii11).....(xi nxn )
i 0
Or
( x x1 )( x x2 ).....( x xn 1 )( x xn )
y Pn ( x) y0
( x0 x1 )( x0 x2 ).....( x0 xn 1 )( x0 xn )
( x x0 )( x x2 ).....( x xn 1 )( x xn )
y1 ............
( x1 x0 )( x1 x2 ).....( x1 xn 1 )( x1 xn )
( x x0 )( x x1 ).....( x xn 2 )( x xn 1 )
yn
( xn x0 )( xn x1 ).....( x1 xn 2 )( xn xn 1 )
Page 1 of 12
or that
n
y Pn ( x) yi Ln,i
i 0
in which
n
(x x j )
Ln,i ( xi x j )
j 0
j i
Notice that the polynomial Pn (x) is called the rational function and is used to evaluate the
approximate value of y at a given value of x xi , i 0,1,2,..., n
Solution:
( x x1 )( x x2 ) ( x x0 )( x x2 ) ( x x0 )( x x1 )
y P2 ( x) y0 y1 y2
( x0 x1 )( x0 x2 ) ( x1 x0 )( x1 x2 ) ( x2 x0 )( x2 x1 )
P 2.3 18.38132
Page 2 of 12
Example 2. Construct the Lagrange Interpolation polynomial for the function y sin x ,
choose the points x0 0 , x1 16 , x2 12
Solution:
Substitute in the given equation by the given values of x to get the table:
x 0 1 1
6 2
y 0 1 1
2
( x x1 )( x x2 ) ( x x0 )( x x2 ) ( x x0 )( x x1 )
y P2 ( x) y0 y1 y2
( x0 x1 )( x0 x2 ) ( x1 x0 )( x1 x2 ) ( x2 x0 )( x2 x1 )
( x 16 )( x 12 ) 1 ( x 0)( x 12 ) ( x 0)( x 16 )
y P2 ( x) 0 2 1
(0 16 )(0 12 ) ( 16 0)( 16 12 ) ( 12 0)( 12 16 )
9 x x 1 6 x x 1 3x 2 3.5 x
2 6
Example 3. Fit the points (0,0) , (1,2) , (2,3) , (3,5) to a third degree polynomial
(rational function).
1 3 19
x 1.5 x 2 x
3 6
Example 4. Use Lagrange’s formula to find the rational function used to evaluate y and
hence evaluate y 2 that fits the points given in the following table:
x 1 3 4 6
Solution: y -7 5 8 14
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 )
y P3 ( x) y0 y1
( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x x3 )
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 )
y2 y3
( x2 x0 )( x2 x1 )( x2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 )
Page 3 of 12
( x 3)( x 4)( x 6) ( x 1)( x 4)( x 6)
y 7 5
(1 3)(1 4)(1 6) (3 1)(3 4)(3 6)
Example 5. Use Lagrange’s formula to obtain P x , P 0.5 , and P 3.2 that fit the following
readings:
x 0 1 2 3
Solution: y 0 1 8 28
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 )
y P3 ( x) y0 y1
( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x x3 )
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 )
y2 y3
( x2 x0 )( x2 x1 )( x2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 )
( x 1)( x 2)( x 3) ( x 0)( x 2)( x 3)
y 0 1
(0 1)(0 2)(0 3) (1 0)(1 2)(1 3)
Example 6. Use Lagrange’s formula to get y at x 6 ,and y at x 2.5 that fit the
following data:
x 3 5 8 9
Solution: y 2 1 5 7
Page 4 of 12
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 )
y P3 ( x) y0 y1
( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x x3 )
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 )
y2 y3
( x2 x0 )( x2 x1 )( x2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 )
( x 5)( x 8)( x 9) ( x 3)( x 8)( x 9)
y 2 1
(3 5)(3 8)(3 9) (5 3)(5 8)(5 9)
Example 7. Calculate the approximate value of the real root of the equation:
x 3 5x 5 0
Solution:
Since the root is the value of x at which y =0.
Since the equation is of degree three, so, the rational function is also of degree three, i.e.
contains four constants, so, we form a table contains four points , around the required root,
satisfy the equation y x 3 5 x 5
Suppose the table is in the form
x -1 0 1 2
y -11 -5 1 13
To evaluate x use the formula:
Page 5 of 12
( y y1 )( y y2 )( y y3 ) ( y y0 )( y y2 )( y y3 )
x x0 x1
( y0 y1 )( y0 y2 )( y0 y3 ) ( y1 y0 )( y1 y2 )( y1 y3 )
( y y0 )( y y1 )( y y3 ) ( y y0 )( y y1 )( y y2 )
x2 x3
( y2 y0 )( y2 y1 )( y2 y3 ) ( y3 y0 )( y3 y1 )( y3 y2 )
(0 5)(0 1)(0 13) (0 11)(0 1)(0 13)
x 1 0
(11 5)(11 1)(11 13) (5 11)(5 1)(5 13)
x0 f [ x0 ]
f [ x1 ] f [ x0 ]
f [ x0 , x1 ]
x1 x0
f [ x1, x2 ] f [ x0 , x1 ]
x1 f [ x1] f [ x0 , x1 , x2 ]
x2 x0
f [ x2 ] f [ x1 ] f [ x1 , x 2 , x3 ] f [ x 0 x1 , x2 ]
f [ x1 , x2 ] f [ x0 , x1 , x 2 , x3 ]
x2 x1 x3 x0
f [ x2 , x3 ] f [ x1 , x2 ]
x2 f [ x2 ] f [ x1 , x2 , x3 ]
x3 x1
f [ x3 ] f [ x2 ] f [ x 2 , x3 , x 4 ] f [ x1 , x2 , x3 ]
f [ x2 , x3 ] f [ x1 , x 2 , x3 , x 4 ]
x2 x1 x 4 x1
.
.
.
.
xn f [ xn ]
Example 1. For the points (0,0) , (1,2) , (2,3) , (3,5) obtain a third degree polynomial
Solution:
0 a0 0
Page 7 of 12
20
a1 f [ x0 , x1 ] 2
1 0
1 2 1
1 2 a 2 f [ x0 , x1 , x2 ]
20 2
1 1
3 2 1
f [ x1 , x2 ] 1 a3 f [ x0 , x1 , x 2 , x3 ] 2 2
2 1 30 3
2 1 1
2 3 f [ x1 , x2 , x3 ]
3 1 2
53
f [ x2 , x3 ] 2
32
3 5
Example 3. Find the value of f 2 and the function with least degree (the rational function)
for the following readings:
Page 8 of 12
x -1.0 0.0 0.5 1.0 2.5 3.0
y 3.0 -2.0 -0.375 3.0 16.125 19.0
Solution:
-1 3.0
-5.0
0.0 -2.0 5.5
3.25 -1.0
0.5 -0.375 3.5 0
6.75 -1.0 0
1.0 3.0 1.0 0
8.75 -1.0
2.5 16.125 -1.5
5.75
3.0 19.0
from which it follows that the polynomial is
P3 ( x) a0 a1 ( x x0 ) a2 ( x x0 )( x x1 ) a3 ( x x0 )( x x1 )( x x2 )
P3 ( x ) 3 5( x 1) 5.5( x 1)( x 0) 1( x 1)( x 0)( x 0.5)
x 3 5x 2 x 2
3 2
f 2 2 52 2 2 12
Example 4. Find the value of log 4.01 from the following table:
X 4.0002 4.0104 4.0232 4.0294
Y 0.6020817 0.6031877 0.6045716 0.6052404
Solution:
4.0002 0.6020817
1.08431
4.0104 0.6031877 -0.013652
1.08117 0.024144
4.0232 0.6045716 -0.012947
1.07871
4.0294 0.6052404
from which it follows that the polynomial is
P3 ( x) a0 a1 ( x x0 ) a2 ( x x0 )( x x1 ) a3 ( x x0 )( x x1 )( x x2 )
P3 ( x ) 0.6020817 1.08431( x 4.0002) 0.0136521( x 4.0002)( x 4.0104)
0.024144( x 4.0002)( x 4.0104)( x 4.029)
f ( 4.01) 0.6020817 1.08431( 4.01 4.0002) 0.0136521( 4.01 4.0002)( 4.01 4.0104)
0.024144( 4.01 4.0002)( 4.01 4.0104)( 4.01 4.029)
f ( 4.01)
Page 9 of 12
Example 5. Find the value of y 0.5, y 3.2 using the data in the following table:
x 0 1 2 3
y 0 1 8 28
Solution:
0 0
1
1 1 3
7
7 6
2 8 6.5
20
3 28
from which it follows that the polynomial is
P3 ( x) a0 a1 ( x x0 ) a2 ( x x0 )( x x1 ) a3 ( x x0 )( x x1 )( x x2 )
7
P3 ( x ) 0 1( x 0) 3( x 0)( x 1) ( x 0)( x 1)( x 2)
6
7 1 1
y ( x) x 3 x 2 x
6 2 3
7 1 1
y (0.5) 0.53 0.52 0.5 0.18749997
6 2 3
Example 6. Form the interpolation polynomial for the function y f x for the data in the
given table using the general Newton’s formula, then use it to get the value of f 3.7608 .
X 0 2.5069 5.0154 7.5277
Y 0.3989423 0.39888169 0.3984408 0.398138
Solution:
0 0.3989423
-0.00005
2.5069 0.39888169 -0.0000199
-0.0001499 0.0
5.0154 0.3984408 -0.0000199
-0.0002496
7.5277 0.398138
from which it follows that the polynomial is
P2 ( x) a0 a1 ( x x0 ) a2 ( x x0 )( x x1 )
P2 ( x ) 0.3989423 0.00005( x 0) 0.0000 ( x 0)( x 2.5069 )
y ( x) 1.99 10 5 x 2 1.1269 10 7 x 0.3989423
y (3.7608) 1.99 10 5 3.76082 1.1269 10 7 3.7608 0.3989423
0.3986604
Page 10 of 12
Example 7. Use Newton’s interpolation general formula to get the value of y at x 6
from the following set of data.
x 2 4 5 7 10
y 3 1 5 6 15
Solution:
2 3
-1
5
4 1 3
4 - 17
30
19
5 5 - 76 180
5
0.5 18
7 6 0.5
3
10 15
Page 11 of 12
P2 ( x ) a0 a1 ( x x0 ) a2 ( x x0 )( x x1 )
Exercises:
1. Use Lagrange interpolation to fit a fourth-degree polynomial to the points
(1,0.765) (1.3,0.62) (1.6,0.455) (1.9,0.281) (2.2,0.11)
2. Use the divided-difference to fit a third-degree polynomial to the points
(-1,0.22) (-0.5,0.62) (0,0.55) (0.5,0.35)
3. Use Lagrange interpolation to find an approximate value for cos 0.75 if
cos 0.733 0.7432 cos 0.803 0.6946
++++++++++++++++++++++++++++++++++++++++++
Page 12 of 12