Part (14) - Interpolation 2
Part (14) - Interpolation 2
where n in 𝑓𝑛 𝑥 stands for the 𝑛𝑡ℎ order polynomial that approximates the function
𝑦 = 𝑓 𝑥 given at n+1 data points.
- For a polynomial of the 𝑛𝑡ℎ order, n+1 points are required which will form n+1
Lagrange polynomials
C) Lagrange Interpolation
𝑥−𝑥1 𝑥−𝑥0
Which are : 𝐿0 (𝑥) = , 𝐿1 (𝑥) =
𝑥0 −𝑥1 𝑥1 −𝑥0
(𝑥 − 𝑥0 )(𝑥 − 𝑥2 )
𝐿1 (𝑥) =
(𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
𝐿2 (𝑥) =
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )
𝑥 − 𝑥1 𝑥−0
𝐿0 𝑥 = = =−𝑥
𝑥0 − 𝑥1 −1 − 0
𝑥 − 𝑥0 𝑥 − −1
𝐿1 𝑥 = = =𝑥+1
𝑥1 − 𝑥0 0 − −1
𝑓1 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 ⇒ 𝑓 𝑥1 = −𝑥 3 + (𝑥 + 1)(−4) ⇒ 𝑓1 𝑥 = −7𝑥 − 4
⇒ 𝑓1 −0.5 = −7 −0.5 − 4 = −0.5
Example 6
Using the 2nd order Lagrange interpolation, find the value of 𝑓 0.8 .
𝒙 𝒇(𝒙)
-1 3
0 -4
1 5
2 -6
3 2
Example 6 - Solution
For the 2nd order (quadratic) interpolation, choose 3 points that bracket 𝑥 = 0.8.
𝒙 𝒇(𝒙)
-1 3
0 -4
1 5
2 -6
3 2
𝒙 𝒇(𝒙)
Example 6 - Solution 0 -4
The quadratic interpolating polynomial is: 1 5
2 -6
𝑓2 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓(𝑥2 )
𝑥 − 𝑥1 𝑥 − 𝑥2 0.8 − 1 0.8 − 2
𝐿0 𝑥 = ⇒ 𝐿0 0.8 = = 0.12
𝑥0 − 𝑥1 𝑥0 − 𝑥2 0−1 0−2
𝑥 − 𝑥0 𝑥 − 𝑥2 0.8 − 0 0.8 − 2
𝐿1 𝑥 = ⇒ 𝐿1 0.8 = = 0.96
𝑥1 − 𝑥0 𝑥1 − 𝑥2 1−0 1−2
𝑥 − 𝑥0 𝑥 − 𝑥1 0.8 − 0 0.8 − 1
𝐿2 𝑥 = ⇒ 𝐿2 0.8 = = −0.08
𝑥2 − 𝑥0 𝑥2 − 𝑥1 2−0 2−1
𝒙 𝒇(𝒙)
Example 6 - Solution 0 -4
1 5
2 -6
𝑓2 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓(𝑥2 )
𝑓2 0.8 = 4.8
Example 7
The following table represents the time – velocity characteristics of a rocket.
For 𝑛𝑡ℎ order polynomial, n+1 divided differences are required, as well as n+1 data points.
𝑏0 = 𝑓 𝑥0
𝑓 𝑥1 − 𝑓(𝑥0 )
𝑏1 =
𝑥1 − 𝑥0
𝑓 𝑥2 − 𝑓(𝑥1 ) 𝑓 𝑥1 − 𝑓(𝑥0 )
−
𝑥2 − 𝑥1 𝑥1 − 𝑥0
𝑏2 =
𝑥2 − 𝑥0
D) Newton’s Divided Differences Interpolating Polynomials
𝑥1 𝑓(𝑥1 )
Example 9
𝒙 𝒇(𝒙)
2 6
10 12
Example 9 - Solution
- Linear Newton’s divided difference interpolation:
𝒇𝟏 𝒙 = 𝒃𝟎 + 𝒃𝟏 𝒙 − 𝒙𝟎
10 12
𝒇𝟏 𝒙 = 𝒃𝟎 + 𝒃𝟏 𝒙 − 𝒙𝟎 𝒇𝟏 𝒙 = 𝟔 + 𝟎. 𝟕𝟓 𝒙 − 𝟐 𝒇𝟏 𝒙 = 𝟎. 𝟕𝟓𝒙 + 𝟒. 𝟓
Example 9 - Solution
- Linear Newton’s divided difference interpolation:
𝒇𝟏 𝒙 = 𝒃𝟎 + 𝒃𝟏 𝒙 − 𝒙𝟎
10 12
𝒇𝟏 𝒙 = 𝟎. 𝟕𝟓𝒙 + 𝟒. 𝟓 𝒇𝟏 𝟔 = 𝟎. 𝟕𝟓 ∗ (𝟔) + 𝟒. 𝟓 𝒇𝟏 𝟔 = 𝟗
D) Newton’s Divided Differences Interpolating Polynomials
𝑥2 𝑓(𝑥2 )
Example 10
50 25
90 65
Example 10 - Solution
90 65
Example 10 - Solution
−𝟏
𝒇𝟐 𝒙 = 𝟏𝟓 + 𝟎. 𝟓 𝒙 − 𝟑𝟎 + 𝒙 − 𝟑𝟎 𝒙 − 𝟓𝟎
𝟏𝟐𝟎
The acceleration at t = 80 s :
−𝟏
𝒇𝟐 𝟖𝟎 = 𝟏𝟓 + 𝟎. 𝟓 𝟖𝟎 − 𝟑𝟎 + 𝟖𝟎 − 𝟑𝟎 𝟖𝟎 − 𝟓𝟎
𝟏𝟐𝟎
𝒇𝟐 𝟖𝟎 = 𝟐𝟕. 𝟓 𝒎/𝒔𝟐
Example 11
𝒙 𝒇(𝒙) 2nd Divided Diff 3rd Divided Diff 4th Divided Diff
4−3 3−1 1−1
0 3 𝒃𝟎 = 1 𝒃𝟏 = 1 𝒃𝟐 = 0 𝒃𝟑
1−0 2−0 4−0
7−4 6−3
1 4 =3 =1
2−1 4−1
19 − 7
2 7 =6
4−2
4 19
𝒇𝟑 𝒙 = 𝒃𝟎 + 𝒃𝟏 𝒙 − 𝒙𝟎 + 𝒃𝟐 𝒙 − 𝒙𝟎 𝒙 − 𝒙𝟏 + 𝒃𝟑 𝒙 − 𝒙𝟎 𝒙 − 𝒙𝟏 𝒙 − 𝒙𝟐
𝒇𝟑 𝒙 = 𝟑 + 𝟏 𝒙 − 𝟎 + 𝟏 𝒙 − 𝟎 𝒙 − 𝟏 + 𝟎 𝒙 − 𝟎 𝒙 − 𝟏 𝒙 − 𝟐
𝒇𝟑 𝒙 = 𝒙𝟐 + 𝟑