3 ms·
I really like both Python and Mathematica, but if I have a mathematics-based task, 90% of the time I'll choose Mathematica over Python. Why? Well, Mathematica
by pmiller2 16y ago
I really like both Python and Mathematica, but if I have a mathematics-based task, 90% of the time I'll choose Mathematica over Python. Why? Well, Mathematica's programming language is pleasant to work with, resembling a dialect of lisp with pattern-matching built in, but the real win is in the libraries. If you have a numerical or symbolic computing task, chances are excellent that either there's a function to do it already in the Mathematica standard library, or Mathematica will let you write it in under a page of code.
- dnautics 16y agothat's not to say that there aren't things to have pet peeves about mathematica. What's with array dereferencing being [[]]? Makes my head spin.
- gjm11 16y agoType ESC [ [ ESC and ESC ] ] ESC, and you get "thick" square bracket characters instead, which looks less silly. I think it's clear enough where the [[...]] came from: Wolfram wanted "a b" to mean "a times b", which means "a (b + c)" has to mean "a times (b plus c)", which means you need a different notation for function application; they chose square brackets, which means they aren't available for subscripting (because everything, functions included, is an expression, and expressions are subscriptable); so they needed something else. And {...} was already taken for list construction. When what you're doing in Mathematica looks more like mathematics than programming, you don't need a lot of subscripts. Presumably that's why subscripting is the thing that got the ugly notation with extra characters. (The thing I find most unpleasant about programming in Mathematica is the way it tries to use pattern-matching as the single fundamental tool. This gives Mathematica programming, for me, something of the same feel as getting a macro-expansion based system like bash or TeX to do tricky things. But I'm not all that expert with Mathematica, and it's possible that more experienced users happily internalize the details and don't get confused as I do.)
- stuhacking 16y agoI like the way you can mix and match programming notation with mathematical expressions that look like written math. You can draw up an equation that is very readable and then wrap the whole thing in a Plot[] or Manipulate[] * statement without losing that elegant style. * Manipulate is the coolest thing in the world.
- dnautics 16y agoIt took me a while to be okay with For[] loops and now I can't quit using them. Crude, but effective.
- dnautics 16y agoYeah, it was pretty clear to me... I'm just not sure why they couldn't make array dereferencing a function?
- gjm11 16y agoIf you mean having a separate dereferencing function: Dereference[myArray,1,2] is surely much worse than myArray[[1]][[2]]. If you mean having function application mean dereferencing when applied to arrays, so that you'd write myArray[1][2]: they couldn't do that because you can apply the subscripting operations to any expression, so that e.g. F[x,y][[1]] evaluates to x just like {x,y}[[1]] does. (Because {x,y} is shorthand for List[x,y], which has just the same structure as F[x,y] in Mathematica.)