Maxima, SBCL, Emacs, Imaxima, oh my!
Saturday, October 29, 2005
Maxima is a computer algebra system developed in Lisp and based on Macsyma. In order to understand Maxima, it's good to understand the history behind Macsyma too. Wikipedia has this to say about Macsyma:
"Macsyma is a computer algebra system that was originally developed from 1968 to 1982 at the MIT AI Lab as part of Project MAC. It was the first comprehensive symbolic mathematics system.Richard Petti has summarized some of the history around Macsyma and why it did not succeed as a commercial product and I won't repeat any of that here. However, there is an interesting history associated with how Maxima broke off from Macsyma and became an open source project. Wikipedia again provides a good summary:
The project was initiated by William A. Martin (polynomial arithmetic), Carl Engelman, and Joel Moses (indefinite integration, simplifier) in July, 1968. Additional early work was contributed by P. Loewe, T. Williams, Richard Fateman (rational functions, pattern matching, arbitrary precision floating-point), E. Tsiang (power series), and Paul Wang (limits, definite integrals).
In 1982, MIT submitted a copy of Macsyma to the United States Department of Energy, which was one of the major funders of Macsyma development. This version of Macsyma was called DOE Macsyma.
Macsyma was licensed to Symbolics in 1982. Symbolics developed Macsyma for several years, but eventually came to see it as a diversion from the sales of Lisp machines, which they considered their main business. Macsyma, Inc., was founded in 1992 by a former employee of Symbolics, and acquired Macsyma from Symbolics and continued development for several years. In 1999, Macsyma was acquired by Tenedos LLC, a holding company. At present the holding company has not rereleased or resold Macsyma, but it continues to be distributed by Symbolics."
"Maxima is a free computer algebra system, written in Lisp and released under the GNU General Public License. The software runs on all Posix platforms such as Unix, BSD, and Linux as well as under Microsoft Windows.A few years ago, when I used to use Win32, I installed a copy of Maxima on my PC to play around with it. I believe the Lisp that I used to run Maxima at that time was CLISP. A month ago, I decided to try it out again as I thought it might be useful when helping my daughter with her High School math problems. However, nowadays I only have Macs in the house and I decided to see whether I could build Maxima 5.9.1 with one of the 4 CL's that I use on a regular basis on Mac OS X. Here were the results:
Maxima is based on Macsyma, which was developed at MIT with funding from the United States Department of Energy and other government agencies. A version of Macsyma was maintained by Bill Schelter from 1982 until his death in 2001. In 1998 Schelter obtained permission from the Department of Energy to release his version under the GPL. That version, now called Maxima, is maintained by an independent group of users and developers.
Various GUIs are available for Maxima. wxMaxima is a cross platform GUI based on wxWidgets. The GNU TeXmacs mathematical editor program can be used to provide an interactive graphical user interface for Maxima. Other options include the imaxima front end as well as an Emacs interaction mode.
Since Maxima is written in Common Lisp, it is easily accessed programmatically, just as the underlying Lisp can be called from Maxima."
- Allegro Common Lisp 7.0 (Trial edition): Failed to build due to heap size limitation.
- LispWorks 4.4.5 (Personal edition): Failed to build due to heap size limitation.
- OpenMCL 1.0: Failed to build due to compile errors.
- SBCL 0.9.4: Failed to build due to compile errors.
However, I then tried building Maxima with Allegro CL 8.0beta and succeeded, so I had a working Maxima to play around with. Just recently though, I noticed that there was a new bug fix release of Maxima available (5.9.2) that was supposed to have some fixes for building with SBCL. I decided to try the new version of Maxima with the latest version of SBCL (0.9.6) and was pleased to find that everything built beautifully!
Since I now had two different CL's that I could use to build Maxima with on Mac OS X, I decided to play around with it a bit more. I started working through the Maxima Tutorial to get used to using the program. However, I was a bit unsatisfied with the "cosmetics" of the output. By default, Maxima provides a basic character representation of the mathematical output - effective and readable, but not very pretty. There are a number of different graphical alternatives for displaying Maxima output (including an interesting "proposed" McCLIM-based GUI); however, I decided to go with an Emacs-based approach as I am just a "casual" Maxima user and Emacs is the app I tend to live in when I can. I found that the Imaxima Emacs package provides support for graphical output from Maxima by using a clever technique of mixing character input with TeX output. Here's a summary of what imaxima does:
"The command imaxima provides a simple comint derived CLI mode. The command imaxima-latex prepares a LaTeX version of the Maxima buffer. Imaxima can also be hooked in to the Emacs mode included with Maxima, which provides more key bindings and other conveniences."In practice, it works identically to the character-based Maxima interface; however, the output is much prettier. Here's a screenshot with some examples taken from the Maxima Tutorial:
Much nicer! (You can see what the default character-based output would look like by looking at the tutorial page these examples were taken from). And I didn't need to use a different editor as I could get that graphical output from within Emacs.
You can also draw pretty graphics by using gnuplot with Maxima:
Nice, nice, nice! I wish I had this when I was doing math at uni - although my daughter would probably question whether they had invented computers that long ago! ;-)

