MATLAB2Python

beliavsky at aol.com beliavsky at aol.com
Thu Apr 29 10:54:01 EDT 2004


Sarge <sarge at arena.invalid> wrote in message news:<D2Xjc.28117$Qc.1080799 at twister1.libero.it>...
> Hi, everybody!
> I'm a moderately experienced programmer in Matlab, and looking for a 
> free computational language (Matlab is *REALLY* expensive for an 
> individual, like me).

You should consider the (compiled) F programming language, which is a
free subset of Fortran 95 -- see http://www.fortran.com/F/index.html.
F and F95 both have array operations comparable to Matlab. You can get
a syntax comparison of Matlab and Fortran at
http://www.owlnet.rice.edu/~mech517/F90_Overview.html . Fortran 95
compilers are not in general free but much are less expensive than
Matlab. The Intel Fortran 95 compiler is free on Linux for
noncommercial use, and the open-source G95 compiler on Linux is usable
(but not yet mature) -- see http://g95.sourceforge.net/ .

> I came across Python (actually Scipy) and immediately felt 
> comfortable with the interface and syntax.
> I'm still a newbe, so, before attempting a serious work on it, I'd 
> like to hear any opinion about migration from Matlab to Python, and 
> also a rough comparison between these two languages.

I have found numerous cases where Python programs run 10-100 times
slower or more than a comparable Fortran 95 program. Look up my
previous posts here. Although both Matlab and Python are scripting
languages, much more effort has gone into optimizing the former for
speed. If execution time is more important than scripting convenience,
I recommend Fortran over Python.

An indication that Python takes the interests of beginning programmers
more seriously than those of experienced scientific programmers is
that integer division is going to be redefined in future versions of
the language -- 2/3 = 1 now but will equal 1.5 in the future. (I think
you are supposed to use 2//3). The Fortran standards committee takes
backwards compatibility much more seriously, so that code you write
now will not take on a new meaning in future versions of the language.



More information about the Python-list mailing list