Professional Documents
Culture Documents
Lecture 5
1
Interpolation
𝑦2 − 𝑦1
𝑦 = 𝑦1 + × 𝑥 − 𝑥1
𝑥2 − 𝑥1
2
Lagrange Interpolation
degree = 𝑛 − 1
where n is the number of known points.
3
Linear Lagrange Interpolation
𝑥 − 𝑥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
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