Lagrange Interpolating Polynomial

Summary

Lagrange form writes the unique interpolant as a weighted sum of cardinal basis polynomials Li that satisfy Li(xk)=δik .

Prerequisites

Problem Type

Given distinct nodes x0,,xn and values yi , construct P with P(xi)=yi .

Method Definition

P(x)=i=0nyiLi(x),Li(x)=j=0jinxxjxixj.

Each Li has degree n , Li(xi)=1 , and Li(xj)=0 for ji . The product is over ji only.[1]

Assumptions / Requirements

Algorithm

  1. For each i , form Li(x) as the product over ji .
  2. Sum yiLi(x) .
  3. Optionally expand into monomial form for inspection.

Error / Accuracy

If yi=f(xi) with fCn+1 , then for some ξ between the nodes and x ,

f(x)P(x)=f(n+1)(ξ)(n+1)!i=0n(xxi).

If |f(n+1)|M on the interval of interest,

|f(x)P(x)|M(n+1)!|i=0n(xxi)|.

Worked Example

Nodes (0,2) , (1,3) , (2,5) .

L0(x)=(x1)(x2)(01)(02)=(x1)(x2)2=12(x23x+2),L1(x)=(x0)(x2)(10)(12)=x(x2)1=x2+2x,L2(x)=(x0)(x1)(20)(21)=x(x1)2=12(x2x). P(x)=2L0(x)+3L1(x)+5L2(x)=212(x23x+2)+3(x2+2x)+512(x2x)=(x23x+2)+(3x2+6x)+(52x252x)=(13+52)x2+(3+652)x+2=12x2+12x+2.

Checks: P(0)=2 , P(1)=1/2+1/2+2=3 , P(2)=2+1+2=5 .

Common Failure Modes

Connections

References


  1. Burden & Faires, Numerical Analysis, Lagrange interpolation; NIST DLMF Ch. 3, https://dlmf.nist.gov/3 ↩︎