--Boundary_(ID_Vpo0v3e2DUo2V8esoeCGfA)
Content-type: text/plain
Content-transfer-encoding: 7BIT
A while ago I said I would put together a list of tips for the Maxima
user interface. I have attached my first attempt. Comments and criticism
will be most welcome. I am not sure where this document should live. I
am open to suggestions.
--Jim
--Boundary_(ID_Vpo0v3e2DUo2V8esoeCGfA)
Content-type: text/plain; name=tips.txt; charset=ANSI_X3.4-1968
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=tips.txt
This document is a collection of tips for customizing and interacting
with the Maxima user interface.
*** 1) Shortcut: The describe command, e.g.,
describe(integrate);
can be shortened to "? ", i.e.,
? integrate
Unfortunately, this shortcut contains two exceptions to Maxima's usual
input rules:
(a) Unlike practically every other input line in Maxima, the
line does not require a semi-colon or dollar sign to signify the end
of the entry.
(b) The space is significant; "?integrate" has a
separate meaning from "? integrate"; the former calls the lisp
function "integrate".
*** 2) Shortcut: Individual lisp commands may be entered by starting the
input line with ":lisp".
Ordinarily, one enters lisp mode with to_lisp():
-----------------------------------------------------
(%i1) to_lisp();
Type (to-maxima) to restart
MAXIMA> (format t "hello from lisp~%")
hello from lisp
NIL
MAXIMA> (setf foo 1)
;
Warning: Declaring FOO special.
1
MAXIMA> (to-maxima)
Returning to Maxima
(%o1) TRUE
(%i2)
-----------------------------------------------------
The above example is equivalent to
-----------------------------------------------------
(%i1) :lisp (format t "hello from lisp~%")
hello from lisp
NIL
(%i1) :lisp (setf foo 1)
Warning: Declaring FOO special.
1
(%i1)
-----------------------------------------------------
Note that :lisp lines to not need to end with semi-colons or dollar
signs.
*** 3) Before Maxima 5.9.1, the input and output labels were C1, C2,
etc. and D1, D2, etc., respectively. Starting with 5.9.1, the C
and D characters have been changed to %i and %o. The prompts
are customizable via the inchar and outchar variables.
For example, the pre-5.9.1 behavior can be restored via
inchar:C; outchar:D;
Even though the variable names imply that they should evaluate to a
single character, the prompts may have arbitrary lengths. For example,
inchar:long_input_label; outchar:long_output_label;
are also legal values.
*** 4) Re-enabling the lisp debugger in Maxima.
As of Maxima 5.9.1, lisp errors will cause the user to be dumped into
the lisp debugger. The lisp debugger can be re-enabled by setting the
*debugger-hook* variable in lisp to nil, i.e.,
(setf *debugger-hook* nil)
To restore maxima's default behavior, set *debugger-hook* to point to
the function maxima-lisp-debugger, i.e.,
(setf *debugger-hook* #'maxima-lisp-debugger)
*** 5) Environment variables. Maxima uses several environment
variables. The following description comes from the man page:
MAXIMA_USERDIR
Points to a directory for user customization files. Maxima's
default search paths include MAXIMA_USERDIR. Default value:
$HOME/.maxima.
MAXIMA_PREFIX
Maxima looks for its input files in the directory configured at
compile time, /home/amundson/opt/maxima. Maxima can be relocated
to a different directory as long as the maxima script maintains
the same relative position with respect to the Maxima input
files. If, for some reason, the maxima script needs to be relo-
cated independently, MAXIMA_PREFIX needs to be set to point to
the top of the tree holding the input files.
MAXIMA_DIRECTORY
MAXIMA_DIRECTORY is equivalent to MAXIMA_PREFIX. It is included
only for backward compatibility with older versions of Maxima.
Maxima uses several other environment variables for communication
between the maxima script and the lisp image. All such variables start
with MAXIMA_. They should not need to be modified by the user.
*** 6) Customization files. Maxima checks for the presence of the
files maxima-init.lisp and maxima-init.mac in the search path
and loads them if available. The most logical place to put
these files is in MAXIMA_USERDIR, as defined above.
An example maxima-init.lisp that re-enables the lisp debugger:
-----------------------------------------------------
(setf *debugger-hook* nil)
(format t "*** My personal maxima-init.lisp has been loaded ***~%")
-----------------------------------------------------
An example maxima-init.mac that enables gnuplot's pm3d mode:
-----------------------------------------------------
set_plot_option([gnuplot_pm3d,true]);
print("*** My very own personal maxima-init.mac has been loaded. ***");
-----------------------------------------------------
The print/format statements are useful for debugging. They can be
removed once the init files are established to be working.
*** 7) Customizing the display of equations. The maxima variables
display2d, stardisp and linel allow for customization of the
display of equations.
display2d is a boolean controlling the formatting of displayed
equations:
-----------------------------------------------------
(%i1) display2d;
(%o1) TRUE
(%i2) x/(y^2+z^2);
x
(%o2) -------
2 2
z + y
(%i3) display2d:false;
(%o3) FALSE
(%i4) x/(y^2+z^2);
(%o4) x/(z^2+y^2)
-----------------------------------------------------
stardisp controls whether spaces or *'s are used to represent
multiplication:
-----------------------------------------------------
(%i1) stardisp;
(%o1) FALSE
(%i2) a*b*c;
(%o2) a b c
(%i3) stardisp:true;
(%o3) TRUE
(%i4) a*b*c;
(%o4) a*b*c
-----------------------------------------------------
linel controls the number of characters per line:
-----------------------------------------------------
(%i1) linel;
(%o1) 79
(%i2) ratexpand((x+y+z)^3);
3 2 2 2 2 3 2 2
(%o2) z + 3 y z + 3 x z + 3 y z + 6 x y z + 3 x z + y + 3 x y + 3 x y
3
+ x
(%i3) linel:40;
(%o3) 40
(%i4) ratexpand((x+y+z)^3);
3 2 2 2
(%o4) z + 3 y z + 3 x z + 3 y z
2 3 2
+ 6 x y z + 3 x z + y + 3 x y
2 3
+ 3 x y + x
-----------------------------------------------------
--Boundary_(ID_Vpo0v3e2DUo2V8esoeCGfA)--