Who thought of this stuff?

Matlab's documentation for the logspace function:

>> help logspace
 LOGSPACE Logarithmically spaced vector.
    LOGSPACE(X1, X2) generates a row vector of 50 logarithmically
    equally spaced points between decades 10^X1 and 10^X2.  If X2
    is pi, then the points are between 10^X1 and pi [instead].

This very odd specification is, of course, totally well-intentioned. The online documentation gives this rationale:

y = logspace(a,pi) generates the points between 10^a and pi, which is useful for digital signal processing where frequencies over this interval go around the unit circle.

Unfortunately, half the Matlab functions I read about seem to have these bizarre corner cases and caveats. I can't help but think that this is the numerical equivalent of Perl and the "penny wise, pound foolish" approach to language design: all these odd shortcuts make Matlab code (slightly) easier to write but harder to debug, read, and learn from.


  1. Have you looked at Sage? It's designed to make a lot of the headaches in math software go away.

  2. nathan: I am aware of Sage, but haven't actually tried it. (I will get around to it, someday.) For reasons mostly having to do with pre-existing code, Matlab is still usually the quickest way for me to get things done at work, despite its flaws (and I do use Python for glue when possible).

    To be clear, I'm not working with such a mammoth system that debugging Matlab code is taking up a lot of my time (thankfully!). I merely wonder whether people are actually running up against this in big production systems.