Are computer algebra bugs good for us?

November 4th, 2008 | Categories: math software, mathematica, matlab | Tags:

One comment about my recent review of the new symbolic toolbox for MATLAB 2008b was that I didn’t mention any bugs. To be fair to me I simply didn’t know of any back then but things change so here is one for your viewing pleasure. The following problem with the solve command was originally mentioned on the matlab newsgroup a few days ago.

solve ('x^(5/2) + x^(1/2) = 42')

ans =

The solution should have been as follows (found with version 2007b of MATLAB and the symbolic toolbox)

ans =

Mathworks are aware of the problem and I am sure a fix will be released soon. So why have I chosen to focus on this you may ask?

Well, I have a rather strange relationship with bugs like this in computer algebra software in that I think that they are immeasurably useful! I love finding bugs in programs like MATLAB and Mathematica and will often make as much noise as possible about them. Is this because I hate the likes of Wolfram Research and Mathworks? Do I want to rip into them at every possible opportunity? Do I enjoy seeing big companies fail?

Not even close. Quite the opposite in fact.

Systems such as Mathematica and MATLAB seem almost impossibly powerful – they can do calculations that are far beyond my feeble little mind and they can do plenty of things beyond the ken of much more powerful minds too. It’s very tempting to take whatever results they spit out and present them as the correct answer. Always. All the time. Without exception. Mathematica/MATLAB gives this or that answer so it must be true! Right?

Wrong! So wrong that I go a funny shade of red whenever I see this opinion being expressed. Computer programs are developed by ordinary, everyday people just like you and me. They just happen to be rather good at programming computers. People make mistakes so we should expect that the programs they create will make mistakes too. This is no big deal and is nothing to lose sleep over – it’s just the way things are. I make mistakes, you make mistakes and Shock! Horror! MATLAB makes mistakes too.

Once you know and accept this you simply factor it into the way you work. When you plug a problem into Mathematica or MATLAB make sure that you think about the result you expect to get. Does the output look reasonable or is it clearly a load of old hogwash? If it does look reasonable then can you compute it via another method to check that there is nothing wrong with the first algorithm you tried?

How much does the correct result matter? If it is a matter of life and death then check it again and again. Then once more just for good measure. If it doesn’t matter so much then maybe check it just the once – or maybe not at all if it’s no big deal. Just be aware that it might be wrong.

There is no need to be too concerned though since one of the reasons why bugs like the one above are so interesting is that they are actually quite rare. I can sit in front of MATLAB day after day and never uncover a single bug – it’s pretty good at what it does to be fair. So…you can safely trust MATLAB – most of the time at least :)

I think that the occasional bug or two is good for the soul as they remind us that nothing is infallible – not even programs like MATLAB and it’s almost a shame that The Mathworks fixes them so quickly. So…go forth and find bugs. Don’t be afraid of them but learn from them. When you do find one, please tell me all about it though as I love a good bug! It’s probably best to tell the vendor about it too though, after all they are the ones who can fix it.

Finally, if anyone from The Mathworks or Wolfram Research is reading this, then I have a request if I may. Take a look through your bug database and try to pick out a really juicy one for us. It could be a symbolic integral that your system couldn’t do or maybe a numerical result that is so far from being correct it’s not even funny. Why did your program fail with that particular problem? If it is a straightforward programming bug then it’s probably not very interesting to the general reader but if there is something tricky about the mathematics that you had to overcome then I bet there will be a lot of people who would be interested in hearing about it.

Me for one!

If you enjoyed this article, feel free to click here to subscribe to my RSS Feed.

  1. November 5th, 2008 at 13:12
    Reply | Quote | #1

    Mike –

    This is a very interesting post – I’ve never seen quite this perspective on bugs. As you’ve noticed, we (The MathWorks) take bugs very seriously. The most important ones to us are bugs that cause incorrect answers to be generated, particularly given MATLAB’s de facto position as the gold standard for computational numerics. The particular bug you point out is interesting – it’s actually most likely a Maple bug, since Maple provided the computational engine behind our Symbolic Math Toolbox until recently. I should note that it’s very likely that MapleSoft has long since fixed the problem, and we might not have yet integrated their fix.

    One side note about Symbolic – we’ve released a major new version along with R2008B (came out last month). We are now using the MuPad symbolic engine, and have tightly integrated MuPad (the language, and the notebook interface) directly into the product. We’d certainly love to hear what you think if you can get your hands on it.

    Keep up the great posts – I really enjoy reading your blog.
    – Scott

  2. Mike Croucher
    November 5th, 2008 at 13:31
    Reply | Quote | #2

    Hi Scott

    Thanks for your comment – it’s always good to hear from the Mathworks. The bug in question is in fact for the new symbolic toolbox – 2008b using Mupad. The old one gets it right :)

    Regarding the new symbolic toolbox – I have been playing with it for a while now and posted a review of it a few days ago. Overall I like it but, as you might expect, there are compatibility issues as well as a few new bugs ;)

    Finally, I just checked out your page on MATLAB Central – there is some great stuff there by the looks of things. Will be looking at some of your files in more detail soon.


1 trackbacks