Title: Lagrange Interpolating Polynomials
1Lagrange Interpolating Polynomials
1st-order Lagrange Polynomials
n1
L1(x1)1, L1(x0)0
L0(x0)1, L0(x1)0
2f(x)
f(x1)
f(x0)
x0
x1
3f(x)
f(x1)
f(x0)
1
L0
L1
x0
x1
4f(x)
f(x1)
f(x0)
L0(x)f(x0)
L1
x0
x1
5f(x)
f(x1)
f(x0)
L1(x)f(x1)
L0(x)f(x0)
x0
x1
6f(x)
f(x1)
f(x0)
f1(x) L0(x)f(x0) L1(x)f(x1)
1
L0
L1
x0
x1
72nd-order Lagrange Polynomials
L0(x0)1, L0(x1)L0(x2)0
n2
L1(x1)1, L1(x0)L1(x2)0
L2(x2)1, L2(x0)L2(x1)0
(Note that the Lagrange polynomials depend on
x-values only, not y-values!!)
82nd-order example
Data points (1,2), (2,3), (3,2.5)
x0
x1
x2
94th-order example
Data points (1,2), (2,3), (3,1), (4,-1),
(5,2)
x0
x1
x2
x3
x4
10Matlab Code
Function produces the kth Lagrange polynomial
for a set of n1 pts. Note k ranges from 1 to
n1 rather than 0 to n because vector indices
must be positive in Matlab function
Llagrange(x,Xpts,k) L 1 for
j1length(Xpts) if jk L
L.(x-Xpts(j))/(Xpts(k)-Xpts(j))
end end LL() make L a column vector