# 2.6. Python and Math¶

As a wonderful example of the penetration of Python into many disciplines,
due to its open source following, here are some thoughts shared by Alon Amit,
from a post on Quora, where he is a highly followed writer on
math and statistics topics. He is answering the question,
“As a math person, should I learn Python or Mathematica”?
He refers to `Sage`

, a very popular package, written in Python, which
supplies a number of mathemathical computational and visualization
tools:

Ordinarily I would have enquired as to the specific meaning of “math and statistics and stuff”, but frankly I think I can make a fairly strong recommendation without additional details.

I don’t see a point in learning Mathematica nowadays. It was a great and unique platform when it launched. It’s still great, but it is no longer unique. It is, however, very expensive, and isolated.

On the other hand, I’m willing to go on record and say that it’s inexcusable nowadays for any data scientist, “knowledge worker” (whatever you take that to mean), or hobbyist to be unfamiliar with Python. On top of that, for doing mathematics, the Python+Sage+Jupyter stack is currently the most natural and exciting offering, by far.

Sage is natively built on Python, and Python’s ubiquity is well established. Mathematica has an excellent programming language, but it’s not used anywhere else. The Jupyter notebook interface is historically (and very obviously) inspired by the Mathematica UI. It is an excellent UI and I’m grateful for the Jupyter project for making it freely available. With Jupyter, Mathematica’s unique UI is no longer a selling point. Sage is fantastic. It is open, rapidly evolving, and natively includes systems like GAP and PARI which exceed Mathematica’s capabilities in the relevant domains (group theory and number theory). There’s no way I’m aware of for integrating GAP with Mathematica, and I don’t see any compelling reason for anyone to build that bridge (except if Wolfram themselves decide to make this a priority). The newfangled Wolfram Language, and the Wolfram|One stack, are what Wolfram Research chose to bet the future on, and I can’t see any evidence that this bet has paid off. When you’re ready to move on beyond your desktop into cloud computing, there are dozens of relevant stacks ready for you, and Python would serve you well in virtually all of them. Mathematica will serve you well in one, and it’s not one used by pretty much anyone as far as I can tell. I’m sure there are various specialized professional applications for which Mathematica will serve you better than anything else. It’s a very strong system. But for open-ended experimentation, and for plenty of other professional applications which don’t happen to be Mathematica’s strengths, there’s really no question here. Learn Python and use Sage and Jupyter.

To be clear, you don’t need to learn Python if you just wish to experiment with math in Sage+Jupyter, the way you would in Mathematica without getting into programming. They are just as accessible to beginners.

You also mentioned statistics, which is a slightly different beast. Once again, Python is essential. Instead of Sage you would now bring in the SciPy ecosystem, including NumPy, pandas and Matplotlib (although you can certainly do lots of basic things with Sage itself). Once again, for a serious statistician or data scientist, those are essential. The only real alternative you should consider seriously is R, and I would recommend being very familiar with both.

Again, I don’t see compelling reasons to choose Mathematica for doing statistics. For example, if you decide you want to play around with TensorFlow, which is everyone’s favorite toy nowadays, having Python and pandas readily available to you is a great start. Mathematica is not.

Honestly, I don’t think “Mathematica or Python” should even be a question. Learn Python. Depending on what you want to do afterwards, also learn other programming languages (Scala, Haskell, C++, whatever, but don’t worry about the Wolfram Language). If you want to play around with math, learn Sage. If you want to play around with statistics, learn SciPy and R. Get comfortable with Jupyter/IPython.

That’s what I think, anyways.