0% found this document useful (0 votes)
2 views

Unit 2 Interpolation P2

The document discusses interpolation methods using Lagrange and Newton's forms of interpolating polynomials to estimate values of y at intermediate x-values not included in a dataset. It explains the mathematical foundations of both methods, including the construction of basis polynomials for Lagrange and the use of divided differences for Newton. An algorithm is provided to implement these interpolation methods programmatically.

Uploaded by

uanuj040
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)
2 views

Unit 2 Interpolation P2

The document discusses interpolation methods using Lagrange and Newton's forms of interpolating polynomials to estimate values of y at intermediate x-values not included in a dataset. It explains the mathematical foundations of both methods, including the construction of basis polynomials for Lagrange and the use of divided differences for Newton. An algorithm is provided to implement these interpolation methods programmatically.

Uploaded by

uanuj040
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/ 2

Unit 2:- Interpolation:

Problem 2:- Given a dataset (x, y) corresponding to a physics problem, use Lagrange and
Newton’s forms of interpolating polynomials and compare. Determine the value of y at an

intermediate value of x not included in the data set. This may be done with equally spaced and

non-equally spaced x-values.

Theory:-

1. Lagrange Interpolating Polynomial

The Lagrange interpolating polynomial creates an interpolation polynomial by combining

basis polynomials that pass through each data point individually. The polynomial has the general

form:

P(x) = ∑ yi . Li(x) ; i = 0 to n.

where:

 yi is the y-value at xi,


 Li(x) are the Lagrange basis polynomials, defined as:

Li(x) = ∏ [(x – xj )/ (xi – xj)] ; 0 < j < n and j ≠ i


Explanation of Lagrange Basis Polynomials:

Each Li(x) polynomial equals 1 at x=xi and 0 at every other xj in the dataset. The entire

polynomial, P(x) is a sum of these basis polynomials, each scaled by the corresponding yi value.

This construction ensures that P(x) passes through all data points (xi,yi).

2. Newton Interpolating Polynomial

The Newton interpolating polynomial constructs an interpolation polynomial in a form that’s

easier to update if additional points are added. It uses divided differences, which capture the

relationships between the data points more flexibly than the Lagrange basis.
The polynomial can be expressed as:

P(x) = a0 + a1(x−x0) + a2(x−x0)(x−x1) + ⋯ + an(x−x0)(x−x1)…(x−xn-1)

where:

 a0 = f[x0] is the function value at x0,


 a1 = f[x0,x1] is the first divided difference between x0 and x1,
 a2 = f[x0,x1,x2] is the second divided difference, and so on.

Divided Differences:

The divided differences are defined recursively:

 First divided difference: f[xi,xi+1]


= f(xi+1) − f(xi) / xi+1 – xi.
 Second divided difference: f[xi,xi+1,xi+2] = f[xi+1,xi+2] − f[xi,xi+1] / xi+2 – xi.
 And so on, building up to the n-th divided difference.

Algorithm:
1. Import necessary libraries.
2. Define the Lagrange Interpolation Function.
3. Put the (x_values, y_values, x) in it.
4. Now Call Newton Interpolation Function.
5. Put the (x_values, y_values) in it.
6. Lastly print the output.

You might also like