Increasing the number of nodes in polynomial interpolation.

In this demonstration, we consider the effect of changing the number of nodes in polynomial interpolation. It seems very reasonable to expect that as the number of nodes goes to infinity (at least, supposing that they're sufficiently "evenly spaced") the interpolating polynomial converges to the function being interpolated. 

We’re going to try this out with a couple of functions:

f1[x_] := x^2 + Sinh[x];
f2[x_] := x Sin[x];
f3[x_] := 1/(x^2 + 1);
Manipulate[
Data =Table[{-10 + i*20/n,F[-10 + i*20/n]},{i,0,n}];
Show[Plot[{F[x],InterpolatingPolynomial[Data,x]},{x,-10,10},Frame->True,FrameTicks->None,Filling->Axis,ImageSize->750,PlotRange->Full],ListPlot[{Data,Table[{Data[[i,1]],0},{i,1,Length[Data]}]},PlotStyle->{PointSize->Large}]],
{n,1,20,1},{F,{f1->"(x^2)+sinh(x)",f2->"x sin(x)",f3 ->"(1/((x^2) + 1))"}} ]

The last function is an example of what’s called “Runge’s phenomenon”.