I’d like to dedicate this blop post to extolling the many virtues of the Maxima symbolic manipulation program (SMP).
As I’ve mentioned in previous posts, I’m currently working on a paper that applies the representation theory of (mathematical) groups to quantum computing algorithms. I’m glad to say that this paper is almost finished! Most of the research part of it is done. Now I just have to write up my results. I’m planning to write a patent and an arXiv paper based on this work. I was able to do the research very quickly (for me). Did I cheat? No, but it feels like it. Normally, it would have taken me forever to do all the algebraic calculations associated with this project, but instead, I was able to do them very quickly because I was using a SMP, namely Maxima. I am immensely grateful to the hundreds of scientists that have contributed to Maxima.
The moral of this blog post is: Maxima is very well suited for doing certain aspects of quantum computing research, in particular stuff that involves symbolic manipulation of matrices. My current QC research involves a lot of this.
For my current paper, I had to be able to do all of the following symbolically (not numerically) without too much hassle and Maxima did not disappoint:
defining matrices, multiplying matrices, generating matrices that involve direct sums or Kronecker products of simpler matrices, finding the eigenvalues and eigenvectors of a matrix, finding the SVD (singular value decomposition) of a matrix, finding the CSD (Cosine-Sine Decomposition) of a matrix (the CSD is extremely useful when compiling a unitary matrix.), extracting submatices from a given matrix, etc., etc.
Maxima is easy to learn and the above tasks are easy to code. Furthermore, I have yet to find a serious bug in Maxima, or have it crash on me, and the beast is lightning fast at symbolics, which is what I needed for my current paper. On the other hand, Maxima is very limited in numerics. For that, use some other software. See numerics footnote below.
I was going to include in this blog post some examples of Maxima code, to whet your appetite, but I decided against it. What the heck, my next paper will include as an appendix a file with lots of Maxima code relevant to the paper. That should illustrate well enough to the budding quantum computerist how I use Maxima to help me write quantum computer code.
The Macsyma and Maxima codebases forked in 1982. Luckily, they haven’t diverged syntax-wise too much since then. After 1982, Macsyma added many new features but the syntax for all the basic stuff is still almost identical for both.
As for documentation available on the web, Maxima comes with a manual which is medium good (it’s not too bad but it could use more and better examples). I like very much the following tutorial originally produced by Symbolics and now available at the website of Richard J. Fateman (a Berkeley Univ. Prof. Emeritus, and one of the original authors of Macsyma while he was at MIT)
I found this tutorial to be really easy to read, fairly comprehensive, and with very good examples. This Macsyma “user’s guide” is not to be confused with the much longer but less friendly Macsyma “reference manual”. Whenever I copy a code line from the above mentioned Macsyma user’s guide and I find that the command line doesn’t work on Maxima, I then go to the Maxima manual and look in there for those changes, usually minor ones, that will make that particular code line more agreeable to Maxima.
Nowadays, most commercial SMPs have “notebooks” for storing and replaying your work. Maxima doesn’t have notebooks yet but I didn’t find this to be a big drawback for the work I was doing for my current paper. This is how I usually work with Maxima: I write all my commands first in a “project” txt file. Then I copy and paste those commands onto the Maxima command line. At the end of a Maxima session, I only save the project txt file. I begin each Maxima session by replaying all the commands in my latest project txt file.
Let me conclude this post with a brief overview of the bitter and turbulent history behind Macsyma/Maxima.
Brief History of Macsyma/Maxima
Macsyma, the first SMP, was developed at MIT from 1968 to 1982 with DOE and DARPA funding. After that, Macsyma passed into commercial hands (first Symbolics, then others). Between 1982-1999, many new features were added to the commercial version of Macsyma. Maxima is based on the last non-commercial, 1982 version of Macsyma. Maxima doesn’t include the features added to Macsyma from 1982-1999, but it has added a few features of its own, and it is available for a wide number of platforms as free, open, GPL-licensed software.
Although many have tried, nobody has ever been able to create a long-term stable and successful company based on Macsyma, this despite the fact that Macsyma software is quite robust and useful. This failure seems to have occurred for several reasons. One of them is that, as is well document throughout the Internet, there have been some bitter disagreements, infighting and nasty politics between many of Macsyma’s legal guardians (MIT academics, MIT management, Symbolics management, investors, DOE, etc.). Another reason seems to be that Stephen Wolfram ultimately proved himself to be a better businessman than those behind Macsyma. Macsyma can still be purchased for $500 today, but development of it has completely stopped. Nowadays, most of the commercial SMP market share belongs to Mathematica and Maple.
Wolfram didn’t like the fact that Macsyma was written in Lisp so he started writing his own SMP, originally called SMP, in the C language. His SMP was the basis of Mathematica. In the early days, Mathematica was weaker than Macsyma in symbolics but faster in numerics. Nowadays, Mathematica has a gazillion more bells and whistles than Macsyma/Maxima.
A footnote on Numerics
For numerics, you can use the free Lapack and non-free Matlab. The Octave program is a free partial clone of MatLab, certainly not as complete as MatLab, but good enough for doing basic stuff, and it has a syntax almost identical to Matlab’s for the basic suff. For my quantum computing software available at http://www.ar-tiste.com, I’ve used Lapack (in Qubiter, which is written in C++, but calls CLapack, the C translation of Lapack) and I’ve also used Octave (for my M-Fun For QC Progs)