Splines

Example from the PscFunctions package

With the help of routines of the PscFunctions package one can obtain general parametric equations of splines.  
The CPscSpline   routine generates a sequence of two or three functions that represents parametric equation of the spline with specified end conditions.  The spline curve passes through the given point set (first argument of the procedure). The type of end conditions is determined by the second (optional) argument.

>    restart;
with(PscFunctions):
x,y:=CPscSpline([[0,0],[-12,4],[-9,6],[-15,14],[-6,12],[-15/2,18],[-3,16],[0,22],[3,16],[15/2,18],[6,12],[15,14],[9,6],[12,4],[0,0]],endpoints=natural):
plot([x(t),y(t),t=0..14],thickness=2,scaling=CONSTRAINED,color=BLACK);
X=x(t);
Y=y(t);

[Maple Plot]

X = -19689936/2911+4244040/2911*t-306684/2911*t^2+14604/2911*t^3-43959/5822*abs(t-1)^3+62307/5822*abs(t-2)^3-65541/5822*abs(t-3)^3+111525/11644*abs(t-4)^3-35247/5822*abs(t-5)^3+30723/11644*abs(t-6)^3-3...
X = -19689936/2911+4244040/2911*t-306684/2911*t^2+14604/2911*t^3-43959/5822*abs(t-1)^3+62307/5822*abs(t-2)^3-65541/5822*abs(t-3)^3+111525/11644*abs(t-4)^3-35247/5822*abs(t-5)^3+30723/11644*abs(t-6)^3-3...
X = -19689936/2911+4244040/2911*t-306684/2911*t^2+14604/2911*t^3-43959/5822*abs(t-1)^3+62307/5822*abs(t-2)^3-65541/5822*abs(t-3)^3+111525/11644*abs(t-4)^3-35247/5822*abs(t-5)^3+30723/11644*abs(t-6)^3-3...

Y = -4113137/2521+901110/2521*t-64365/2521*t^2+6674/2521*abs(t-1)^3-14091/2521*abs(t-2)^3+19438/2521*abs(t-3)^3-20804/2521*abs(t-4)^3+20921/2521*abs(t-5)^3-22544/2521*abs(t-6)^3+23877/2521*abs(t-7)^3-2...
Y = -4113137/2521+901110/2521*t-64365/2521*t^2+6674/2521*abs(t-1)^3-14091/2521*abs(t-2)^3+19438/2521*abs(t-3)^3-20804/2521*abs(t-4)^3+20921/2521*abs(t-5)^3-22544/2521*abs(t-6)^3+23877/2521*abs(t-7)^3-2...
Y = -4113137/2521+901110/2521*t-64365/2521*t^2+6674/2521*abs(t-1)^3-14091/2521*abs(t-2)^3+19438/2521*abs(t-3)^3-20804/2521*abs(t-4)^3+20921/2521*abs(t-5)^3-22544/2521*abs(t-6)^3+23877/2521*abs(t-7)^3-2...

The  fPscSpline  routine computes an   expression that represents  explicit equation of the polynomial spline   of any degre.
In the following example equations of some splines of different degree passing through the same points constructed.

>    LL:=[[-5,-2],[-3,-3],[1,2],[3,2],[4,0],[5,-1],[6,0],[8,-2],[9,4],[12,-1],[15,4],[20,3],[24,-1],[25,0]]:
Z2:=x->fPscSpline(LL,x,degree=2):
Z3:=x->fPscSpline(LL,x,degree=3):
Z4:=x->fPscSpline(LL,x,degree=4):
Z5:=x->fPscSpline(LL,x,degree=5):
pnts:=plots[pointplot](LL,symbolsize=20):
pys:=plot([Z2(x),Z3(x),Z4(x),Z5(x)],x=LL[1,1]..LL[nops(LL),1],thickness=2,scaling=CONSTRAINED,color=[BLACK,BLUE,GREEN,RED]):
plots[display](pnts,pys);
'Z3'=Z3(x);

[Maple Plot]

Z3 = 16073637465751/9883298368-1908119765463/9883298368*x+84534204777/9883298368*x^2-2921785837/49416491840*x^3-8164210279/98832983680*abs(x+3)^3-1532612107/98832983680*abs(x-1)^3+7110180863/2470824592...
Z3 = 16073637465751/9883298368-1908119765463/9883298368*x+84534204777/9883298368*x^2-2921785837/49416491840*x^3-8164210279/98832983680*abs(x+3)^3-1532612107/98832983680*abs(x-1)^3+7110180863/2470824592...
Z3 = 16073637465751/9883298368-1908119765463/9883298368*x+84534204777/9883298368*x^2-2921785837/49416491840*x^3-8164210279/98832983680*abs(x+3)^3-1532612107/98832983680*abs(x-1)^3+7110180863/2470824592...
Z3 = 16073637465751/9883298368-1908119765463/9883298368*x+84534204777/9883298368*x^2-2921785837/49416491840*x^3-8164210279/98832983680*abs(x+3)^3-1532612107/98832983680*abs(x-1)^3+7110180863/2470824592...