Installing (i)Maxima on OS X

I got interested again in Common Lisp a few months ago via the Maxima Computer Algebra System, an evolution of the DOE Macsyma project. Maxima is simply awesome, and a homage to the power of Lisp. Actually, i was looking for tensor algebra packages. Maxima does that and a lot more via its many interfaces.

Of course, there are several interaction modes to embed Maxima sessions into Emacs. The nicest one is, in my opinion, imaxima, which typesets Maxima’s output using LaTeX. Bill Clementson has published a tutorial on how to get Maxima running on OS X, using SBCL with imaxima and gnuplot. I followed the instructions and finally installed the whole pack, but only after a few tweaks that i’m posting below to save you the time of rediscovering them:

  • I’ve got SBCL 0.9.8 installed via Darwin Ports, and download the latest Maxima source tarball (5.9.2). There is a Maxima Darwin Port, but it uses CLISP.
  • The familiar configure/make/make install chore works without problems. But if then you try to run maxima, you’ll get an error from SBCL:
    fatal error encountered in SBCL pid 7275:
    more than one core file specified
    

    This is because /opt/local/bin/sbcl is actually a shell script which runs sbcl.bin with a predefined core. In turn, maxima is a shell script which invokes sbcl. So the fix is easy: create a sbcl.max containing something like

    #!/bin/sh
    /opt/local/bin/sbcl.bin "$@"
    

    and modify /usr/local/bin/maxima to invoke sbcl.max (search for exec “sbcl”). After that, invoking maxima from the command line should work just fine.

  • Now for the Emacs interface. I use Carbon Emacs, which comes with imaxima installed. So i just needed to load it. There’s an info page that tells you how to do that. Follow the instructions… and you get an error: latex complains it doesn’t know anything about ‘pagecolor’. After a bit of fiddling, i fixed that by setting the appropriate custom variables. Here is my (i)maxima emacs configuration file
  • Optionally, install the breqn LaTeX package to get multiline equation display in imaxima. I just downloaded the package and put its contents into /opt/local/texmf-local/tex/latex/breqn. Afterwards, running ‘sudo texhash’ completes the installation (you will know it worked if ‘kpsewhich breqn.sty’ locates the package).
  • Maxima uses Gnuplot to render 2D and 3D graphs. No problem: Gnuplot is included in Darwin Ports, but make sure to use the x11 variant (i had it compiled with +no_x11 and used AquaTerm).

That’s it. Surely, the above are trivial details, but still may save you a handful of minutes that you can spend far better. For instance, playing with your fresh Maxima installation. Enjoy.

Tags: , , , ,

4 Responses to “Installing (i)Maxima on OS X”

  1. DeepSpawn Says:

    Thx, stupid error, I have been all the afternoon looking for the solution to the friggin pagecolor !!!

  2. DeepSpawn Says:

    Since I can’t edit: be sure to add a \\ where a \ is required.

  3. Chad Says:

    For the record: I had the pagecolor bug on Ubuntu and OS X imaxima until I successfully installed breqn. So, it doesn’t seem optional.

  4. Brian Says:

    Is there a way to get gnuplot to use the latex formatting for the equations graphed?


Leave a Reply

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. (Log Out)

Facebook photo

You are commenting using your Facebook account. (Log Out)

Connecting to %s