# # Interpolate a space curve through some data points using Lagrange. # pairs := proc(x,y) local i; [x[i], y[i]] $ i=1..nops(x); end: x := [0, 2, 1, 0.5, 4, 3, 2.5, 3.5]: y := [0, 3, 4, 1, 2, 3, 1, 4]: T := [0, 1, 2, 3, 4, 5, 6, 7]: Lx := interp(T,x,t): Ly := interp(T,y,t): with(plots): plotLa := plot({[Lx,Ly,t=0..7]}, colour=YELLOW): plotP := plot({pairs(x,y)},style=point): display({plotLa,plotP}, title=`Degree 7 Lagrange space curve`);