Professional Documents
Culture Documents
Lec02-3 Polynomial Interpolation
Lec02-3 Polynomial Interpolation
Lec02-3 Polynomial Interpolation
AVAILab
Autonomous Vehicles &
Artificial Intelligence
Laboratory
• Introduction to Polynomial Interpolation
• Lagrange Polynomials
𝑔 𝑥 = 𝑎0 + 𝑎1 ⋅ 𝑥 + 𝑎2 ⋅ 𝑥 2 +. . . +𝑎𝑛 ⋅ 𝑥 𝑛
• Since g(xi) = yi, we have four coefficients and four data points
resulting in the following system of equations:
𝑎0 + 𝑎1 ⋅ 0 + 𝑎2 ⋅ 02 + 𝑎3 ⋅ 03 =5
𝑎0 + 𝑎1 ⋅ 1 + 𝑎2 ⋅ 12 + 𝑎3 ⋅ 13 =3
𝑎0 + 𝑎1 ⋅ 2 + 𝑎2 ⋅ 22 + 𝑎3 ⋅ 23 =5
𝑎0 + 𝑎1 ⋅ 3 + 𝑎2 ⋅ 32 + 𝑎3 ⋅ 33 = 23
Polynomial Interpolation Mauro S. Innocente
5 | 11
• Operating:
𝑎0 + 0 ⋅ 𝑎1 + 0 ⋅ 𝑎2 + 0 ⋅ 𝑎3 = 5
𝑎0 + 1 ⋅ 𝑎1 + 1 ⋅ 𝑎2 + 1 ⋅ 𝑎3 = 3
𝑎0 + 2 ⋅ 𝑎1 + 4 ⋅ 𝑎2 + 8 ⋅ 𝑎3 = 5
𝑎0 + 3 ⋅ 𝑎1 + 9 ⋅ 𝑎2 + 27 ⋅ 𝑎3 = 23
• In matrix form:
𝐀⋅𝐱=𝐛
1 0 0 0 5 𝑎0
1 1 1 1 3 𝑎1
𝐀= ; 𝐛= ; 𝐱= 𝑎2
1 2 4 8 5
1 3 9 27 23 𝑎3
𝑔 𝑥 = 2 ⋅ 𝑥3 − 4 ⋅ 𝑥2 + 5
𝐿 𝑥 = 𝑦𝑖 ⋅ 𝑙𝑖 𝑥
𝑖=0
𝑥 − 𝑥𝑚 𝑥 − 𝑥0 𝑥 − 𝑥𝑖−1 𝑥 − 𝑥𝑖+1 𝑥 − 𝑥𝑛
𝑙𝑖 𝑥 = ෑ = ... ⋅ ... , 𝑖 = 0, . . . , 𝑛
𝑥𝑖 − 𝑥𝑚 𝑥𝑖 − 𝑥0 𝑥𝑖 − 𝑥𝑖−1 𝑥𝑖 − 𝑥𝑖+1 𝑥𝑖 − 𝑥𝑛
0≤𝑚≤𝑛
𝑚≠𝑖
1 when 𝑖 = 𝑗
𝑙𝑖 𝑥𝑗 = ቊ
0 when 𝑖 ≠ 𝑗
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥3 𝑥⋅ 𝑥−1 ⋅ 𝑥−3
𝑙2 (𝑥) = ⋅ ⋅ =−
𝑥2 − 𝑥0 𝑥2 − 𝑥1 𝑥2 − 𝑥3 2
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥⋅ 𝑥−1 ⋅ 𝑥−2
𝑙3 (𝑥) = ⋅ ⋅ =
𝑥3 − 𝑥0 𝑥3 − 𝑥1 𝑥3 − 𝑥2 6
3
𝐿(𝑥) = 𝑦𝑖 ⋅ 𝑙𝑖 (𝑥)
𝑖=0
Polynomial Interpolation Mauro S. Innocente
10 | 11
x y
0 5
5 1 3
𝐿(𝑥) = − ⋅ 𝑥 − 1 ⋅ 𝑥 − 2 ⋅ 𝑥 − 3 2 5
6 3 23
3
+ ⋅𝑥⋅ 𝑥−2 ⋅ 𝑥−3
2
5
− ⋅𝑥⋅ 𝑥−1 ⋅ 𝑥−3
2
23
+ ⋅𝑥⋅ 𝑥−1 ⋅ 𝑥−2
6