Hacker News new | past | comments | ask | show | jobs | submit login
Hacking for fun and profit with Mathematica and the Google Analytics API (collison.ie)
85 points by ktom on April 28, 2009 | hide | past | favorite | 5 comments



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... 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.


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]


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.


RE: My failed tweets,

Richard Fateman's reviews of Mathematica are at:

http://www.cs.berkeley.edu/~fateman/papers/mma.pdf http://www.cs.berkeley.edu/~fateman/papers/mma6rev.pdf

MockMMA is at http://www.cs.berkeley.edu/~fateman/mma1.6/

The most interesting discussions to me are in the first link: specifically, the limitations surrounding the use of pattern matching for the type system, the limitation of limiting UpValues to a single depth, and the analysis of the 'infinite' evaluation model.


I especially like the graph of user travel between pages.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: