Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Python vs. Matlab

65 views
Skip to first unread message

Mongryong

unread,
Jan 22, 2003, 6:41:15 PM1/22/03
to
Python vs Matlab (or any other similar language).

Any opinions on this comparison? Benchmarks? Functionality?

One big up for Python is that it's FREE!


Chad Netzer

unread,
Jan 22, 2003, 7:09:14 PM1/22/03
to
On Wednesday 22 January 2003 15:41, Mongryong wrote:
> Python vs Matlab (or any other similar language).
>
> Any opinions on this comparison? Benchmarks? Functionality?

Python is becoming more and more popular in the Scientific community.

> One big up for Python is that it's FREE!

So are Octave, SciLab, R, etc.

Python is nice because of it's flexibilty, and ability to make use of
existing C and fortran libraries (via f2c), and it's clean, elegant
syntax. But it still has a long uphill battle to compete with all the
toolkits available for Matlab. Depending on the libraries, it can be
speed competitive with Matlab, and if the right toolkits are available,
I find I get more reuse out of my python code, typically, because I can
organize it with classes and packages.

Look at SciPy, ScientificPython, SalStat, for just some of the
possibilities. But one needs to know the problem domain before
recommending Python outright. There are many powerful tools that come
with the free Matlab workalikes, that Python may not yet have (or even
ever have).

Matlab is expensive because it has very useful and comprehensive
Toolboxes, that people are willing to pay for. But the alternatives
are getting better and better.

--
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer


Ricardo B

unread,
Jan 22, 2003, 9:59:45 PM1/22/03
to
On Wed, 22 Jan 2003 18:41:15 +0000, Mongryong wrote:

> Python vs Matlab (or any other similar language).
>
> Any opinions on this comparison? Benchmarks? Functionality?

Python is a general purpose language, Matlab (and clones) is not. For taks
envolving mathematical manipulations, it can be more straightforward, and
maybe a litte dirtier than Python. For more general purpose tasks, it can
be a pain in the ass that will have you begging for Python :-)

The real (comercial) Matlab, in what its aimed at (mostly number
crunching), is excelent.Its fast, at least in large manipulations. Don't
be iluded by the monstruous Java IDE. Its just an IDE, it can be disabled.
And you can also compile Matlab programs into binaries. And it has a huge
set of toolboxes for mathematical/engineering/etc purposes.

I don't know how fast the clones are. And their set of avaliable toolboxes
is, for what I've seen, very limited.

--
Ricardo

Cameron Laird

unread,
Jan 23, 2003, 8:38:10 AM1/23/03
to
In article <mailman.104328064...@python.org>,
.
.
.
More chatter on the same subject is starting to appear at <URL: http://
phaseit.net/claird/comp.programming/open_source_science.html >; see
"Open source in the lab", especially.
--

Cameron Laird <Cam...@Lairds.com>
Business: http://www.Phaseit.net
Personal: http://phaseit.net/claird/home.html

Alexander Schmolck

unread,
Jan 23, 2003, 10:43:27 AM1/23/03
to
Mongryong <Mong...@sympatico.ca> writes:

> Python vs Matlab (or any other similar language).
>
> Any opinions on this comparison? Benchmarks? Functionality?
>

Matlab
------

+ very good plotting
+ the "standard" in many fields that do extensive number crunching. Free code
published by scientists in several areas (e.g. pattern recognition) is
likely to be matlab and there is lots of it.
+ relating to the above point: large codebase (both free and commercial) and
large supply of builtin functionality (Numeric and Scipy cover quite a lot,
too, but not as much yet).
+ stable and mature. More so than either Scipy (currently v0.10, I think) and
Numeric (currently not properly maintained and about to be superseded by
numarray; I hasn't to say that Numeric isn't dead or abandonned, but as
numarray was supposed to take over sooner than now seems likely, there are
currently inadequate ressources for its maintenance).
+ convinient notation for linear algebra (M * N' == matrixmultiply M and the
transpose of N)
+ nice output formatting for matrices (much more convienient than that for
Numeric arrays, if you are using them for matrices)
+ pretty good "IDE"
- relatively unpleasant and crummy language
- few non-numbercrunching libraries and facilities
- therefore often a bad choice if you need to do things other than linear
algebra, even if you also need to do plenty of number crunching.
- braindead C-interface
- proprietary and expensive

Python
------

+ well designed language
+ loads of free general purpose programming libraries
+ Numeric and Scipy deliver pretty good (however more array than matrix
oriented) Numerics packages and many people are using them intensively for
all their work. Although matlab is still more popular, python is rapidly
gaining ground in the scientific community and in many aspects the design of
Numeric and Scipy is IMO superior to matlab's.
+ free in every sense of the word
+ rapidly gaining popularity as an alternative to matlab
+ reasonable C-interface as well as many projects that aim at painlessly
interleaving C or C++ code (e.g. weave) in python code or other ways of
boosting performance (psyco). My guess therfore is that it is easier to get
code to run faster if you must in python than in matlab, but I have no
benchmarks to back this up.
- no decent plotting right now (but chaco looks promising)
- awkward notation for many important matrix manipulations (partly due to a
lack of available operators in the language)
- not as many number crunching and scientific libraries and code available as
for matlab

R and Octave
------------

- I don't know much about those, so I take this with a grain of salt: Neither
appears a good choice to me compared to either matlab or python, because
they both suffer from their special purpose nature (unlike python), but
don't offer as rich a functionality as matlab and are not (I think) anywhere
near as popular as either matlab or python, even for scientifc computing. I
might be wrong, so best have a look yourself.

In summary, although matlab still seems to be the more popular number
crunching choice right now, for people who can afford it, my guess would be
that python's popularity for such purposes will increase considerably over the
next couple of years, especially as it doesn't suffer from matlab's inherent
design flaws that limit its further growth.

My solution for the moment is to use both: I wrote a transparent wrapper for
from python to matlab that lets you use matlab's functions as if they were
just another python library (taking care of most of the conversions and
intricacies behind the scenes). This allows me to quickly leverage and
evaluate existing matlab code while working within python (and it is easy to
replace those bits with python code later). I also wrote a general plotting
wrapper on top of that that is designed to use different backends, so that
once chaco is ready I could in principle just change the backend without
rewriting any of the code that uses plotting functionality (well, in theory at
least:). Since I mainly deal with matrices I also wrote a library to make
their use more convinient than Numeric arrays (or Numeric's Matrix).

All this code is free, but I haven't yet got around to publish it, but am
willing to supply it as preview version (just email me).

alex

Matt Feinstein

unread,
Jan 23, 2003, 1:48:55 PM1/23/03
to
On 22 Jan 2003 18:41:15 -0500, Mongryong <Mong...@sympatico.ca>
wrote:

>Python vs Matlab (or any other similar language).
>Any opinions on this comparison? Benchmarks? Functionality?
>One big up for Python is that it's FREE!

I've used Matlab a lot and Python a little--

Matlab does a number of essential things really well:
-- Visualizing, displaying, formatting, and annotating various kinds
of data
-- Linear algebra computations
-- Relatively small compute-it-and-display-it programs
-- Large number of specialized 'toolbox' calculations

Matlab also does a number of important things in a half-assed or ugly
fashion
-- GUIs
-- Object orientation
-- Interface to outside world
-- Non-numerical data structures

I would not bother with trying to get Python to do the things that
Matlab does well. I would be interested in leveraging Python's strong
points in a way that would help to overcome bad parts of Matlab.


Matt Feinstein does not include his email address
in the text of usenet postings.
--------
Harvard Law of Automotive Repair: Anything that goes away
by itself will come back by itself.

Laura Creighton

unread,
Jan 23, 2003, 6:30:33 PM1/23/03
to
re: lack of scientific plotting w.r.t. matlab

If you happen to need 3 dimensional plotting check out MayaVi

http://mayavi.sourceforge.net/

Tkinter interface, fully scriptable in python.

It wraps VTK http://public.kitware.com/VTK/

Laura Creighton

Harry George

unread,
Jan 24, 2003, 11:32:06 AM1/24/03
to
notspe...@dev.null (Matt Feinstein) writes:

> On 22 Jan 2003 18:41:15 -0500, Mongryong <Mong...@sympatico.ca>
> wrote:
>
> >Python vs Matlab (or any other similar language).
> >Any opinions on this comparison? Benchmarks? Functionality?
> >One big up for Python is that it's FREE!
>
> I've used Matlab a lot and Python a little--
>
> Matlab does a number of essential things really well:
> -- Visualizing, displaying, formatting, and annotating various kinds
> of data
> -- Linear algebra computations
> -- Relatively small compute-it-and-display-it programs
> -- Large number of specialized 'toolbox' calculations
>
> Matlab also does a number of important things in a half-assed or ugly
> fashion
> -- GUIs
> -- Object orientation
> -- Interface to outside world
> -- Non-numerical data structures
>
> I would not bother with trying to get Python to do the things that
> Matlab does well. I would be interested in leveraging Python's strong
> points in a way that would help to overcome bad parts of Matlab.
>

Would you use python with the bindings to Numeric, Scientific, or GSL?
Do these eat further into Matlab turf than raw Python?


>
> Matt Feinstein does not include his email address
> in the text of usenet postings.
> --------
> Harvard Law of Automotive Repair: Anything that goes away
> by itself will come back by itself.

--
harry.g...@boeing.com
6-6M31 Knowledge Management
Phone: (425) 294-8757

Matt Feinstein

unread,
Jan 24, 2003, 1:42:44 PM1/24/03
to
On Fri, 24 Jan 2003 16:32:06 GMT, Harry George
<hgg...@cola2.ca.boeing.com> wrote:

>notspe...@dev.null (Matt Feinstein) writes:
...


>> I would not bother with trying to get Python to do the things that
>> Matlab does well. I would be interested in leveraging Python's strong
>> points in a way that would help to overcome bad parts of Matlab.
>>
>Would you use python with the bindings to Numeric, Scientific, or GSL?
>Do these eat further into Matlab turf than raw Python?
>

My experience is that the place where help is needed is in specifying
sets of initializing and boundary conditions & interfaces for
computations rather than in actually doing the number crunching. This
is particularly true for big computations-- A well-designed Python
specify-the-computation library would (I suspect) allow a far clearer
and more flexible interface to a desired 'computation matrix' than
Matlab ever could.

0 new messages