Here's my attempt to write a guide for beginners — and some reminders for occasional users, like myself. If you find it too elementary, I also have a slightly higher-level guide to learning maxima.
Debian and most other Linux distributions have a command-line version of maxima, usually in a package with that name. If you're as un-coordinated as I am, you'll prefer this to the GUI versions like xmaxima (for the X Window System) or wxmaxima. Plain command-line maxima itself is complicated enough without having to use a mouse and navigate a nest of menus as well, so this guide will deal with just the bare-bones CLI version.
If you have never used maxima, just read on; I'll start with the most basic ideas.
If you only need a refresher on a particular topic, here are links to some important sections:
When maxima is ready for input, it presents a prompt like this:
(%i1)
The "%i" in the prompt tells you it's ready for input. The number that follows is part of a label that maxima assigns to your input. (These labels can be used in later input statements.) Here the label is "%i1".
Often, input statements to maxima are long, complicated expressions that need two or more lines. That means that a simple carriage return, <CR>, is not enough to mark the end of a statement. So maxima requires a special statement terminator:
; /* <semicolon><CR> prints output */
$ /* <dollar sign><CR> prints no output */
If you forget to type the statement terminator, and just hit <CR>, maxima will move the cursor down to the next line and wait patiently for more input. It ignores superfluous whitespace, so go ahead and type the terminator before pressing <CR> again.
If a statement prints output, that will be shown after a label like
(%o1)
where the "o" means "output" — and, again, these labels can be used in later input statements. For example:
(%i1) x; (%o1) x (%i2) y$ (%i3) %o1+%o2; (%o3) y + x (%i4)Notice that the result %o2 was actually computed; it just wasn't printed.
You'll also want to name some particular intermediate quantities, and assign values to them. I'll get to assignments later, below.
quit();Here, the empty parentheses are required because quit is a function with zero arguments. And of course the semicolon is needed to terminate the statement.
Maxima encountered a Lisp error:followed by
To enable the Lisp debugger set *debugger-hook* to nil.NO. Don't do that! The way to get back on track is to type just
:q<CR>which will get you out of Lisp and back to a normal maxima input prompt.
Similarly, if you do something wrong and find yourself looking at a prompt that says
MAXIMA>>>(often with another ">" every time you hit <CR>), the way to get back to normal input is to enter just "<colon>q":
:q<CR>Once you have the regular "%i" type of prompt, you can tell it
quit();and you're back to your shell prompt.
maxima<CR>and you should see its startup message, followed by a (%i1) prompt for input.
If the shell can't find maxima, it probably hasn't been installed. Is it in one of the directories in the list printed by an
echo $PATH<CR>command? If not, you need to install it (as root).
/* This is a comment */The input parser ignores everything in a comment, including its delimiters, and replaces the whole thing with whitespace. So comments can appear anywhere in maxima input, except in the middle of a name.
print ("The result of the last calculation was",%);Here, the print command has two arguments, separated by a comma: the string (between double-quotes), and the symbol %, which stands for the last result.
(%i1) 4+5; (%o1) 9 (%i2) 4*5; (%o2) 20 (%i3) 2^3; (%o3) 8 (%i4) 2**3; (%o4) 8Notice that the regular exponentiation operator is ^, as in C; but the ** used in Fortran is also accepted.
Besides the usual operations on integers, maxima has rational numbers, such as
(%i5) 4/5; 4 (%o5) - 5that can be converted to floating-point values:
(%i6) %,numer; (%o6) 0.8 (%i7)That "(%i6)" input illustrates two features of maxima: first, the use of "%" in an input line to mean the previous output value; and second, the addition of a comma and the condition "numer" to force decimal evaluation of any expression.
Also, notice the re-setting of the fraction in (%o5) above. That's an example of what maxima calls "two-dimensional" output. It works well for fractions, but gets messy for complicated expressions with lots of exponents and subscripts, which is why many people prefer maxima's flavors with graphical interfaces (xmaxima and wxmaxima).
(%i13) x:5; (%o13) 5 (%i14) print("The value of x is",x); The value of x is 5 (%o14) 5Notice that the "print" function has two arguments here: a text string (enclosed in double-quotes); and the variable x (which is evaluated before being printed). [ In general, print can have any number of arguments. ]
(%i15) help(); (%o15) type `describe(topic);' or `example(topic);' or `? topic'If you forget the parentheses and semicolon, maxima will complain about "incorrect syntax".
It turns out that '? topic' is just equivalent to `describe(topic);' which you can see described by entering
(%i16) ? describewhich produces a long section of the reference manual. Notice that there is no statement terminator; you just enter the question mark, a space, and the name of the command. And there is a complication: the question mark must be the first character on the line.
Unfortunately, this prints the section of the reference manual for maxima that describes the command; but the manual is written in LISP jargon, which is a more advanced topic (described in my other page about maxima.)
That's not much help if you don't know the name of a particular command. You may do a little better by typing ?? instead of ?.
A more useful form of on-line help is available through the example() function, which offers examples of the use of several topics. The problem here is that not every operation in maxima has a text file showing examples. Fortunately, the command example() (with no arguments) provides a list of all the topics for which example files exist.
There's also an apropos() function that's about as useless as the one available at a shell prompt, and for the same reason: you have to know the exact name of what you're looking for, in order to use it.
Fortunately, Debian's man page for maxima contains much good advice for beginners. If you have installed maxima, just enter
man maximaat a shell prompt, and page down past the options to the INTRODUCTORY INSTRUCTIONS, which are quite clear and helpful.
A slightly more advanced guide to maxima is here.
Copyright © 2020, 2022, 2024, 2025 Andrew T. Young
or the
alphabetic index page
or the
GF home page
or the website overview page