0% found this document useful (0 votes)
12 views5 pages

Lab 5

This report discusses Lagrange's Interpolation Formula, a method for finding a polynomial that fits a given set of data points, providing an exact fit without requiring divided differences. It outlines the methodology for calculating the Lagrange basis polynomials and constructing the interpolation polynomial, along with an example of its application. The report also highlights the strengths and weaknesses of the method, concluding that while it is effective for small to moderate datasets, it can be computationally expensive and numerically unstable for larger datasets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

Lab 5

This report discusses Lagrange's Interpolation Formula, a method for finding a polynomial that fits a given set of data points, providing an exact fit without requiring divided differences. It outlines the methodology for calculating the Lagrange basis polynomials and constructing the interpolation polynomial, along with an example of its application. The report also highlights the strengths and weaknesses of the method, concluding that while it is effective for small to moderate datasets, it can be computationally expensive and numerically unstable for larger datasets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Report On: Lagrange’s Interpolation Formula.

Objectives:
 The objective of this lab is to understand and apply Lagrange’s Interpolation to
find the polynomial that fits a given set of data points.

 To understand the concept and application of Lagrange’s Interpolation.

 To learn how to use Lagrange’s Interpolation for numerical approximation.


 To apply Lagrange’s Interpolation in solving practical problems in various fields like
engineering, physics, and computer science.

Introduction:
Lagrange’s Interpolation is a popular method of polynomial interpolation that is used
to estimate the values of a function given a set of known data points. It is named after
the mathematician Joseph-Louis Lagrange. The interpolation polynomial passes
through all the given data points exactly, providing an exact fit. This method is
particularly useful when the data points are not uniformly spaced, as it does not
require the calculation of divided differences like Newton's method.
The Lagrange interpolation polynomial P(x) is expressed as:

n
P ( x ) = ∑ y i . Li ( x )
i=0

Where:
n
x−x j
Li ( x ) = ∏
j=0 x i−x j
j ≠i

Here, Li(x) is the Lagrange basis polynomial, and xi and yi are the known data points.
This method is particularly useful for numerical computation where a functional form
is unknown but certain discrete data points are provided.

Methodology:
Given Data:
Start with a set of known data points (x0,y0), (x1,y1)……….(xn-1,yn-1).
Formulation:

1|Page
n −1
x−xj
Compute the Lagrange basis polynomials Li(x) for each i using: Li(x) = ∏
j=0 xi−xj
j≠i

Polynomial Construction:
Combine the basis polynomials weighted by yi to form P(x):
n −1

P(x) =∑ yiLi(x)
i=0

Example:
Using Lagrange’s interpolation formula, find y (35) from the following table:

x 10 25 48 53
y 5 15 60 85

Solve: Here the intervals are unequal. So, we will use Lagrange’s Interpolation Formula to
find the y (35) where, x=35. By Lagrange’s Interpolation Formula we have,

(x−x 1)(x−x 2 )(x−x 3) (x−x 0 )(x−x 2)( x−x3 )


y=f(x)= ( x −x )(x −x )(x −x ) y0+ ( x −x )(x −x )(x −x ) y1+
0 1 0 2 0 3 1 0 1 2 1 3

(x −x0 )(x−x 1)( x−x3 ) (x −x 0)(x−x 1 )(x−x 2)


……………………. ( x −x y 2+
( x 3−x 0 )(x 3−x 1)(x 3−x 2) y3
2 0 )(x 2−x1 )(x 2−x 3)

Here, x=35 (Because, y (x)= y (10))

x 0=10 , x 1=25 , x2=48 , x3 =53 y 0=5 , y 1=15 , y 2=60 , y 3=85

(x−x 1)(x−x 2 )(x−x 3) (x−x 0 )(x−x 2)( x−x3 )


y=f(x)= ( x −x )(x −x )(x −x ) y0+ ( x −x )(x −x )(x −x ) y1+
0 1 0 2 0 3 1 0 1 2 1 3

(x −x0 )(x−x 1)( x−x3 ) (x −x 0)(x−x 1 )(x−x 2)


……………………. ( x −x y 2+
( x 3−x 0 )(x 3−x 1)(x 3−x 2) y3
2 0 )(x 2−x1 )(x 2−x 3)

( x−25 ) ( x−48 )( x−53 ) ( x−10 ) ( x−48 )( x−53 )


= ( 5) + ( 15 )
( 10−25 )( 10−48 ) ( 10−53 ) ( 25−10 )( 25−48 )( 25−53 )

2|Page
( x−10 )( x−25 )( x−53 ) (x−10)(x−25)(x −48)
… … … … … … … …+ ( 60 ) + (85)
( 48−10 )( 48−25 )( 48−53 ) (53−10)(53−25)(53−48)

Put x = 35.

( 35−25 )( 35−48 ) ( 35−53 ) ( 35−10 )( 35−48 )( 35−53 ) ( 35−10 )( 35−25 ) (35−53 ) ( 35−10 )(
¿ ( 5) + ( 15 ) + ( 60 )+ … .
( 10−25 )( 10−48 ) ( 10−53 ) ( 25−10 )( 25−48 )( 25−53 ) ( 48−10 ) ( 48−25 ) ( 48−53 ) ( 53−10 )(

(85)

( 10 ) (−13 ) (−18 ) (25)(−13)(−18) (25)(10)(−18) (25)(10)(−13)


= (5)+ (15)+ (60)+ ( 85)
(−15 ) (−38 ) (−43 ) (15)(−23)(−28) (38)(23)(−5) (38)(28)(5)

−390 2925 27000 27625


= + + −
817 322 437 532

= 24.50269

Implementation:
C code:

3|Page
Output:

Result Analysis:
Strengths:
 Exact Fit:
Lagrange interpolation guarantees that the interpolated polynomial will pass
through all the provided points.
 Formulation:
The formula uses basis polynomials, making it straightforward to construct the
interpolating polynomial without solving a system of equations.
 Applicable:
It can handle any set of distinct data points in 1D.
Weaknesses:
 High Computational Complexity:
As the number of points increases, the computation of the Lagrange basis
polynomials Li(x) becomes expensive, especially for large datasets.
 No Reusability:
For equally spaced points, the interpolating polynomial can exhibit large
oscillations, particularly at the boundaries (endpoints of the interval).
 Numerical Instability:
For large datasets, the method may suffer from numerical instability due to the
involvement of high-degree polynomials.
4|Page
Conclusion:

Lagrange’s interpolation is a powerful method for constructing a polynomial that


passes through a given set of points. It provides an exact fit to the data points and
enables interpolation for intermediate values. While computationally expensive for
larger datasets due to the factorial growth of operations, it is highly effective for small
to moderate-sized datasets. The experiment successfully implemented Lagrange’s
method, verified its accuracy, and demonstrated its utility in practical applications.

References:

1. K. E. Atkinson, An Introduction to Numerical Analysis, 2nd Edition, John Wiley &


Sons, 1989.
2. Lagrange Interpolation on Wikipedia.

5|Page

You might also like