Using maxima for high school mathematics




On Mon, 11 Apr 2011, Daniel Dalton wrote:

< 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);


Try

batch("findeq.mac");

The arguments to batch and load should generally be strings, so they should
be quoted.

< 
< Maxima encountered a Lisp error:
< 
<  Error in PROGN [or a callee]: ((MNCTIMES SIMP) $FINDEQ $MAC) cannot be
<  coerced to a namestring.

This error message is telling you that Maxima has parsed the argument to
batch not as a string but as a product of the variable findeq and mac
("." is non-commutative multiplication in Maxima, and that cryptic
MNCTIMES SIMP is how Maxima represents this internally).


< 
< 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? 
 
 You can add something like:

 mydata : matric([1,2],[2,5], etc. );

 if you need to enter the data manually.

 Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.