see http://www.math.utexas.edu/pipermail/maxima/2013/031517.html
*Antonio Lapira* <antoniolapira at yahoo.it> writes:
> for example, I have these points: p:[[0.7, 0.5],[1.21, 1.33],
[-0.42,0.17],[-0.93,0.87], [-0.79, 0.5], [-0.55, 0.36], [-0.27, 0.05],
[0.27, 0.11], [0.5, 0.25]];
> I don't want to get a complex equation like lagrange(p)..
> the question is: is possibile to give a command and get an equation like
y=x^2 ?
I think that you can do, as here
(%i1) p:[[0.7, 0.5],[1.21, 1.33], [-0.42,0.17],[-0.93,0.87], [-0.79, 0.5],
[-0.55, 0.36], [-0.27, 0.05], [0.27, 0.11], [0.5, 0.25]]$
(%i2) f(x):=a*x^2;
(%o2) f(x):=a*x^2
(%i3) S:sum((f(p[k][1])-p[k][2])^2,k,1,length(p))$
(%i4) expand(diff(S,a));
(%o4) 7.43398732*a-6.939636
(%i5) allroots(%);
(%o5) [a=0.9335011886999]
(%i6) g:subst(%,f(x));
(%o6) 0.9335011886999*x^2
(%i7) load(draw)$
(%i8) wxdraw2d(
explicit(g,x,-1.5,1.5),
point_type=filled_circle,
point_size = 2,
points(p))$
(%t8) << Graphics >>
Answer: y=0.9335011886999*x^2
best
Aleksas D