On Sat, 17 May 2014 23:13:11 -0400, Bill Cunningham wrote:

> Does Python have good mathematical capabilities? I am interested in
> learning a second language for mathematical purposes. I am considering
> looking at python, perl, fortran, Adas out. It looked too complicated to
> learn. Perl looked easy and I haven't really looked into python.

Yes, Python is excellent for mathematics. Python is rapidly taking over 
as the language of choice for scientific computing:


You say you want to learn a *second* language, but you don't say what 
your first language is. Nor do you say what sort of mathematics you wish 
to do, or at what level. Depending on what you want to do, you might be 
best off with Mathematica, if you can afford it. Otherwise, there's an 
Open Source and free alternative, Sage, which uses Python.

You may find that the IPython interactive interface to Python is useful. 
It presents an interface which should be familiar to anyone with 
experience with Mathematica. 

For symbolic maths, I like Sympy, where you can do things like this:

py> from sympy import *
py> x, y = symbols('x y')
py> diff(cos(3*x+1), x)
-3*sin(3*x + 1)
py> integrate(-3*sin(3*x+1), x)
cos(3*x + 1)

There is also Numpy and Scipy, for heavy-duty numerical mathematics.

I recommend that you start with Python 3.4, as it is the latest version 
of Python, and also because I'm the author of the statistics standard 
library. It's not a full-blown professional statistics language like R, 
Matlab or SAS, but if you need basic scientific calculator level 
statistics it is useful. Feedback on the library is always welcome.

As far as other languages go, I think that Fortran is still an excellent
language if you need to write high-powered, low-level numeric functions,
but if you just want to *use* pre-existing libraries, you are better off
with a high-level language like Python which offers interfaces to Fortran
libraries. Numpy and Scipy are very good for that.

As far as Perl goes, I find that it suffers from the same weakness as R:


that is, the learning curve is far to steep for my liking. I find Perl
too inconsistent, with far too many special cases and tricks, and not
enough of a consistent design. It's not as bad as PHP, but it gives me
the impression of a language where the only design principle is "Oh, 
that looks cool. Hand me the welding iron, and I'll weld it on 
somewhere. Anywhere will do."

Steven D'Aprano

Reply via email to