![]()
MATH566 Lesson 5: Polynomial interpolation
|
Function approximation criteria: interpolation, least squares, min-max
Bases for polynomial interpolation
Polynomial interpolant forms
Lagrange
Barycentric Lagrange
![]()
Function approximation criteria
|
Consider , “difficult” to compute, and known through a sample
Introduce approximant , “easy” to compute,
Introduce vectors: , ,
Assess accuracy of approximation through norm of error vector
Various types of norms and error bounds can be considered:
is known as interpolation
Assume is defined by parameters, , . The approximant obtained by minimization of the two-norm is known as the least squares approximant
The approximant obtained by the minimization of the inf-norm is known as the minmax approximant
![]()
Linear combination approach to approximation
|
Consider a set of linearly independent functions
Construct approximation of by
Even though might be nonlinear the above expresses as a linear combination of
Various choices can be made for the basis functions
![]()
Lagrange form of polynomial interpolant
|
The interpolation conditions can be achieved if
In this case the linear combination coefficients are simply the function values
Construct polynomial of degree to satisfy above conditions
are the Lagrange basis polynomials, are the unnormalized version
![]()
Shape of the Lagrange basis
|
Note that at each all polynomials except one evaluate as 0. The remaining polynomial evaluates as 1.
The polynomials can reach values greater or less than 1
![]()
Evaluation of the Lagrange polynomial interpolant
|
Algorithm (Lagrange evaluation)
Input:
Output:
for to n
for to
if then
end
end
return
Operation count: for each from 0 to , for each from 0 to skipping one index, carry out 2 FLOPS (1 FLOP = 1 addition and 1 multiplication)
![]()
Barycentric form of Lagrange interpolant
|
The operation count for evaluating the Lagrange interpolant can be reduced to by using a different form, the barycentric form.
Let and rewrite as
The interpolating polynomial is now
Interpolation of the function gives .
Take ratio to obtain barycentric form
![]()
Evaluation of barycentric Lagrange polynomial
|
Algorithm (Barycentric Lagrange evaluation)
Input:
Output:
for to
for to
if
end
end
for to n
; ;
end
return
∴ |
function BaryLagrange(t,x,y) n=length(x)-1; w=ones(size(x)); for i=1:n+1 w[i]=1 for j=1:n+1 if (i!=j) w[i]=w[i]/(x[i]-x[j]); end end end q=r=0 for i=1:n+1 d=t-x[i] if d≈0 return y[i]; end s=w[i]/d; q=q+y[i]*s; r=r+s end return q/r end; |
∴ |
p2(t)=3*t^2-2*t+1; |
∴ |
x=[-2 0 2]; y=p2.(x); |
∴ |
t=-3:3; [p2.(t) BaryLagrange.(t,Ref(x),Ref(y))] |
(1)
∴ |
Precompute , FLOPs. Evaluation for given costs only FLOPs