Hi Thomas,
> it looks like Maxima doesn't have any polynomial interpolation support,
>
> am I wrong ? In a software like Pari/GP, there is :
> > ?polinterpolate
.....
>
> Is there really nothing like that in Maxima ?
>
Please, see the following Maxima session.
Hope it helps.
Mario
------------------
(%i2) /* define Lagrange interpolation */
lagrange(tab) := block([n:length(tab),sum:0,prod],
for i:1 thru n do(
prod: 1,
for k:1 thru n do
if k#i then prod: prod * ('x-tab[k][1]) / (tab[i][1]-tab[k][1]),
sum: sum + prod * tab[i][2] ),
ratsimp(sum) )$
(%i3) /* empiric data */
p:[[1,0],[2,1],[3,4],[4,9],[5,16],[6,25],[7,36]]$
(%i4) lagrange(p);
2
(%o4) x - 2 x + 1
(%i5) f(x):=''%; /* polynomial as a maxima function */
2
(%o5) f(x) := x - 2 x + 1
(%i6) /* interpolate for certain values */
f(x),x=[2.3,5/7,%pi];
4 2
(%o6) [1.69, --, %pi - 2 %pi + 1]
49
(%i7) %, numer; /* floating point approximation */
(%o7) [1.69, .0816326530612245, 4.586419093909772]
(%i8) /* plot the curve together with sample data */
(%i8) plot2d([f(x),[discrete,p]],[x,0,10],
[gnuplot_curve_styles,
["with lines","with points pointsize 3"]])$
--
--------------------------
Mario Rodriguez Riotorto
www.biomates.net