Python vs. Matlab

Huaiyu Zhu hzhu at mars.localdomain
Sat Jun 17 16:28:53 EDT 2000


Hi,

There are several options you might consider:

If you want a Matlab clone, try Octave (http://www.che.wisc.edu/octave/). It
is GPL'ed, and source compatible to a large degree.  It uses the gnuplot
program for plotting.  If you run Linux you can also install both from rpm.

But Python has distinctive advantages: You can do OO programming with
powerful built-in data structures (list, dict).  I find that as program
structures grow they become unmanageable quickly in Matlab/Octave, but
remain as easy as ever in Python.

NumPy can do most of the matrix stuff, plus all the power of Python.
However, the expressions is really painful for someone who loves Matlab,
because it was geared towards multiarrays instead of matrices. Several
people claim that after some initial investment it is still convenient to
use, but this is not the case for me, as I found I was constantly tripped
over issues like matrix and element multiplication, and transpose behave
differently on shapes of (n,1), (1,n) and (n,), etc.

So, there also came the MatPy package which I am developing, which provides
wrappers around the packages Numpy, Gnuplot, and SpecialFunc.  It is an open
source project hosted on SourceForge.  It is currently classified as in
alpha stage, but it is usable in the features that I used or tested.  I no
longer need to use NumPy directly now and I'd claim the syntax for linear
algebra is much easier than NumPy.  However, for additional features you
need to either add them yourself (not difficult I'd say), or write to me and
wait for my free time. :-) Additional developers are very welcome.

I can't compare raw speed but for complicated programs Python is much faster
because I could use better algorithms.  For Matlab/Octave often I had to
write intermediate disk files, use sed, awk or perl to transform them, and
read in by Matlab programs, all managed by bash scripts.  For Python there's
never the need to do anything like that.

And, conclusions?  I'm obviously biased given what I'm doing.  But I'd
suggest you spend a few hours giving all three a try.  It's not so difficult
on Linux anyway.

Hope this helps.

-- 
Huaiyu Zhu                       hzhu at users.sourceforge.net
Matrix for Python Project        http://MatPy.sourceforge.net 


On 17 Jun 2000 15:39:54 +0200, Helge Avlesen <avle at rogn.ii.uib.no> wrote:
>
>I have become almost addicted to Matlab after using it extensively for
>some years, however, the licencing feels very strict after getting
>used to free and very good quality software like Emacs, Linux, etc.
>
>My main use of Matlab is reading in large binary files into
>arrays(output from simulations), do some processing with various
>matrix routines, then extract sections of the 3D arrays for plotting.
>
>Spotted Python some months ago, and liked it!  Can Python, Numpy and
>the many plotting extensions be used as a replacement for Matlab, is
>Python slower/faster etc.?  
>
>It would be nice to hear some experiences!
>
>-- 
>Helge Avlesen



More information about the Python-list mailing list