13 November, 2008

Open-source mathematics

I now usually use at work two math packages, Sage and Singular. The first is a general-purpose computer algebra system, the second is specialized for commutative algebra.

The conceit of Sage is that it binds a number of other systems together into one*, using a Python interface. To compute derivatives and integrals, for example, it actually uses Maxima, whose heritage winds on back to an MIT project called Macsyma, funded by the Department of Energy. To compute Gröbner bases, Sage uses Singular. These are generally high-quality, reliable systems, developed by researchers at academic institutions who need to solve specific problems. They are often funded by the government, so the software developed has to remain publicly available. Putting these various parts together is the essential aspect of Sage's creator, William Stein,** who has described his philosophy as not wanting to reinvent the wheel, but to build a car.

The Python interface is very nice. Most computer algebra systems (like Maxima and Singular) provide the user with a specialized language, often based on whatever language they are built on: Maxima looks like LISP; Singular looks like C. The languages can be poor in features. The user has to learn therefore a new, specialized computer language for each system. Python, by contrast, is a popular, general-purpose language used at a lot of the websites you visit. It comes with a large, well-developed library of components. Compared to programming in many other computer languages, programming Python is relatively easy.

Sage and its components are all open source (I believe the standard components are all GPL in fact) which means that you can obtain and browse the source code at your leisure. If you find a bug, you can of course report it to the developers, who are responsive. If you know a little programming, though, you can often track down the source of the bug, figure out a fix, and suggest it to the development team. I did this myself once last week.

All serious software contains bugs: small errors that means the program doesn't quite work correctly. Encountering a bug in a commercial system is an exercise in frustration: I can't look through the code to determine the cause; I can only report it to the developers, and hope that one day they'll find the interest in fixing it. Even worse, they may not send me a patched version of the software; I may have to wait until the next release, and pay for an update. In other words, I have to pay them to fix their own mistakes!

At least one major CAS developer (who shall remain nameless) gives all the appearances of having abandoned the bug-fixing process over the last few years. Instead, this company has worked overtime to include more whiz-bang features that, quite frankly, are nice, but not as necessary as a responsive, reliable system. The new features are themselves buggy, but what's worse is that they slow down the system tremendously. My department has a contract with the company, which gives us new releases for a lowered fee; the first thing I do after installing this software is turn off some of these whiz-bang features. Had the developer stuck with bug-fixing, I might have stuck with their system, both in research and teaching.

Instead, I (and, as a consequence, my students) use Sage, and I suspect the trend is only growing. Teaching is where the big money often lies for these companies, since a class of 20 Calculus students will buy the $150-ish student package (right there the company has earned $3000); the students use that version for a few years; then, if they score a job where the software is useful, they can influence their employers to purchase the professional version, which costs ten times as much as the student version.

If enough people adopt Sage, the developers might wake up and take notice.



*binds a number of other systems together into one: Hmm. One CAS to rule them all, one CAS to find them; one CAS to bring them all, and in the darkness bind them; in the land of Seattle, where the darkness lies. It works!

**Small world alert: William Stein and I were both graduate students at Northern Arizona University in the 1994-1995 school year. I earned my Master's Degree and went to teach high school for a couple of years; he went to UC Berkeley. When I (later) went to NC State, I consciously tried to imitate some of the things I had seen him do at NAU, such as typeset all my homework in the LaTeX system. My professors were impressed.

1 comment:

Clemens said...

Can't say I understand much about programming but this struck me:

"In other words, I have to pay them to fix their own mistakes!"

That was actually the business model of American car companies for a long time, or as one automotive journalist put it, they let the customer do the R & D. Glad to see the model is still alive and well.