

Hacking for fun and profit with Mathematica and the Google Analytics API - ktom
http://collison.ie/blog/2009/04/hacking-for-fun-and-profit-with-mathematica-and-the-google-analytics-api

======
DaniFong
Mathematica has completely blown me away with its power; both in the
environment and the programming language. I am, however, slightly disconcerted
by the separation of interpreter level Mathematica code and the compiled C
code that it links to. The description on the internal implementation given in
[http://reference.wolfram.com/mathematica/note/SomeNotesOnInt...](http://reference.wolfram.com/mathematica/note/SomeNotesOnInternalImplementation.html)
leave me questioning whether a language with pattern matching at its core can
ever be made to be fast enough. Perhaps that's not necessary -- a compiler is
incorporated and it does give quite a boost, but I would like, perhaps just
aesthetically, that a language just be that language all the way down.

~~~
pc
Mathematica's speed (or lack thereof) rarely bothers me; personally,
limitations caused by not having the turtles go all the way down tends to be a
bigger issue.

With that said, I find the lengths to which Mathematica takes pattern-matching
fascinating. There's something beautiful about having

    
    
      Fold[f, 0, Range[1, 5]]
    

evaluate to

    
    
      f[f[f[f[f[0, 1], 2], 3], 4], 5]

~~~
DaniFong
The issue with speed I have comes from the heavy numerical use I'm putting it
to: strongly coupled nonlinear differential equations. What worries me is that
NDSolve is 1400 pages long, written mostly in C, and relies heavily upon the
compiler framework underneath, but it still takes minutes to evaluate what
should in most cases take seconds. I suspect this is partly because the
flexibility of the language makes it difficult to optimize during compilation,
though of course it's difficult to tell from my vantage.

It would be beautiful, however, if NDSolve were implemented in the language
itself. If the speed is sufficient for numerical code, then it should be
sufficient to write that numerical code in the Mathematica language, and rely
on compilation for a speed up. But that path hasn't been taken. While the
compiler is immature, it seems that as a company it would make sense to adopt
this strategy rather than relying mostly on a monolithic kernel built in C.

Circa MMA 2, Mathematica's kernel code was about 350,000 lines of C, whereas
Maple had a Kernel of only about 20,000, with most of the routines written in
Maple itself.

Pattern matching is wonderfully beautiful as a core concept, though.

------
DTrejo
I especially like the graph of user travel between pages.

