# # Look at the effect of Lagrange interpolation on a prefix of the # input data as more points are added. # x := 0,1,2,3,4,5; y := 0,2,4,1,0,-1; p1 := interp([x],[y],t): plot1 := plot(p1, t=0..5, colour=CYAN): x := x,6: y := y,1: p2 := interp([x],[y],t); plot2 := plot({p2}, t=0..5, colour=YELLOW): x := x,7: y := y,0: p3 := interp([x],[y],t): plot3 := plot({p3}, t=0..5, colour=GREEN): plot4 := plot([P],style=point, colour=WHITE): with(plots): display({plot1, plot2, plot3, plot4}, title=`Non-locality of Lagrange Interpolation`);