You are on page 1of 9

Numerical Analysis

Lecture 5

1
Interpolation

• Interpolation enables us to estimate the data points in between the


given data.

• Linear Interpolation Formula:

𝑦2 − 𝑦1
𝑦 = 𝑦1 + × 𝑥 − 𝑥1
𝑥2 − 𝑥1

2
Lagrange Interpolation

• The Lagrange interpolation is a method used to approximate the


function of the line or curve that passes through a set of points.

• The degree of Lagrange interpolating polynomial is determined based


on the number of known points

degree = 𝑛 − 1
where n is the number of known points.

3
Linear Lagrange Interpolation

Given two points 𝑥1 , 𝑦1 and 𝑥2 , 𝑦2 ,


the linear Lagrange interpolating formula is given by:

𝑥 − 𝑥2 𝑥 − 𝑥1
𝑦= 𝑦1 + 𝑦2
𝑥1 − 𝑥2 𝑥2 − 𝑥1

4
Linear Lagrange Interpolation
Example
Determine the value of y at x = 8 given some set of values (2,6), (5,9) by
using the Lagrange interpolation formula.

Solution
Since we have two known points (𝑛 = 2), then we will use the linear
Lagrange formula.

(𝑥 − 𝑥2 ) (𝑥 − 𝑥1 )
𝑦= 𝑦1 + 𝑦2
(𝑥1 − 𝑥2 ) (𝑥2 − 𝑥1 )

5
Linear Lagrange Interpolation

(𝑥 − 𝑥2 ) (𝑥 − 𝑥1 )
𝑦= 𝑦1 + 𝑦2
(𝑥1 − 𝑥2 ) (𝑥2 − 𝑥1 )

Given, 𝑥1 = 2, 𝑦1 = 6, 𝑥2 = 5, 𝑦2 = 9

The value of y at x = 8 will be:


(8 − 5) (8 − 2) 3 6
𝑦= ×6+ ×9= × 6 + × 9 = −6 + 18 = 12
(2 − 5) (5 − 2) −3 3

6
Second degree Lagrange interpolation
Given three points 𝑥1 , 𝑦1 , 𝑥2 , 𝑦2 and 𝑥3 , 𝑦3
the second degree Lagrange interpolating formula that approximates
the curve that passes through the three points is given by:

𝑥 − 𝑥2 𝑥 − 𝑥3 𝑥 − 𝑥1 𝑥 − 𝑥3 𝑥 − 𝑥1 𝑥 − 𝑥2
𝑦= 𝑦1 + 𝑦2 + 𝑦3
𝑥1 − 𝑥2 𝑥1 − 𝑥3 𝑥2 − 𝑥1 𝑥2 − 𝑥3 𝑥3 − 𝑥1 𝑥3 − 𝑥2

7
Second degree Lagrange interpolation
Example
Given the three data points (2, 0.5), (2.75, 0.36), and (4, 0.25), find the
second Lagrange interpolating polynomial for f (3).

8
9

You might also like