Mathematica versus Sage

Quick version:  If you want to learn math get Mathematica.  If you have access to Mathematica use it.  If you have the money, buy it.  If you want to study mathematics, pray that your school provides it for free.  It’s wonderful.  If you don’t believe me watch these videos or look at the Wolfram Demonstrations Project.  I believe if every K-12 kid or college student was taught math with Mathematica far more of them would becomes scientists and engineers.  Unfortunately, Mathematica costs a lot of money.  If you don’t have the dough, consider Sage, the open source alternative.  But if there’s any way to get Mathematica, go that route.  If you can’t, let me tell you about Sage in a roundabout way.

When I was a kid I wanted to be an astronomer.  I even took astronomy and physics courses when I started college, but I hit a math wall – I finished Calculus I, but then stayed out several semesters.  When I returned to Calculus II, my math knowledge was gone.  This was partly due the distraction of girls and getting high, but I mostly blame myself for being lazy.  I didn’t have whatever it took to focus and work hard.  I’ve always wondered how my life would have been different if I had taken school more seriously when I was young, and applied myself.

Now forty years later I fantasize about testing my aging brain by studying math again.  Could I go back and relearn math, catch up to what I had learned, and go further?  It’s the old question:  Can an old dog learn new tricks?  My regrets about life involve two kinds.  First, all the real jobs I wanted, astronomer, computer scientist, robot engineer, etc. involved mastering math.  Second, my fantasy ambitions were about writing science fiction or popular science, and those involved intense verbal skills.  I think I failed at both because I’m lazy or I can’t focus deeply enough.  Now that I’m older, with fewer distractions in my life, I wonder if I could break through those barriers.

Kids today should have a better time of it because of technology.  If young grade school kids could start out learning with Mathematica it could give them a tremendous edge.  It might make the abstract and boring subject of mathematics real and alive.

One test of my old brain would be to study math again.  I eventually finished college and went into computer programming, but with office applications and databases, not with computer science concepts.  I’ve wondered if I could take my computer programming skills and apply them to learning math.  Could programming a math problem teach me to understand how math works?

Searching the web, I looked for people who had already tried this, but what I thought of as an obvious match made in heaven doesn’t bring up many hits.  Then I found “Mathematical Software and Me: A Very Personal Recollection” by William Stein.  Sage is system for using dozens of mathematical programs that have evolved on Unix/Linux OS over the years and tying them together with a Web 2.0 front end and using the programming language Python as the underlying user input language.  It’s a free, open source alternative to Mathematica and similar expensive commercial programs.  From reading many blogs I had already decided that Python was probably the best programming language to use with learning math, so Sage intrigued me.

When I started out on this project I imagined myself finding a beginning math book, maybe just a 7th grade algebra book and seeing if I could write Python programs to do the problems.  But there’s another kind of problem – math has its own language and character set of symbols.   Programs like Sage and Mathematica have to create a way to enter formulas without using the traditional symbols of math.  Imagine putting this formula into code:

MathematicaTypesetExpression

If I just used plain Python I’d have to develop my own subroutines of conversion and I didn’t want to do that.  Also, there is the problem of binary to decimal accuracy.  Often computer programs will produce 3.99999999 when I need 4.000.  Programs like Sage and Mathematic have already solved those problems with custom formula editors and built in subroutines that are time tested.  They created programming conventions for entering mathematical formula and subprograms to show that code with standard mathematical symbols.  Think of word processing for mathematicians.

What’s the difference between Mathematica and Sage?  For some people it’s thousands of dollars.  Sage has the goal of providing a free and open source alternative to the commercial Mathematica.  Since I work at a university I have access to Mathematica, and thus I’m offered a choice.  It’s an odd choice too!  Mathematica is gorgeous, elegant, refined and advanced.  Mathematica is like being at NASA with state of the art tools.  Sage is like a poor garage inventor who has to buy their own.

If I would retire from the university I would no longer have access to Mathematica.  Also, if I develop something cool and wanted to share it, with Sage I could, but if I used Mathematica, I could only share notebooks with other Mathematica users.  Mathematica is a black box, users don’t know how the results are calculated.  With Sage you can look at the source code.

Sage seems like an obvious choice, doesn’t it.  Well, there’s one huge stumbling block, you need Unix/Linux to run it – there’s no native Windows application.

Now anybody can go to the free online version of Sage called The Sage Notebook, create an account and start using it for free.  A lot of people do, and that’s the problem, sometimes processing is iffy because of demand.  Next in ease of use, is to get a Live boot CD with Sage installed on it.  Just put it in a PC, reboot and make sure the CD is the first drive to boot – this bypasses Windows on your hard drive and boots Linux instead, leaving Windows untouched.  This is a great solution so long as you don’t really get into Sage heavily.

If you happen to already use Linux or Mac OS X, you can get binaries to install on your machine, but that still leaves out all those Windows users.  The way to actually run Sage in Windows is to install a virtual machine on your Windows PC.  Currently the Sage docs recommend VirtualBox, but that solution seems to be on the way out, and you need to use the free VMWare Player because at the Sage mirrors all they offer is the sage-vmware distributions.

Sage constructed a VMware distribution that you can load directly and run – no installing Ubuntu and Sage in steps.  The VMware distro has been pre-customized with all the Sage utilities.  This works very slick.  You can run Sage from within the virtual machine, or get it running as a server app, minimize the VMware window and call Sage from your Windows browser (the Sage notebook is just a Web 2.0 app.).

I’ve used all four different methods, online, LiveCD, Linux box, and Windows with VMWare.  All work.  Depending on how heavy duty your math processing needs are, will determine which version you want.  However, you have to get used to using a program that’s running other programs under Linux, and that can be tricky.  If you are a math teacher and want to use Sage with your students you’ll want to set up a Linux box that has some horsepower and then run Sage as a server app to Windows and Mac machines in your lab.

If Mathematica was free like Sage, I’d just recommend everyone use it.  It’s much easier to set up and far more consistent in its use.  It’s a shame that Mathematica isn’t given to every K-12 and college kid in the world. Mathematica would be a fantastic teaching platform, but it’s just so damn expensive.  But if little kids were taught to use Mathematica (or Sage) when they got their first math lessons a far greater percentage of the population would think mathematically.

What William Stein offers is a free alternative to Mathematica.  It requires a bit more work and knowledge to set up and use.  In fact, its Unix/Linux origins will turn off most users, so I’d recommend to math teachers to set up a Sage server and just get the kids used to Sage Notebook online.

Sage doesn’t teach math.  Mathematica and Sage are like the ultimate graphing math calculator, but with the notebook feature, it can record and animate math and statistics.  To see the potential of Sage see “Exploring Mathematics with Sage” by P. Lutus, especially the pages that start with “Trapezoidal Storage Tanks.”  This is fairly advanced math, but it illustrates what math teachers could require of their students.  Set up a problem, illustrate how to break it down mathematically, and then show the formula working with Sage.

You can visit the Sage Notebook site where users have saved and posted their notebooks online for all to see.  Studying these notebooks show the diverse way mathematics is applied to many problems.  This is the language of math, science and engineering.  I’d like to think if I had access to Sage when I was in grade school my life would have been significantly different.

Like I said, it would be best if Mathematica was given to all kids.  If that isn’t practical, I would recommend trying Sage.

JWH – 8/1/10