Maxima

A Computer Algebra System

Español Русский Türkçe

Maxima and Lisp

Besides describing mathematical problems, Maxima provides its own programming language to write programs. Additionally, as it is written in Lisp, it also provides easy access to that programming language. In a Maxima session the user can enter individual Lisp commands using the prefix “:lisp”, as in the following example:

(%i1) :lisp (+ 2/7 (* 3 4 1/5))
94/35

The user can also start a Lisp session from Maxima with the command to_lisp(). And that Lisp session can be ended, returning to Maxima, with the Lisp command (to-maxima). See more details in the Lisp and Maxima section of the reference manual.

Lisp Implementations of Maxima

Maxima can be compiled with SBCL, Clisp, CCL, GCL, CMUCL, ECL, Scieneer Common Lisp (SCL), Allegro Common Lisp (ACL) and ABCL.

Ports to other ANSI Common Lisps should be straightforward and are welcome; please post a message on the Maxima mailing list if you are interested in working on a port.

When Maxima is compiled, the Lisp implementation is selected by giving to the configure script an argument of the form --enable-foolisp, where "foolisp" is the name of the Lisp implementation. ./configure --help shows a list of the Lisp implementations accepted by configure (among other options). Always specify the Lisp type; configure tries to autodetect the Lisp type if it is not specified, but it has been reported that autodetection can fail.

The compiled Maxima image can also be made executable (embedding an autonomous copy of the Lisp program used), when Clisp, SBCL or CMUCL are used. To build an executable image, the suffix -exec should be appended to the option --enable-foolisp given to the configure program.

There are various differences among different Lisp implementations, regarding speed, memory usage, error handling, support for foreign functions interface (FFI) and command line editing. Some implementations use the GNU readline library, which provides the ability to recall previously used commands and edit them. For the implementations that do not have that ability, Maxima includes the rmaxima front-end which provides advanced line-editing facilities via rlwrap.

SBCL

Steel Bank Common Lisp (SBCL), is a fork of CMUCL which differs in some minor details, but most notably, it is simpler to rebuild SBCL than CMUCL. There are SBCL implementations for Linux, several BSD systems, Solaris, Mac OS X and MS Windows.

rmaxima is recommended for use with SBCL.

Clisp

Clisp can be built with readline support, so Maxima has advanced command-line editing facilities when built with it.

Clisp is compiled to bytecodes, so Maxima running on Clisp is substantially slower than on Lisps compiled to machine instructions. On the other hand, Clisp contains code from CLN, a library for efficient computations with all kinds of numbers in arbitrary precision.

There are Clisp implementations for many platforms including MS Windows and Unix-like systems.

GCL

GCL versions starting with 2.4.3 can be built with readline support, so Maxima has advanced command-line editing facilities when built with it. GCL produces a fast Maxima executable.

Only the ANSI-enabled version of GCL works with Maxima; thus, when GCL is built, it must be configured with the --enable-ansi flag, i.e., execute ./configure --enable-ansi in the build directory before executing make. Whether GCL is ANSI-enabled or not can be determined by inspecting the banner which is printed when GCL is executed; if ANSI-enabled, the banner should say ”ANSI”. Also, the special variable *FEATURES* should include the keyword :ANSI-CL.

There are GCL implementations for many platforms including MS Windows and Unix-like systems.

CCL

Clozure Common Lisp, or CCL for short, was formerly known as OpenMCL. It is available for Linux, MS Windows and Macintosh and Maxima can be compiled with it.

CMUCL

CMUCL is a fast option for Maxima on platforms where it is available. CMUCL versions 18e and 19a are known to work. There are CMUCL implementations only for Unix-like systems (not MS Windows).

rmaxima is recommended for use with CMUCL.

ECL

ECL is a small but complete implementation of Common Lisp. The Android port of Maxima is currently built with ECL.

SCL and Allegro CL

Scieneer Common Lisp (SCL) is a fast option for Maxima for a range of Linux and Unix platforms. Allegro Common Lisp comes with many packages and interfaces, debugging and an interactive development environment. Maxima can be compiled with these two Lisp implementations, but only limited testing has been done since they are commercial non-free software.

ABCL

ABCL is a full implementation of the Common Lisp language featuring both an interpreter and a compiler, running in the JVM.

Useful Lisp Sites

Common Lisp implementation
Comparison of actively developed Common Lisp implementations.
CLHS
The Common Lisp Hyper Specification.
Common Lisp Tutorials
For those who want to start learning Lisp.
CLiki
User maintained archive of Lisp links and information.