Español · Русский

MξΣ Maxima, a Computer Algebra System

Maxima user interface tips

describe 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:

:lisp 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.

Input and output labels

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.

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)

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 relocated 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.

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.

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