Hi,
I'm new to maxima, trying to learn it by working through "Maxima
by
Example". I've run into some strange differences between the
various
frontends. I want to run the lsquares_estimates example, which
starts
with:
doline() := block ([x, y, r],
set_random_state(make_random_state (654321)),
with_stdout("fit1.dat", for i : 1 thru 10 do (
x:i,
r: -0.2 + random(0.4),
y: 1 + x + r,
print(x,y))))$
doline()$
datamatrix: read_matrix("fit1.dat");
I've saved this in a file named max.test. Running
batch(<path-to-max.test>);
in maxima running in a shell gives me the expected result, and I
can
follow up with the rest of the example:
load(lsquares)$
lsquares_estimates( datamatrix, [x, y], y = a*x + b, [a, b]);
However, running the same batch command in wxmaxima gives the
following
error:
+----------------------------------------------------------------------+
(%i1) batch("/home/tyler/math.scripts/maxima/max.test")$
batching #p/home/tyler/math.scripts/maxima/max.test
Maxima encountered a Lisp error:
Error in SYMBOL-NAME [or a callee]: "fit1.dat" is not of type
SYMBOL.
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
+----------------------------------------------------------------------+
Similarly, if I try and run the code from imaxima mode in Emacs, I
get a
lot of LaTeX errors:
+----------------------------------------------------------------------+
(%i1) batch("/home/tyler/math.scripts/maxima/max.test");
batching #p/home/tyler/math.scripts/maxima/max.test
(%i2)
doline():=block([x,y,r],set_random_state(make_random_state(654321)),
with_stdout("fit1.dat",
for i thru 10 do
(x:i,r:random(0.4)-0.2,y:r+x+1,print(x,y))))
(%i3) doline()
(%i4) datamatrix:read_matrix("fit1.dat")
\%o4\pmatrix{LaTex error in:
&\linebreak[0]1&\linebreak[0]\mathrm{linebreak}&\linebreak[0][&\linebreak[0]0&\linebreak[0]]&\linebreak[0]\mathrm{verb}&\linebreak[0]|&\linebreak[0]|&\linebreak[0]\mathrm{linebreak}&\linebreak[0][&\linebreak[0]0&\line
<similar lines snipped> LaTex error in: \cr }
(%i5) load(lsquares)$
(%i6) lsquares_estimates( datamatrix, [x, y], y = a*x + b, [a,
b]);
\%o6\left[ \left[ a=\mathrm{\%r1},\linebreak[0]b=1-LaTex error in:
\*\mathrm{\%r1} \right] \right]
Dependent equations eliminated: (1)
+----------------------------------------------------------------------+
xmaxima produces the same (correct) results as when I run maxima
in a shell. The contents of fit1.dat after running doline() in
imaxima is: 1\linebreak[0]\verb|
|\linebreak[0]1.8904297759986988\linebreak[0]\verb|
|2\linebreak[0]\verb|
|\linebreak[0]3.0708006792184199\linebreak[0]\verb|
|3\linebreak[0]\verb|
|\linebreak[0]3.9215499737129562\linebreak[0]\verb|
|4\linebreak[0]\verb|
|\linebreak[0]5.1813105366407903\linebreak[0]\verb|
|5\linebreak[0]\verb|
|\linebreak[0]5.9443320691994819\linebreak[0]\verb|
|6\linebreak[0]\verb|
|\linebreak[0]7.0155581812674983\linebreak[0]\verb|
|7\linebreak[0]\verb|
|\linebreak[0]7.8441238703147151\linebreak[0]\verb|
|8\linebreak[0]\verb|
|\linebreak[0]8.8805527006616263\linebreak[0]\verb|
|9\linebreak[0]\verb|
|\linebreak[0]9.8132057313401884\linebreak[0]\verb|
|10\linebreak[0]\verb|
|\linebreak[0]11.129174792619052\linebreak[0]\verb| | The
contents of fit1.dat after running doline() in wxmaxima is: Maxima
encountered a Lisp error: Error in SYMBOL-NAME [or a callee]: " "
is not of type SYMBOL. Automatically continuing. To reenable
the Lisp debugger set *debugger-hook* to nil. The contents of
fit1.dat after running doline() in maxima or xmaxima is: 1
1.890429775998699 2 3.07080067921842 3 3.921549973712956 4
5.18131053664079 5 5.944332069199482 6 7.015558181267498 7
7.844123870314715 8 8.880552700661626 9 9.813205731340188 10
11.12917479261905 What I'm I doing wrong here? I like the
graphical presentation of results in wxmaxima and imaxima, but
does this interact with the evaluation of commands somehow?
Thanks, Tyler Maxima 5.15.0 Using GCL 2.6.7 imaxima version 1.0b
wxMaxima 0.7.1 running on Debian GNU/Linux testing
--
Power corrupts. PowerPoint corrupts absolutely.
--Edward Tufte
http://www.wired.com/wired/archive/11.09/ppt2.html