Vous êtes sur la page 1sur 23

Lagrange Interpolating Polynomials

 A polynomial of degree one that passes


through the distinct point (x0,y0) and (x1,
y1) is equal to approximating a function
f(x0) = y0 and f(x1) = y1 by means of first-
degree polynomial interpolation.
 The function is defined as

x  x1 x  x0
L0 ( x)  
L1 ( x) and
x0  x1 x1  x0
Lagrange Interpolating Polynomials
 The linear Lagrange Interpolating
Polynomial through (x0, y0) and (x1, y1) is
P ( x)  L0 ( x) f ( x0 )  L1 ( x) f ( x1 )
x  x1 x  x0
P ( x)  f ( x0 )  f ( x1 )
x0  x1 x1  x0
 Note that
L0 ( x0 )  1, L0 ( x1 )  0, L1 ( x0 )  0, L1 ( x1 )  1

 This implies that


P( x0 )  1  f ( x0 )  0  f ( x1 )  f ( x0 )  y0
P( x1 )  0  f ( x0 )  1  f ( x1 )  f ( x1 )  y1

P is the unique polynomial of degree at


Lagrange Interpolating Polynomials
 Example: Determine the Lagrange
interpolating polynomial that passes
through the points (2,4) and (5,1)
x  x1 x 5 1
L0 ( x )     ( x  5)
x0  x1 25 3
x  x1 x2 1
L1 ( x )    ( x  2)
x0  x1 52 3

1 1
P( x)   ( x  5)  4  ( x  2)  1
3 3
P( x)   x  6
Lagrange Interpolating Polynomials
Example:
The graph of y = P(x) is shown in the figure
6

3
y = P(x) = - x + 6
2

0
1 2 3 4 5
Lagrange Interpolating Polynomials
 If x0, x1,…xn are n+1 distinct numbers and
f is a function whose values are given at
these numbers, then a unique polynomial
P(x) of degree at most n exist with
f ( xk )  P( xk )
for k = 0,1,…n

 The polynomial is given by


P ( x)  Ln , 0 ( x) f ( x0 )  ...  Ln , n ( x ) f ( xn )
n
P( x)  
k 0
f ( xk ) Ln , k ( x)
Lagrange Interpolating Polynomials
 Where
( x  x0 )( x  x1 )...( x  xk 1 )( x  xk 1 )...( x  xn )
Ln ,k ( x) 
( xk  x0 )( xk  x1 )...( xk  xk 1 )( xk  xk 1 )...( xk  xn )
n
x  xi
Ln ,k ( x)  
i  0 xk  xi
ik

Lk (x)
or Ln,k (x) can simply be written as
when there is no confusion as to its
degree
Lagrange Interpolating Polynomials
 Example:
a.) Use the number x0 = 2, x1 = 2.75 and x2
= 4 to find the second Lagrange
Interpolating polynomial for f(x) = 1/x
b.) use this polynomial to approximate f(3)
L0 =
( x)  1/3
( x  2.75)( x  4) 2
 ( x  2.75)( x  4)
( 2  2.75)( 2  4) 3
( x  2)( x  4) 16
L1 ( x )   ( x  2)( x  4)
( 2.75  2)( 2.75  4) 15
( x  2)( x  2.75) 2
L2 ( x )   ( x  2)( x  2.75)
( 4  2)( 4  2.5) 5
Lagrange Interpolating Polynomials
Also, therefore,
1
f ( x0 )  f (2)  2
2 P( x)   f ( xk ) Lk ( x)
1 4 k 0
f ( x1 )  f (2.75)  
2.75 11 1 2 35 49
1 P( x)  x  x
f ( x2 )  f (4)  22 88 44
4

An approximation to f(3) = 1/3


9 105 49 29
f (3) P (3)      0.32955
22 88 44 88
Lagrange Interpolating Polynomials
EXERCISES:
1. For the given function f(x), let x0 = 0, x1
= 0.6 and x2 = 0.9. Construct
interpolation polynomials of degree at
most one and at most two to
1. f ( x)  f(0.45)
approximate cos x
2. f ( x)  1  x
3. f ( x)  ln( x  1)
4. f ( x)  tan x
Lagrange Interpolating Polynomials
EXERCISES:
2. For the given function f(x), let x0 = 1, x1
= 1.25 and x2 = 1.6. Construct
interpolation polynomials of degree at
most one and at most two to
x
1. f ( x)  sinf(1.4)
approximate
2. f ( x)  x  1
3

3. f ( x)  log 10 (3x  1)
4. f ( x)  e 2 x  x
Data Approximation and Neville’s
Method
Neville’s method overcome the trouble of
the standard Lagrarian polynomial
technique of of determining the degree of
polynomial to use.

For Neville’s method, it is essential to


compute the interpolated value with
polynomials of successie higher degree,
stopping when the successive values are
close together.
Data Approximation and Neville’s
Method
Neville’s method uses the equation
( x  x2 ) * ( f1 )  ( x1  x) * ( f 2 )
f ( x) 
x1  x2

Or in general form, (recursively generating


Lagrange polynomial approximation)
( x  xi ) * Pi 1, j  ( xi 1  x) * Pi , j 1
Pi , j 
xi  j  xi
Data Approximation and Neville’s
Method
Example:
Table below lists values of a function f at
various points. The approximation
requires to interpolate for x = 27.5
x f(x)
10.1 0.17537
22.2 0.37784
32.0 0.52992
41.6 0.66393
50.5 0.63608
Data Approximation and Neville’s
Method
Example:
x Pi0 Pi1 P12 P13 Pi4
10.1 0.17537 0.46653 0.46141 0.46174 0.45754
22.2 0.37784 0.46009 0.46201 0.45198
32.0 0.52992 0.46711 0.40850
41.6 0.66393 0.70805
50.5 0.63608

Error computation: P12 P13 Pi4

-0.00511 0.00033 -0.00420


0.00192 -0.01002
-0.05861
Data Approximation and Neville’s
Method
EXERCISES:
1. Use Neville’s method to obtain the
approximation for Lagrange interpolating
polynomials of degrees one, two and
three to approximate each of the
1
1. f (8following:
.4) 2. f (  )
3
f (8.1)  16.94410
f ( 0.75)  0.07181250
f (8.3)  17.56492
f ( 0.5)  0.02475000
f (8.6)  18.50515
f ( 0.25)  0.33493750
f (8.7)  18.82091
f (0)  1.10100000
Data Approximation and Neville’s
Method
EXERCISES:
2. Use Neville’s method to obtain the
approximation for Lagrange interpolating
polynomials of degrees one, two and
three to approximate each of the
3. f ( 4following:
.3) 4. f (0.25)
f (0)  1 f ( 1)  0.86199480
f (0.25)  1.64872 f ( 0.5)  0.95802009
f (0.5)  2.71828 f (0)  1.0986123
f (0.75)  4.48169 f (0.5)  1.2943767
Divided Differences
 The special standard notation used for
divided differences is
f1  f 0
f x0 , x1    f0
[1]

x1  x0
called the first divided difference between x0 and x1
The function f 2  f1
f x1 , x2    f1
[1]

x2  x1

called the first divided difference between x1 and x2


Divided Differences
 In general,
ft  f s
f xs , xt  
xt  xs
Is the first divided difference between xs and xt
While, the second-and higher-order differences are
defined in terms of lower-order differences
Say, f x1 , x2   f x0 , x1 
f x0 , x1 , x2    f0
[ 2]

x2  x0

Or , f x1 , x2 ,...xn   f x0 , x1 ,...xn 1 


f x0 , x1 ,...xn    f0
[n]

xn  x0
Divided Differences
Divided Differences
 The interpolating polynomial is
Pn ( x)  a0  ( x  x0 )a1  ( x  x0 )( x  x1 )a2  ...
 ( x  x0 )( x  x1 )...( x  xn 1) an
Divided Differences
 Example,
xi fi f[xi,xi+1] f[xi,...xi+2] f[xi,...xi+3] f[xi,...xi+4]
3.2 22.0
8.4000
2.7 17.8 2.856
2.118 -0.528
1.0 14.2 2.012 0.256
6.343 0.0865
4.8 38.3 2.263
16.750
5.6 51.7

The interpolating polynomial of degree 3 at points x0 = 3.2 to x3 = 4.8, is


P3 ( x)  22  8.4( x  3.2)  2.856( x  3.2)( x  2.7)  0.528( x  3.2)( x  2.7)(1.0)
Divided Differences
 EXERCISES
1.Xi f(xi)

1.0 0.765197

1.3 0.6200860

1.6 0.4554022

1.9 0.2818186

2.2 0.1103623

Complete the divided difference table for the data given, and construct the
interpolating polynomial that uses all the data and interpolate x =1.5
Divided Differences
 EXERCISES
2. f(8.4) if f(8.1)=16.94410, f(8.3) = 17.56492,
f(8.6) = 18.50515, f(8.7) = 18.82091

3. f(0.9) if f(0.6) =−0.17694460, f(0.7) = 0.01375227,


f(0.8) = 0.22363362, f(1.0) = 0.65809197

Vous aimerez peut-être aussi