MATH 371 -- Numerical Analysis
October 5, 2001
Error of Interpolation
Consider the degree 2 interpolating polynomial for
constructed using , , ,
on the interval .
> x[0]:=evalf(Pi/8): x[1]:=evalf(Pi/4): x[2]:=evalf(3*Pi/8):
> y[0]:=sin(x[0]): y[1]:=sin(x[1]): y[2]:=sin(x[2]):
The Lagrange polynomials
> L[2,0]:=expand((x-x[1])*(x-x[2])/((x[0]-x[1])*(x[0]-x[2])));
> L[2,1]:=expand((x-x[0])*(x-x[2])/((x[1]-x[0])*(x[1]-x[2])));
> L[2,2]:=expand((x-x[0])*(x-x[1])/((x[2]-x[0])*(x[2]-x[1])));
The interpolating polyomial
> p:=expand(y[0]*L[2,0]+y[1]*L[2,1]+y[2]*L[2,2]);
> plot({sin(x),p},x=0..Pi/2);
> plot(abs(sin(x)-p),x=0..Pi/2);
>
Note the pretty close agreement between the interpolating polynomial and the
sin graph (especially toward the middle of the interval). At x = 0.6, for instance:
> abs(sin(.6)-subs(x=.6,p));
Using the bound for the third derivative of sine, the error bound says
<=
> abs(.6-x[0])*abs(.6-x[1])*abs(.6-x[2])/6;
To get better approximations here we could try more interpolation points.