On Sun, Apr 03, 2011 at 11:02:33PM +0100, Leo Butler wrote:
> < into a file or something so it doesn't need to be done each time?
> < Anyway, I'll have a go at it when I get home this afternoon.
>
> Yes, just copy the input lines without the input labels into a
> file (it is usual to end the file name with a .mac ending).
> In Maxima:
Ok, I get these errors when running the load command in maxima:
(%i1) batch (findeq.mac);
Maxima encountered a Lisp error:
Error in PROGN [or a callee]: ((MNCTIMES SIMP) $FINDEQ $MAC) cannot be
coerced to a namestring.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
The file contains the following lines:
load(lsquares);
lsqn(data,n):=block([poly,a,coeffs,x,est,mse,model],
poly:sum(x^i*a[i],i,0,n),coeffs:delete(x,listofvars(poly)),
est:lsquares_estimates(data,[x,y],y = poly,coeffs),
model:subst(est[1],poly),
mse:sum((data[i,2]-subst(x = data[i,1],model))^2,i,1,length(data))
/length(data),
[model,mse])$
data : genmatrix(lambda([x,y], if y=1 then x else
(1+2*x+3*x^2)),6,2);
Once this is actually working how can I put my own data points in?
Thanks,
Dan