Professional Documents
Culture Documents
DKD
Lagrange’s formula with unequal intervals
• Let y f (x
be)function whose values are
corresponding to
y 0 , y1 , y 2 ,.......... y n
x x0 , x1 , x 2 ,.........
not .necessarily
xn equally spaced.
since there are (n1)
pairs
(x0 , y0 ), (x1, y1), (x2 , y2 ),........
..........
....(
of xn , yof
values n) and x
ywe can represent f (x)
by a polynomial in of x
degree n
DKD
• Let this polynomial be
f (x) A0 (x x1 )(x x2 )..............(x xn ) A1 (x x0 )(x x2 )..............(x xn )
f(x A0() x 1)(x 2). . (x 2 A0() x 1)(x 2). . (x 2 A0() x 1)(x 2). . (x 2)
A2 (x x0 )(x x1 )(x x3 )..............(x xn ) ............ An (x x0 )(x x1 )..............(x xn1 )
DKD
• Putting x xn , y ynwe get
f (xn )
An
(xn x0 )(xn x2 )..............(xn xn1 )
(x x1)(x x2 ).........
.....(x xn ) (x x0 )(x x2 ).........
.....(x xn )
f (x) f (x0 ) f (x1)
(x0 x1)(x0 x2 ).........
.....(x0 xn ) (x1 x0 )(x1 x2 ).........
.....(x1 xn )
(x x0 )(x x1).........
.....(x xn1)
..........
.. f (xn )
(xn x0 )(xn x1).........
.....(xn xn1)
DKD
Problems
Age in 2 5 8 10 12
months
Weight in 4.4 6.2 6.7 7.5 8.7
Kgs
DKD
• Solution: Let x=age of baby(in months)
• f (x=Weight
) (in Kg)
• Then the data is
x 2 5 8 10 12
DKD
• By Lagrange’s, we have,
(x x1)(x x2 ).........
.....(x xn ) (x x0 )(x x2 ).........
.....(x xn )
f (x) f (x0 ) f (x1)
(x0 x1)(x0 x2 ).........
.....(x0 xn ) (x1 x0 )(x1 x2 ).........
.....(x1 xn )
(x x0 )(x x1).........
.....(x xn1)
..........
.. f (xn )
(xn x0 )(xn x1).........
.....(xn xn1)
DKD
Putting x 7
f (7) 6.5kg
DKD
• Ex-2(62 ): Apply Lagrange’s formula to find andf (5)
f (6)given that f (1) 2, f (2) 4, f (3) 8, f (7) 128
and explain why this result differ from those obtain
by f (x) 2x
• Solution: Writing the data in the following table
x 1 2 3 7
f (x) 2 4 8 128
DKD
• By Lagrange’s formula, we have,
DKD
• 2nd Part: But actual values of &f (5) aref (6)
from f (x) 2x
f (5) 25 32
f (6) 26 64
The difference in values of and
f (5) aref (due
6) to the
assumption of as af polynomial,
(x) when it is an exponential
function of the form 2x
DKD
• Ex-4(63): Use Lagrange’s interpolation formula to fit a
polynomial to the data given below
x 0 1 3 4
y -12 0 6 12
DKD
Inverse Interpolation
y
• So far we have been finding the values of corresponding the
certain value of , when a set of values ofxand are
given. x y
The process of estimating the value of x
for a given value of
y inverse interpolation.
is called the
DKD
• We have from Lagrange’s interpolation formula
(x x1)(x x2 )............(x xn ) (x x0 )(x x2 )............(x xn )
y f (x) f (x0 ) f (x1)
(x0 x1)(x0 x2 )..............(x0 xn ) (x1 x0 )(x1 x2 )............(x1 xn )
(x x0 )(x x1)............(x xn1)
............ f (xn )
(xn x0 )(xn x1)............(xn xn1)
• By interchanging x
and y above formula we have
in the
(y y1)(y y2 ).........
...(y yn ) (y y0 )(y y2 ).........
...(y yn )
x x0 x1
(y0 y1)(y0 y2 ).........
.....(y0 yn ) (y1 y0 )(y1 y2 ).........
...(y1 yn )
(y y0 )(y y1).........
...(y yn1)
..........
.. xn
(yn y0 )(yn y1).........
...(yn yn1)
• Which is known Lagrange’s inverse interpolation formula.
DKD
Problems
• Ex-2(66): Given
x 2 5 9 11
y 10 12 15 19
Find x when y 16
Solution:
( y 12)(y 15)(y 19) ( y 10)(y 15)(y 19)
x (2) (5)
(1012)(1015)(1019) (1210)(1215)(1219)
( y 10)(y 12)(y 19) ( y 10)(y 12)(y 15)
(9) (11)
(1510)(1512)(1519) (1910)(1912)(1915)
DKD
• Putting y 16
(1612)(1615)(1619) (1610)(1615)(1619)
x (2) (5)
(1012)(1015)(1019) (1210)(1215)(1219)
(1610)(1612)(1619) (1610)(1612)(1615)
(9) (11)
(1510)(1512)(1519) (1910)(1912)(1915)
• Calculating we get
x 9.97143
DKD
• Ex-2(65): Find a root of the equation ) 0 that
f ( xgiven
f (30) 30, f (34) 13, f (38) 3, f (42) 18
Solution: Writing the above data in the following table
x 30 34 38 42
By Lagrange’syinverse
-30interpolation
-13 3 18
DKD
• Calculating we get x 37 . 2304
• Which is an approximating root of the equation
f ( x) 0
DKD