You are on page 1of 6

PROJECT:-3

LAGRANGE INTERPOLATION FORMULA

PRESENTED BY :-
NAME – V SAI MANASA
REG.NO - 210101120040
SEC - A
BRANCH :-COMPUTER SCIENCE AND ENGINEERING

GUIDED BY :- Dr. BANITA MALLIK


Lagrange interpolation formula :-

• The Lagrange interpolation formula is used to construct an nth-degree


polynomial that passes through n given data points. Given a set of n data
points (x0, y0), (x1, y1), ..., (xn-1, yn-1) , then
• y = l0(x)y0 + l1(x)y1 + l2(x)y2 + - - - - - + ln(x)yn
• Lagrange’s interpolation formula canbe used to split the given function as
sum of partial fractions.

• In other words, the ith Lagrange basis polynomial is equal to 1 at xi and 0 at


all other data points. The Lagrange interpolation polynomial is simply a
weighted sum of these basis polynomials, where the weights are the yi values.
• It is applicable to equal and unequal sub-intervals.
To find out the value of a given function at an interior point on an unequal
interval using Lagrange interpolation polynomial, you can follow these steps:

• Determine the unequal interval: The interval can be defined by its endpoints, say
a and b, where a < b.
• Choose the interior point: Let x be the interior point, where a < x < b.
• Select the number of interpolation points: Determine the number of
interpolation points, n, that you want to use. The greater the number of points,
the more accurate the interpolation polynomial will be.
• Choose the interpolation points: Choose n points, {x0, x1, ..., xn-1}, where a <
x0 < x1 < ... < xn-1 < b. The interpolation points are typically chosen to be
evenly spaced, but they can also be chosen in other ways.
• Compute the Lagrange interpolation polynomial
• Evaluate the interpolation polynomial at x: Once you have computed the
Lagrange interpolation polynomial, simply evaluate it at x to get the value of the
function at the interior point.
Let's work through an example. Suppose we have the following four data points:

(x1, y1) = (0, 1)


(x2, y2) = (1, 3)
(x3, y3) = (3, 2)
(x4, y4) = (4, 5)

We want to find the value of the function f(x) at the point x0 = 2. Using the Lagrange
interpolation polynomial formula, we get:

L(x) = (1*(x-1)(x-3)(x-4))/(0-1)(0-3)(0-4) + (3*(x-0)(x-3)(x-4))/(1-0)(1-3)(1-4) +


(2*(x-0)(x-1)(x-4))/(3-0)(3-1)(3-4) + (5*(x-0)(x-1)(x-3))/(4-0)(4-1)(4-3)
Simplifying this equation gives us:
L(x) = (-x^3 + 6x^2 - 7x + 4)

Now we can evaluate this polynomial at x0 = 2 to get the value of f(x) at


that point:
f(2) = L(2) = (-2^3 + 62^2 - 72 + 4) = 2

Therefore, using the Lagrange interpolation polynomial, we have


approximated the value of f(x) at x0 = 2 to be 2.
THANK YOU 

You might also like