Theory of Approximation: Interpolation Abhas Singh Department of Civil Engineering IIT Kanpur Acknowledgements: Profs. Saumyen Guha and Shivam Tripathi (CE)
Discrete Data (n + 1) observations or data pairs [(x0, y0), (x1, y1), (x2, y2) … (xn, yn)] (m + 1) basis functions: 𝜑 0 , 𝜑 1 , 𝜑 2 ,⋯ 𝜑 𝑚 Approximating polynomial: 𝑝 𝑥 = 𝑗=0 𝑚 𝑐 𝑗 𝜑 𝑗 𝑥 𝑐 0 𝜑 0 𝑥 0 + 𝑐 1 𝜑 1 𝑥 0 + 𝑐 2 𝜑 2 𝑥 0 +⋯+ 𝑐 𝑚 𝜑 𝑚 𝑥 0 = 𝑦 0 𝑐 0 𝜑 0 𝑥 1 + 𝑐 1 𝜑 1 𝑥 1 + 𝑐 2 𝜑 2 𝑥 1 +⋯+ 𝑐 𝑚 𝜑 𝑚 𝑥 1 = 𝑦 1 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 𝑐 0 𝜑 0 𝑥 𝑛 + 𝑐 1 𝜑 1 𝑥 𝑛 + 𝑐 2 𝜑 2 𝑥 𝑛 +⋯+ 𝑐 𝑚 𝜑 𝑚 𝑥 𝑛 = 𝑦 𝑛 n equations, m unknowns: m < n: over-determined system, least square regression m = n: unique solution, interpolation m > n: under-determined system
Interpolation Polynomials Newton’s Divided Difference Lagrange Polynomials Gram’s polynomials (introduced earlier) Spline Interpolation: piecewise continuous, smoothing
Newton’s Divided Difference For a net of points 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 , formulate a triangular set of basis polynomials 𝜑 0 𝑥 =1 𝜑 1 𝑥 = 𝑥− 𝑥 0 𝜑 2 𝑥 = 𝑥− 𝑥 0 𝑥− 𝑥 1 𝜑 3 𝑥 = 𝑥− 𝑥 0 𝑥− 𝑥 1 𝑥− 𝑥 2 ⋮ ⋮ ⋮ ⋮ 𝜑 𝑖 𝑥 = 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑖−1 ⋮ ⋮ ⋮ ⋮ 𝜑 𝑛 𝑥 = 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ ⋯ 𝑥− 𝑥 𝑛−1
Newton’s Divided Difference Consider a net of points 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 and the corresponding function values as 𝑓 0 , 𝑓 1 , 𝑓 2 ,⋯ 𝑓 𝑛 Newton’s polynomial is: 𝑝 𝑥 = 𝑐 0 + 𝑐 1 𝑥− 𝑥 0 + 𝑐 2 𝑥− 𝑥 0 𝑥− 𝑥 1 + 𝑐 3 𝑥− 𝑥 0 𝑥− 𝑥 1 𝑥− 𝑥 2 ⋯ ⋯ + 𝑐 𝑛 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛−1 True function: 𝑓 𝑥 =𝑝 𝑥 + 𝑓 𝑛+1 𝜉 𝑛+1 ! 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛 for some 𝜉∈ int 𝑥, 𝑥 0 , 𝑥 1 ⋯ 𝑥 𝑛
Newton’s Divided Difference Newton’s polynomial with the remainder term: 𝑓 𝑥 = 𝑐 0 + 𝑐 1 𝑥− 𝑥 0 + 𝑐 2 𝑥− 𝑥 0 𝑥− 𝑥 1 + 𝑐 3 𝑥− 𝑥 0 𝑥− 𝑥 1 𝑥− 𝑥 2 ⋯ ⋯ + 𝑐 𝑛 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛−1 +𝑎 𝑥 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛 𝑓 𝑥 0 = 𝑓 0 = 𝑐 0 ; Taking f0 on the LHS and dividing by 𝑥− 𝑥 0 𝑓 𝑥 0 ,𝑥 = 𝑓 𝑥 −𝑓 𝑥 0 𝑥− 𝑥 0 = 𝑐 1 + 𝑐 2 𝑥− 𝑥 1 + 𝑐 3 𝑥− 𝑥 1 𝑥− 𝑥 2 ⋯ ⋯ + 𝑐 𝑛 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛−1 +𝑎 𝑥 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛 𝑓 𝑥 0 , 𝑥 1 = 𝑓 1 − 𝑓 0 𝑥 1 − 𝑥 0 = 𝑐 1
Newton’s Divided Difference 𝑓 𝑥 0 ,𝑥 = 𝑓 𝑥 −𝑓 𝑥 0 𝑥− 𝑥 0 = 𝑐 1 + 𝑐 2 𝑥− 𝑥 1 + 𝑐 3 𝑥− 𝑥 1 𝑥− 𝑥 2 ⋯ ⋯ + 𝑐 𝑛 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛−1 +𝑎 𝑥 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛 Taking 𝑓 𝑥 0 , 𝑥 1 on the LHS and dividing by 𝑥− 𝑥 1 : 𝑓 𝑥 0 , 𝑥 1 ,𝑥 = 𝑓 𝑥 0 ,𝑥 −𝑓 𝑥 0 , 𝑥 1 𝑥− 𝑥 1 = 𝑐 2 + 𝑐 3 𝑥− 𝑥 2 +⋯ + 𝑐 𝑛 𝑥− 𝑥 2 ⋯ 𝑥− 𝑥 𝑛−1 +𝑎 𝑥 𝑥− 𝑥 2 ⋯ 𝑥− 𝑥 𝑛 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 = 𝑓 𝑥 0 , 𝑥 2 −𝑓 𝑥 0 , 𝑥 1 𝑥 2 − 𝑥 1 = 𝑐 2
Newton’s Divided Difference 𝑓 𝑥 0 , 𝑥 1 ,𝑥 = 𝑓 𝑥 0 ,𝑥 −𝑓 𝑥 0 , 𝑥 1 𝑥− 𝑥 1 = 𝑐 2 + 𝑐 3 𝑥− 𝑥 2 +⋯ + 𝑐 𝑛 𝑥− 𝑥 2 ⋯ 𝑥− 𝑥 𝑛−1 +𝑎 𝑥 𝑥− 𝑥 2 ⋯ 𝑥− 𝑥 𝑛 Taking 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 on the LHS and dividing by 𝑥− 𝑥 2 : 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,𝑥 = 𝑓 𝑥 0 , 𝑥 1 ,𝑥 −𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 𝑥− 𝑥 2 = 𝑐 3 + 𝑐 4 𝑥− 𝑥 3 +⋯ + 𝑐 𝑛 𝑥− 𝑥 3 ⋯ 𝑥− 𝑥 𝑛−1 +𝑎 𝑥 𝑥− 𝑥 3 ⋯ 𝑥− 𝑥 𝑛 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 , 𝑥 3 = 𝑓 𝑥 0 , 𝑥 1 , 𝑥 3 −𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 𝑥 3 − 𝑥 2 = 𝑐 3
Newton’s Divided Difference 𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−1 ,𝑥 = 𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−2 ,𝑥 −𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−2 , 𝑥 𝑘−1 𝑥− 𝑥 𝑘−1 = 𝑐 𝑘 + 𝑐 𝑘+1 𝑥− 𝑥 𝑘 +…+ 𝑐 𝑛 𝑥− 𝑥 𝑘 ⋯ 𝑥− 𝑥 𝑛−1 + 𝑎 𝑥 𝑥− 𝑥 𝑘 ⋯ 𝑥− 𝑥 𝑛 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑘 = 𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−2 , 𝑥 𝑘 −𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−2 , 𝑥 𝑘−1 𝑥 𝑘 − 𝑥 𝑘−1 = 𝑐 𝑘 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 = 𝑐 𝑛 ; 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 ,𝑥 =𝑎 𝑥 Newton’s polynomial without the remainder term: 𝑝 𝑥 = 𝑓 0 + 𝑗=1 𝑛 𝑓 𝑥 0 , 𝑥 1 , ⋯ 𝑥 𝑗 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑗−1
Recall: Properties of Divided Differences 1st Divided Difference: 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 = 𝑓 𝑘 − 𝑓 𝑘−1 𝑥 𝑘 − 𝑥 𝑘−1 = 𝑓 𝑘−1 − 𝑓 𝑘 𝑥 𝑘−1 − 𝑥 𝑘 =𝑓 𝑥 𝑘−1 , 𝑥 𝑘 2nd Divided Difference: 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , 𝑥 𝑘−2 = 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 −𝑓 𝑥 𝑘−1 , 𝑥 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−2 = 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 −𝑓 𝑥 𝑘 , 𝑥 𝑘−2 𝑥 𝑘−1 − 𝑥 𝑘−2 = 𝑓 𝑥 𝑘 , 𝑥 𝑘−2 −𝑓 𝑥 𝑘−1 , 𝑥 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−1 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , 𝑥 𝑘−2 =𝑓 𝑥 𝑘−1 , 𝑥 𝑘 , 𝑥 𝑘−2 =𝑓 𝑥 𝑘−2 , 𝑥 𝑘−1 , 𝑥 𝑘 =𝑓 𝑥 𝑘 , 𝑥 𝑘−2 , 𝑥 𝑘−1
Properties of Divided Differences 2nd Divided Difference: 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , 𝑥 𝑘−2 = 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 −𝑓 𝑥 𝑘−1 , 𝑥 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−2 𝑎= 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 −𝑓 𝑥 𝑘 , 𝑥 𝑘−2 𝑥 𝑘−1 − 𝑥 𝑘−2 = 𝑓 𝑘 − 𝑓 𝑘−1 𝑥 𝑘 − 𝑥 𝑘−1 − 𝑓 𝑘 − 𝑓 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−2 𝑥 𝑘−1 − 𝑥 𝑘−2 = 𝑥 𝑘 𝑓 𝑘 − 𝑥 𝑘 𝑓 𝑘−1 − 𝑥 𝑘−2 𝑓 𝑘 + 𝑥 𝑘−2 𝑓 𝑘−1 − 𝑥 𝑘 𝑓 𝑘 + 𝑥 𝑘 𝑓 𝑘−2 + 𝑥 𝑘−1 𝑓 𝑘 − 𝑥 𝑘−1 𝑓 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−1 𝑥 𝑘−1 − 𝑥 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−2 = 𝑥 𝑘−1 − 𝑥 𝑘−2 𝑓 𝑘 − 𝑥 𝑘−1 − 𝑥 𝑘−2 𝑓 𝑘−1 − 𝑥 𝑘 − 𝑥 𝑘−1 𝑓 𝑘−1 + 𝑥 𝑘 − 𝑥 𝑘−1 𝑓 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−1 𝑥 𝑘−1 − 𝑥 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−2 = 𝑓 𝑘 − 𝑓 𝑘−1 𝑥 𝑘 − 𝑥 𝑘−1 − 𝑓 𝑘−1 − 𝑓 𝑘−2 𝑥 𝑘−1 − 𝑥 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−2 = 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 −𝑓 𝑥 𝑘−1 , 𝑥 𝑘−2 𝑥 𝑘 − 𝑥 𝑘−2 =𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , 𝑥 𝑘−2 + 𝑥 𝑘−1 𝑓 𝑘−1 − 𝑥 𝑘−1 𝑓 𝑘−1
Newton’s Divided Difference Recursion Formula for Divided Difference: (Recall: discussion during Muller’s method) The order of the points within the divided difference is immaterial. To see it generally, consider this: 𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘 ,𝑥 = 𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−1 ,𝑥 −𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−1 , 𝑥 𝑘 𝑥− 𝑥 𝑘 For generalization: replace the index zero with (i + 1) evaluate the divided difference at x = xi 𝑓 𝑥 𝑖+1 , 𝑥 𝑖+2 ,… 𝑥 𝑘 , 𝑥 𝑖 = 𝑓 𝑥 𝑖+1 , 𝑥 𝑖+2 ,… 𝑥 𝑘−1 , 𝑥 𝑖 −𝑓 𝑥 𝑖+1 , 𝑥 𝑖+2 ,… 𝑥 𝑘−1 , 𝑥 𝑘 𝑥 𝑖 − 𝑥 𝑘 𝑓 𝑥 𝑖 , 𝑥 𝑖+1 , … 𝑥 𝑘 = 𝑓 𝑥 𝑖 , 𝑥 𝑖+1 , … 𝑥 𝑘−1 −𝑓 𝑥 𝑖+1 ,… 𝑥 𝑘−1 , 𝑥 𝑘 𝑥 𝑖 − 𝑥 𝑘
Newton’s Divided Difference 𝑓 𝑥 𝑖 , 𝑥 𝑖+1 , … 𝑥 𝑘 = 𝑓 𝑥 𝑖 , 𝑥 𝑖+1 , … 𝑥 𝑘−1 −𝑓 𝑥 𝑖+1 ,… 𝑥 𝑘−1 , 𝑥 𝑘 𝑥 𝑖 − 𝑥 𝑘 = 𝑓 𝑥 𝑖+1 ,… 𝑥 𝑘−1 , 𝑥 𝑘 −𝑓 𝑥 𝑖 , 𝑥 𝑖+1 , … 𝑥 𝑘−1 𝑥 𝑘 −𝑥 𝑖 Or by reversing the order of x variables, 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , … 𝑥 𝑖 = 𝑓 𝑥 𝑘−1 ,… 𝑥 𝑖+1 , 𝑥 𝑖 −𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , … 𝑥 𝑖+1 𝑥 𝑖 − 𝑥 𝑘 = 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , … 𝑥 𝑖+1 −𝑓 𝑥 𝑘−1 ,… 𝑥 𝑖+1 , 𝑥 𝑖 𝑥 𝑘 −𝑥 𝑖
Newton’s Divided Difference Examples: 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , … 𝑥 𝑖 = 𝑓 𝑥 𝑘 , 𝑥 𝑘−1 , … 𝑥 𝑖+1 −𝑓 𝑥 𝑘−1 ,… 𝑥 𝑖+1 , 𝑥 𝑖 𝑥 𝑘 −𝑥 𝑖 𝑘=1, 𝑖=0:𝑓 𝑥 1 , 𝑥 0 = 𝑓 𝑥 1 −𝑓 𝑥 0 𝑥 1 −𝑥 0 𝑘=2, 𝑖=1:𝑓 𝑥 2 , 𝑥 1 = 𝑓 𝑥 2 −𝑓 𝑥 1 𝑥 2 −𝑥 1 𝑘=2, 𝑖=0:𝑓 𝑥 2 , 𝑥 1 , 𝑥 0 = 𝑓 𝑥 2 , 𝑥 1 −𝑓 𝑥 1 , 𝑥 0 𝑥 2 −𝑥 0 𝑘=3, 𝑖=1:𝑓 𝑥 3 , 𝑥 2 , 𝑥 1 = 𝑓 𝑥 3 , 𝑥 2 −𝑓 𝑥 2 , 𝑥 1 𝑥 3 −𝑥 1 𝑘=3, 𝑖=0:𝑓 𝑥 3 , 𝑥 2 , 𝑥 1 , 𝑥 0 = 𝑓 𝑥 3 , 𝑥 2 , 𝑥 1 −𝑓 𝑥 2 , 𝑥 1 , 𝑥 0 𝑥 3 −𝑥 0
Newton’s Divided Difference:Example x0 , f(x0) f[x1, x0] f[x2, x1, x0] f[x3, x2, x1, x0] x1 , f(x1) f[x2, x1] f[x3, x2, x1] x2 , f(x2) f[x3, x2] x3 , f(x3) p(x) = f(x0) + f[x1, x0](x - x0) + f[x2, x1, x0](x - x0)(x – x1) + f[x3, x2, x1, x0](x - x0)(x – x1)(x – x2)
Newton’s Divided Difference: Example 1 , -48 2 9 2 2 , -46 29 17 4, 12 80 5 , 92 𝑝 𝑥 =−48+ 2 𝑥−1 + 9 𝑥−1 𝑥−2 + 2 𝑥−1 𝑥−2 𝑥−4 =2 𝑥 3 −5 𝑥 2 +3𝑥−48 p(x) = f(x0) + f[x1, x0](x - x0) + f[x2, x1, x0](x - x0)(x – x1) + f[x3, x2, x1, x0](x - x0)(x – x1)(x – x2)
Newton’s Divided Difference: Error Estimate Recall the Newton’s polynomial with the remainder: 𝑓 𝑥 =𝑝 𝑥 + 𝑓 𝑛+1 𝜉 𝑛+1 ! 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛 for some 𝜉∈ int 𝑥, 𝑥 0 , 𝑥 1 ⋯ 𝑥 𝑛 𝑓 𝑥 =𝑝 𝑥 +𝑎 𝑥 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛 We derived: 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 ,𝑥 =𝑎 𝑥 If an extra-data {xn+1, f(xn+1)} is available, it is possible to make an approximate estimate of the error as: 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 , 𝑥 𝑛+1 =𝑎 𝑥 𝑛+1 ≈𝑎 𝑥 and the error (E) as: 𝐸≈𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 , 𝑥 𝑛+1 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑛
Newton’s Divided Difference 𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−1 ,𝑥 = 𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−2 ,𝑥 −𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−2 , 𝑥 𝑘−1 𝑥− 𝑥 𝑘−1 = 𝑐 𝑘 + 𝑐 𝑘+1 𝑥− 𝑥 𝑘 +…+ 𝑐 𝑛 𝑥− 𝑥 𝑘 ⋯ 𝑥− 𝑥 𝑛−1 + 𝑎 𝑥 𝑥− 𝑥 𝑘 ⋯ 𝑥− 𝑥 𝑛 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑘 = 𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−2 , 𝑥 𝑘 −𝑓 𝑥 0 , 𝑥 1 ,… 𝑥 𝑘−2 , 𝑥 𝑘−1 𝑥 𝑘 − 𝑥 𝑘−1 = 𝑐 𝑘 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 = 𝑐 𝑛 ; 𝑓 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 ,𝑥 =𝑎 𝑥 Newton’s polynomial without the remainder term: 𝑝 𝑥 = 𝑓 0 + 𝑗=1 𝑛 𝑓 𝑥 0 , 𝑥 1 , ⋯ 𝑥 𝑗 𝑥− 𝑥 0 𝑥− 𝑥 1 ⋯ 𝑥− 𝑥 𝑗−1
Lagrange Polynomials Unit linear polynomials for two nodes: 𝑥 0 , 𝑥 1 𝛿 0 𝑥 = 𝑥− 𝑥 1 𝑥 0 − 𝑥 1 ; 𝛿 1 𝑥 = 𝑥− 𝑥 0 𝑥 1 − 𝑥 0 Unit quadratic for three nodes: 𝑥 0 , 𝑥 1 , 𝑥 2 𝛿 0 𝑥 = 𝑥− 𝑥 1 𝑥− 𝑥 2 𝑥 0 − 𝑥 1 𝑥 0 − 𝑥 2 ; 𝛿 1 𝑥 = 𝑥− 𝑥 0 𝑥− 𝑥 2 𝑥 1 − 𝑥 0 𝑥 1 − 𝑥 2 𝛿 2 𝑥 = 𝑥− 𝑥 0 𝑥− 𝑥 1 𝑥 2 − 𝑥 0 𝑥 2 − 𝑥 1 Polynomials of order n for the mesh of nodes 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 𝛿 𝑖 𝑥 = 𝑗=0 𝑗≠𝑖 𝑛 𝑥− 𝑥 𝑗 𝑥 𝑖 − 𝑥 𝑗 𝛿 𝑖 𝑥 𝑗 = 0 𝑓𝑜𝑟 𝑗≠𝑖 1 𝑓𝑜𝑟 𝑗=𝑖
Lagrange Polynomials Polynomials to be fitted to a mesh of nodes 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 and the corresponding function values as 𝑓 0 , 𝑓 1 , 𝑓 2 ,⋯ 𝑓 𝑛 Lagrange polynomial is: 𝑝 𝑥 = 𝑖=0 𝑛 𝑓 𝑖 𝛿 𝑖 𝑥 𝛿 𝑖 𝑥 = 𝑗=0 𝑗≠𝑖 𝑛 𝑥− 𝑥 𝑗 𝑥 𝑖 − 𝑥 𝑗
Lagrange Polynomials: Linear
Lagrange Polynomials: Quadratic
Lagrange Polynomials Polynomials to be fitted to a mesh of nodes 𝑥 0 , 𝑥 1 , 𝑥 2 ,⋯ 𝑥 𝑛 and the corresponding function values as 𝑓 0 , 𝑓 1 , 𝑓 2 ,⋯ 𝑓 𝑛 Lagrange polynomial is: 𝑝 𝑥 = 𝑖=0 𝑛 𝑓 𝑖 𝛿 𝑖 𝑥 𝛿 𝑖 𝑥 = 𝑗=0 𝑗≠𝑖 𝑛 𝑥− 𝑥 𝑗 𝑥 𝑖 − 𝑥 𝑗
Lagrange Polynomial: Example Write the cubic polynomial using Lagrange polynomials that passes through the following four points: (1 , -48), (2 , -46), (4, 12), (5 , 92)? 𝑝 𝑥 = −48 𝑥−2 𝑥−4 𝑥−5 1−2 1−4 1−5 + −46 𝑥−1 𝑥−4 𝑥−5 2−1 2−4 2−5 +12 𝑥−1 𝑥−2 𝑥−5 4−1 4−2 4−5 +92 𝑥−1 𝑥−2 𝑥−4 5−1 5−2 5−4 =4 𝑥−2 𝑥−4 𝑥−5 − 23 3 𝑥−1 𝑥−4 𝑥−5 −2 𝑥−1 𝑥−2 𝑥−5 + 23 3 𝑥−1 𝑥−2 𝑥−4 =2 𝑥 3 −5 𝑥 2 +3𝑥−48 Recall Newton’s polynomial through the same set of points: 𝑝 𝑥 =−48+2 𝑥−1 +9 𝑥−1 𝑥−2 +2 𝑥−1 𝑥−2 𝑥−4 =2 𝑥 3 −5 𝑥 2 +3𝑥−48
Example Fit Fit an interpolation polynomial through the following four points: (1 , -48), (2 , -46), (4, 12), (5 , 92) 𝑝 𝑥 =2 𝑥 3 −5 𝑥 2 +3𝑥−48