1 | initial version |
spline from GSL is a numerical tool. To obtain symbolical values you can use maxima:
sage: maxima('load(interpol)')
sage: maxima('p:[[7,2],[8,2],[3,2],[6,7]]')
[[7,2],[8,2],[3,2],[6,7]]
sage: # Sage symbolic expressions
sage: p1=maxima('part(cspline(p),1,1)').sage();p1
-95/279*x^3 + 95/31*x^2 - 415/93*x - 3
sage: p2=maxima('part(cspline(p),2,1)').sage();p2
-140/93*x^3 + 1120/31*x^2 - 26740/93*x + 23582/31
sage: p3=maxima('part(cspline(p),3,1)').sage();p3
235/93*x^3 - 1505/31*x^2 + 28385/93*x - 19293/31
sage: # maxima expression for comparison
sage: maxima('cspline(p)')
(-95*x^3/279+95*x^2/31-415*x/93-3)*charfun2(x,minf,6)+(-140*x^3/93+1120*x^2/31-26740*x/93+23582/31)*charfun2(x,7,inf)+(235*x^3/93-1505*x^2/31+28385*x/93-19293/31)*charfun2(x,6,7)
2 | No.2 Revision |
spline from GSL is a numerical tool.
To obtain symbolical symbolic values you can use maxima:
sage: maxima('load(interpol)')
sage: maxima('p:[[7,2],[8,2],[3,2],[6,7]]')
[[7,2],[8,2],[3,2],[6,7]]
sage: # Sage symbolic expressions
sage: p1=maxima('part(cspline(p),1,1)').sage();p1
-95/279*x^3 + 95/31*x^2 - 415/93*x - 3
sage: p2=maxima('part(cspline(p),2,1)').sage();p2
-140/93*x^3 + 1120/31*x^2 - 26740/93*x + 23582/31
sage: p3=maxima('part(cspline(p),3,1)').sage();p3
235/93*x^3 - 1505/31*x^2 + 28385/93*x - 19293/31
sage: # maxima expression for comparison
sage: maxima('cspline(p)')
(-95*x^3/279+95*x^2/31-415*x/93-3)*charfun2(x,minf,6)+(-140*x^3/93+1120*x^2/31-26740*x/93+23582/31)*charfun2(x,7,inf)+(235*x^3/93-1505*x^2/31+28385*x/93-19293/31)*charfun2(x,6,7)