0% found this document useful (0 votes)
65 views18 pages

4 4 Lagrange-Presentation

The document discusses Lagrange interpolation, a numerical method for estimating values of a polynomial based on known data points. It details the formula derivation, including the calculation of coefficients A0, A1, ..., An, and provides an example of estimating y(4) using given x and y values. The document serves as a comprehensive guide to understanding and applying Lagrange interpolation in numerical methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views18 pages

4 4 Lagrange-Presentation

The document discusses Lagrange interpolation, a numerical method for estimating values of a polynomial based on known data points. It details the formula derivation, including the calculation of coefficients A0, A1, ..., An, and provides an example of estimating y(4) using given x and y values. The document serves as a comprehensive guide to understanding and applying Lagrange interpolation in numerical methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Numerical Methods

Interpolation
å Polynomial Interpolation
å Unequally Spaced Interval
å Lagrange Interpolation

J R Shrestha
January 2024
Lagrange Interpolation: Formula Derivation

Let y(x) takes the values y0 , y1 , y2 , . . . yn corresponding to x = x0 , x1 , x2 , . . . , xn .

1/4
Lagrange Interpolation: Formula Derivation

Let y(x) takes the values y0 , y1 , y2 , . . . yn corresponding to x = x0 , x1 , x2 , . . . , xn .


Let f(x) be a polynomial in x of degree n, of the following form, such that yi = f(xi )∀i:

1/4
Lagrange Interpolation: Formula Derivation

Let y(x) takes the values y0 , y1 , y2 , . . . yn corresponding to x = x0 , x1 , x2 , . . . , xn .


Let f(x) be a polynomial in x of degree n, of the following form, such that yi = f(xi )∀i:

f(x) = A0 (x − x1 )(x − x2 )(x − x3 ) . . . (x − xn )


+ A1 (x − x0 )(x − x2 )(x − x3 ) . . . (x − xn )
+ A2 (x − x0 )(x − x1 )(x − x3 ) . . . (x − xn ) (1)
+ ··· ··· ···
+ An (x − x0 )(x − x1 )(x − x2 ) . . . (x − xn−1 )

1/4
Lagrange Interpolation: Formula Derivation

Let y(x) takes the values y0 , y1 , y2 , . . . yn corresponding to x = x0 , x1 , x2 , . . . , xn .


Let f(x) be a polynomial in x of degree n, of the following form, such that yi = f(xi )∀i:

f(x) = A0 (x − x1 )(x − x2 )(x − x3 ) . . . (x − xn )


+ A1 (x − x0 )(x − x2 )(x − x3 ) . . . (x − xn )
+ A2 (x − x0 )(x − x1 )(x − x3 ) . . . (x − xn ) (1)
+ ··· ··· ···
+ An (x − x0 )(x − x1 )(x − x2 ) . . . (x − xn−1 )

Substituting (x, y) = (x0 , y0 ), (x1 , y1 ), (x2 , y2 ), . . . , (xn , yn ) successively in equation 1:

1/4
Lagrange Interpolation: Formula Derivation

Let y(x) takes the values y0 , y1 , y2 , . . . yn corresponding to x = x0 , x1 , x2 , . . . , xn .


Let f(x) be a polynomial in x of degree n, of the following form, such that yi = f(xi )∀i:

f(x) = A0 (x − x1 )(x − x2 )(x − x3 ) . . . (x − xn )


+ A1 (x − x0 )(x − x2 )(x − x3 ) . . . (x − xn )
+ A2 (x − x0 )(x − x1 )(x − x3 ) . . . (x − xn ) (1)
+ ··· ··· ···
+ An (x − x0 )(x − x1 )(x − x2 ) . . . (x − xn−1 )

Substituting (x, y) = (x0 , y0 ), (x1 , y1 ), (x2 , y2 ), . . . , (xn , yn ) successively in equation 1:


y0 = A0 (x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn )
y1 = A1 (x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn )
y2 = A2 (x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )
··· ··· ···
1/4
yn = An (xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )
From these: A0 = y0 / [(x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn )]
A1 = y1 / [(x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn )]
A2 = y2 / [(x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )]
··· ··· ···
An = yn / [(xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )]

2/4
From these: A0 = y0 / [(x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn )]
A1 = y1 / [(x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn )]
A2 = y2 / [(x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )]
··· ··· ···
An = yn / [(xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )]

Finally, substituting the values of A0 , A1 , ... An in equation 1:

2/4
From these: A0 = y0 / [(x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn )]
A1 = y1 / [(x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn )]
A2 = y2 / [(x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )]
··· ··· ···
An = yn / [(xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )]

Finally, substituting the values of A0 , A1 , ... An in equation 1:

(x − x1 )(x − x2 )(x − x3 ) . . . (x − xn )
f(x) = × y0
(x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn )
(x − x0 )(x − x2 )(x − x3 ) . . . (x − xn )
+ × y1
(x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn )
(x − x0 )(x − x1 )(x − x3 ) . . . (x − xn ) (2)
+ × y2
(x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )
+ ··· ··· ···
(x − x0 )(x − x1 )(x − x2 ) . . . (x − xn−1 )
+ × yn
(xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )
2/4
From these: A0 = y0 / [(x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn )]
A1 = y1 / [(x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn )]
A2 = y2 / [(x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )]
··· ··· ···
An = yn / [(xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )]

Finally, substituting the values of A0 , A1 , ... An in equation 1: In compact form:

(x − x1 )(x − x2 )(x − x3 ) . . . (x − xn )
f(x) = × y0
(x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn )
(x − x0 )(x − x2 )(x − x3 ) . . . (x − xn )
+ × y1
(x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn )
(x − x0 )(x − x1 )(x − x3 ) . . . (x − xn ) (2)
+ × y2
(x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )
+ ··· ··· ···
(x − x0 )(x − x1 )(x − x2 ) . . . (x − xn−1 )
+ × yn
(xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )
2/4
From these: A0 = y0 / [(x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn )]
A1 = y1 / [(x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn )]
A2 = y2 / [(x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )]
··· ··· ···
An = yn / [(xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )]

Finally, substituting the values of A0 , A1 , ... An in equation 1: In compact form:

(x − x1 )(x − x2 )(x − x3 ) . . . (x − xn )
f(x) = × y0
(x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn ) ∑
n
n (
∏ x−x
)
(x − x0 )(x − x2 )(x − x3 ) . . . (x − xn ) j
+ × y1 f(x) = yi ×
(x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn ) xi − xj
j=0
(x − x0 )(x − x1 )(x − x3 ) . . . (x − xn ) (2) i=0
+ × y2 j̸=i
(x2 − x0 )(x2 − x1 )(x2 − x3 ) . . . (x2 − xn )
+ ··· ··· ···
(x − x0 )(x − x1 )(x − x2 ) . . . (x − xn−1 )
+ × yn
(xn − x0 )(xn − x1 )(xn − x2 ) . . . (xn − xn−1 )
2/4
Example

# Estimate y(4) from the following data using Lagrange’s Interpolation formula.
x 1 2 3 5 6 8
y 2.15 5.20 6.05 4.75 4.40 8.80

3/4
Example

# Estimate y(4) from the following data using Lagrange’s Interpolation formula.
x 1 2 3 5 6 8
y 2.15 5.20 6.05 4.75 4.40 8.80

Solution: ∵ n = 5, Lagrange’s interpolation formula is:

3/4
Example

# Estimate y(4) from the following data using Lagrange’s Interpolation formula.
x 1 2 3 5 6 8
y 2.15 5.20 6.05 4.75 4.40 8.80

Solution: ∵ n = 5, Lagrange’s interpolation formula is:


(x − x1 )(x − x2 )(x − x3 )(x − x4 )(x − x5 )
f(x) = × y0
(x0 − x1 )(x0 − x2 )(x0 − x3 )(x0 − x4 )(x0 − x5 )
(x − x0 )(x − x2 )(x − x3 )(x − x4 )(x − x5 )
+ × y1
(x1 − x0 )(x1 − x2 )(x1 − x3 )(x1 − x4 )(x1 − x5 )
(x − x0 )(x − x1 )(x − x3 )(x − x4 )(x − x5 )
+ × y2
(x2 − x0 )(x2 − x1 )(x2 − x3 )(x2 − x4 )(x2 − x5 )
(x − x0 )(x − x1 )(x − x2 )(x − x4 )(x − x5 )
+ × y3
(x3 − x0 )(x3 − x1 )(x3 − x2 )(x3 − x4 )(x3 − x5 )
(x − x0 )(x − x1 )(x − x2 )(x − x3 )(x − x5 )
+ × y4
(x4 − x0 )(x4 − x1 )(x4 − x2 )(x4 − x3 )(x4 − x5 )
(x − x0 )(x − x1 )(x − x2 )(x − x3 )(x − x4 )
+ × y5
(x5 − x0 )(x5 − x1 )(x5 − x2 )(x5 − x3 )(x5 − x4 ) 3/4
x x0 = 1 x1 = 2 x2 = 3 x3 = 5 x4 = 6 x5 = 8
y y0 = 2.15 y1 = 5.20 y2 = 6.05 y3 = 4.75 y4 = 4.40 y5 = 8.80

4/4
x x0 = 1 x1 = 2 x2 = 3 x3 = 5 x4 = 6 x5 = 8
y y0 = 2.15 y1 = 5.20 y2 = 6.05 y3 = 4.75 y4 = 4.40 y5 = 8.80
(4 − 2)(4 − 3)(4 − 5)(4 − 6)(4 − 8)
∴ f(4) = × 2.15
(1 − 2)(1 − 3)(1 − 5)(1 − 6)(1 − 8)
(4 − 1)(4 − 3)(4 − 5)(4 − 6)(4 − 8)
+ × 5.20
(2 − 1)(2 − 3)(2 − 5)(2 − 6)(2 − 8)
(4 − 1)(4 − 2)(4 − 5)(4 − 6)(4 − 8)
+ × 6.05
(3 − 1)(3 − 2)(3 − 5)(3 − 6)(3 − 8)
(4 − 1)(4 − 2)(4 − 3)(4 − 6)(4 − 8)
+ × 4.75
(5 − 1)(5 − 2)(5 − 3)(5 − 6)(5 − 8)
(4 − 1)(4 − 2)(4 − 3)(4 − 5)(4 − 8)
+ × 4.40
(6 − 1)(6 − 2)(6 − 3)(6 − 5)(6 − 8)
(4 − 1)(4 − 2)(4 − 3)(4 − 5)(4 − 6)
+ × 8.80
(8 − 1)(8 − 2)(8 − 3)(8 − 5)(8 − 6)

4/4
x x0 = 1 x1 = 2 x2 = 3 x3 = 5 x4 = 6 x5 = 8
y y0 = 2.15 y1 = 5.20 y2 = 6.05 y3 = 4.75 y4 = 4.40 y5 = 8.80
(4 − 2)(4 − 3)(4 − 5)(4 − 6)(4 − 8) (2)(1)(−1)(−2)(−4)
∴ f(4) = × 2.15 = × 2.15
(1 − 2)(1 − 3)(1 − 5)(1 − 6)(1 − 8) (−1)(−2)(−4)(−5)(−7)
(4 − 1)(4 − 3)(4 − 5)(4 − 6)(4 − 8) (3)(1)(−1)(−2)(−4)
+ × 5.20 + × 5.20
(2 − 1)(2 − 3)(2 − 5)(2 − 6)(2 − 8) (1)(−1)(−3)(−4)(−6)
(4 − 1)(4 − 2)(4 − 5)(4 − 6)(4 − 8) (3)(2)(−1)(−2)(−4)
+ × 6.05 + × 6.05
(3 − 1)(3 − 2)(3 − 5)(3 − 6)(3 − 8) (2)(1)(−2)(−3)(−5)
(4 − 1)(4 − 2)(4 − 3)(4 − 6)(4 − 8) (3)(2)(1)(−2)(−4)
+ × 4.75 + × 4.75
(5 − 1)(5 − 2)(5 − 3)(5 − 6)(5 − 8) (4)(3)(2)(−1)(−3)
(4 − 1)(4 − 2)(4 − 3)(4 − 5)(4 − 8) (3)(2)(1)(−1)(−4)
+ × 4.40 + × 4.40
(6 − 1)(6 − 2)(6 − 3)(6 − 5)(6 − 8) (5)(4)(3)(1)(−2)
(4 − 1)(4 − 2)(4 − 3)(4 − 5)(4 − 6) (3)(2)(1)(−1)(−2)
+ × 8.80 + × 8.80
(8 − 1)(8 − 2)(8 − 3)(8 − 5)(8 − 6) (7)(6)(5)(3)(2)

4/4
x x0 = 1 x1 = 2 x2 = 3 x3 = 5 x4 = 6 x5 = 8
y y0 = 2.15 y1 = 5.20 y2 = 6.05 y3 = 4.75 y4 = 4.40 y5 = 8.80
(4 − 2)(4 − 3)(4 − 5)(4 − 6)(4 − 8) (2)(1)(−1)(−2)(−4)
∴ f(4) = × 2.15 = × 2.15
(1 − 2)(1 − 3)(1 − 5)(1 − 6)(1 − 8) (−1)(−2)(−4)(−5)(−7)
(4 − 1)(4 − 3)(4 − 5)(4 − 6)(4 − 8) (3)(1)(−1)(−2)(−4)
+ × 5.20 + × 5.20
(2 − 1)(2 − 3)(2 − 5)(2 − 6)(2 − 8) (1)(−1)(−3)(−4)(−6)
(4 − 1)(4 − 2)(4 − 5)(4 − 6)(4 − 8) (3)(2)(−1)(−2)(−4)
+ × 6.05 + × 6.05
(3 − 1)(3 − 2)(3 − 5)(3 − 6)(3 − 8) (2)(1)(−2)(−3)(−5)
(4 − 1)(4 − 2)(4 − 3)(4 − 6)(4 − 8) (3)(2)(1)(−2)(−4)
+ × 4.75 + × 4.75
(5 − 1)(5 − 2)(5 − 3)(5 − 6)(5 − 8) (4)(3)(2)(−1)(−3)
(4 − 1)(4 − 2)(4 − 3)(4 − 5)(4 − 8) (3)(2)(1)(−1)(−4)
+ × 4.40 + × 4.40
(6 − 1)(6 − 2)(6 − 3)(6 − 5)(6 − 8) (5)(4)(3)(1)(−2)
(4 − 1)(4 − 2)(4 − 3)(4 − 5)(4 − 6) (3)(2)(1)(−1)(−2)
+ × 8.80 + × 8.80
(8 − 1)(8 − 2)(8 − 3)(8 − 5)(8 − 6) (7)(6)(5)(3)(2)
( ) ( ) ( ) ( ) ( ) ( )
2 1 4 2 1 1
= 2.15 − 5.20 + 6.05 + 4.75 − 4.40 + 8.80
35 3 5 3 5 105
= 5.6
4/4

You might also like