Examples


  x={-1.1,2.1,3.5}
  y={1.3,2.5,-1.6}


  p2[t_]:=lagrangepoly[t,x,y];
  p2[t]


  plot1=Plot[p2[t],{t,-2,4}];
  plot2=ListPlot[Table[{x[[i]],y[[i]]},{i,1,3}],PlotStyle->{RGBColor[1,0,0],PointSize[.02]}];
  Show[plot1,plot2];


  Clear[x,y]
  x={1,-2,3,-1}
  y={0,16,-2,1}


  p3[t_]:=lagrangepoly[t,x,y];
  p3[t]


  plot1=Plot[p3[t],{t,-3,4},PlotRange->{-8,17}];
  plot2=ListPlot[Table[{x[[i]],y[[i]]},{i,1,4}],PlotRange->{-8,17},PlotStyle->{RGBColor[1,0,0],PointSize[.02]}];
  Show[plot1,plot2];

Up to First Attempt: Lagrange Polynomial Interpolation