Everything I do regularly in Mathematica can be done in Python. Even though Mathematica has a mind-boggling amount of functionality, I only use a tiny proportion of it. I skimmed through some of my Mathematica files to see what functions I use and then looked for Python counterparts. I found I use less of Mathematica than I imagined.
The core mathematical functions I need are in SciPy. The plotting features are in matplotlib. The SymPy library appears to have the symbolic functionality I need, though I’m as not sure about this one.
I don’t have much experience with the Python libraries listed above. I haven’t used SymPy at all; I’ve only browsed its web site. Maybe I’ll find I’d rather work in Mathematica, particularly when I’m just trying out ideas. But I want to experiment with using Python for more tasks.
As I’ve blogged about before, I’d like to consolidate my tools. I started using Emacs again because I was frustrated with using a different editor for every kind of file. One of the things I find promising about Python is that I may be able to do more in Python and reduce the number of programming languages I use regularly.
Related posts:
Languages that are easy to pick back up
Where the Unix philosophy breaks down


{ 1 trackback }
{ 13 comments… read them below or add one }
Daniel Lemire 07.09.10 at 08:17
There is the little fact that these commercial tools (Mathematica, Maple, Matlab) tend to do some vendor lock-in. The more you invest in one particular tool, the more you have an incentive to continue. That’s a risky proposition on the long run.
I have promoted Python as an alternative to Matlab for a long time now. I had not realized we could use it as an alternative to Mathematica, but why not?
While it is slightly off-topic, Maxima is an excellent open source symbolic tool: http://maxima.sourceforge.net/
I have used Maxima, for serious work, in two research papers. Once in 2002 and once this year. I had maxima crunching polynomials for days a few months ago. It works well. It is not as smart as Mathematica or Maple, but good enough for my needs. There is a nice GUI which is very Maple-like.
Pat 07.09.10 at 08:25
Another open source symbolics package is GiNaC. This is actually a C++ library but there are Python bindings available via the PyGiNaC package.
John 07.09.10 at 08:34
Daniel: I’ve felt the vendor lock-in. I’ve used Mathematica off and on for two decades. It’s a great piece of software. How could I ever learn something else as well? But it looks like it’s not as hard as I thought.
Alasdair 07.09.10 at 08:36
…and if you use Sage (http://www.sagemath.org) you get an amazingly powerful CAS which is based on Python, so all your Python knowledge gets carried across. Sage actually contains Maxima (as well as lots of other open-source mathematical software) within it.
John 07.09.10 at 08:42
Alasdair: I’ve heard good things about SAGE. However, you can’t install it on Windows, and I’ve heard people say you can hardly install it on Linux: the best thing is to download a virtual machine with SAGE installed.
When I looked briefly at Maxima, the syntax looked awkward compared to Mathematica. Maybe it’s just a matter of familiarity. I’m sure Maxima is quite powerful.
Daniel Black 07.09.10 at 08:56
@Alasdair, you beat me to the punch. Additionally, though I haven’t used it, I know that you can access Mathematica from within Sage, if for some reason there were a Mathematica function you needed or preferred.
Hector 07.09.10 at 09:30
Lets not forget Sage: a full-blown Python-based Computer Algebra System.
Pete Hunt 07.09.10 at 10:31
+1 for Sage. Though you need to run it in a VM on Windows, I’ve found it trivial to install on Ubuntu 9 and 10 as well as Mac OS X 10.6.
Ram Rachum 07.09.10 at 11:16
The nice thing about Mathematica is that it Just Works, and that all the tools from different fields are consolidated into one program, with consistent naming conventions. Not so for Python scientific tools; I wish they will move in this direction too.
If I understand correctly, Sage is trying to do it too, but I think that their disregard for normal, non-technical people is their big problem. I spoke to them and they pretty much said that they care mostly about Linux users because most of the developers of Sage are on Linux. I personally hate this attitude… There are so many scientists on Windows and in my opinion anyone who ignores Windows will end up in obscurity.
alfC 07.09.10 at 19:32
Lately I stopped using mathematica because of the vendor lockin and because mathematica took too much control of the problem solution. And replaced it with C++ and libraries usable from C++ for numerical work, for the symbolic part I realized that in general I needed it less that I though.
Andrew 07.09.10 at 22:43
I see Sage has been mentioned. There is also the Enthought distribution of Python which is specifically aimed at computational science needs. A second option is the Python(x,y) distribution. It is a huge set of tools for Python (though you can customize it as needed) and comes with the Spyder terminal (used to be pydee). Spyder gives an interactive terminal much like MatLab.
M. Edward (Ed) Borasky 07.12.10 at 02:08
I played around with Sage but it’s way too powerful for most everything I do. And I have never learned Python – I know Perl, R and Ruby.
I’ve used Maxima but found it hard to use until I got the wxMaxima GUI version. But for general numerical computing, I’m perfectly happy with R.
Beetle B. 07.16.10 at 23:32
I really like NumPy/SciPy, etc. But regarding SymPy, are you sure it’s good enough? I know I looked at it some months ago and ruled it out for what I was trying to do (or maybe I just couldn’t do what I needed due to unfamiliarity).
I’ve compiled various versions of Sage on my Linux box over the years. It wasn’t at all difficult – however it does take hours to compile.
As for their disregard for Windows, perhaps they were careless in phrasing. They probably meant that their developers are Linux developers, and don’t know much about Windows. Likely they want a Windows version, but need developers familiar with Windows, and few/none have signed up. That’s a common problem with many open source projects (and it’s not their fault).
Also, knowing how Sage is built, it’d be a *major* challenge to get it running on Windows. It basically has custom versions of many large Linux projects within it. Some distributions don’t like it for that reason (redundancy). So to get it working on Windows, you have to port those other projects to Windows as well.