Matlab vs Python (was RE: Discussion: Introducing new operators f

chris_barker at my-deja.com chris_barker at my-deja.com
Tue Jul 18 15:48:20 EDT 2000


I have also been reading this thread with great interest, and I feel the
need to add a few of my commnets (isn't that what usenet is about?). One
of the thoughts I've had is that there has been a lot of talk about
"linear algebra", but, in fact, I think what most of us that want any of
this want is not really linear algebra, but array (or matrix, or list or
whatever) oriented syntax. I have found that people who have not used
such a thing find it hard to understand what the point is, but once you
get used to it, It becomes alomost indispensable, both for clear,
easy-to-read-and-write code, and for performance in an interpreted
language.

I spent quite a few years in grad school doing computational programming
in Matlab. I hardly EVER used linear algebra. Mostly what I used was
element-wise operations. Because of this, I was ecstatic to find that
NumPy provided element-wise operations as the default behaviour (A*B),
rather than Matlab's default to a matrix multiply. It also provides
array broadcasting, rather than having to do Matlab's "meshgrid" trick.

The other thing I've found is that I am very frustrated by not having
those kinds of elementwise operations available for other Python types.
It's fine and dandy to use NumPy arrays for numerical stuff, but when I
need to interact with other Python services, I spend a lot of time
translating back and forth. Having NumPy be more native would be great,
as well has having NumPy type functionality in other Python types.
Having to write a lot of for loops and use map a lot, when it seems so
superfluous (and slow).

So, in summary: I'd like to see:

-NumPy become part of core Python

-Element-wise operations become part of Python

-Perhaps a little nicer way to do linear algebra, but IMHO, having that
as part of native syntax falls into the realm of "special functionality"

I also have a few comments on stuff others have written (mostly
unattributed, sorry there were soo many posts to look at)

In article <3bRZA8$jD_ at openbazaar.net>,

> Personally, I find that the matrix-orientation of Matlab makes it
> harder to get things done.  I more often have 3 or higher dimensional
> arrays than I have plain old 2D matrices, so I'd rather see the more
> general Numeric Python syntax than any over-specialized matrix code.

YES! it's not the array orientation that's the problem, it's the Linear
algebra orientation. If we stick with N-d array orientation, we'll have
a widely usefull tool. (NOTE: Matlab is not the only commonly used
language with this kind of feature. FORTRAN 90 has it too.)


>Python could become the primary open source alternative to Matlab in
time
> if a few changes were made: Incorporate numpy into the core
distribution (or
> release a  distribution with it already embedded), simplify the syntax
for
> matrix operations, and improve the help facility at the interpreter.

And a good, native, platform independent, graphing package. (note:
Graphite is headed this way, but I don't know how fast)

>And you get the advantage that you can use the same syntax Matlab uses.

This is NOT an advantage. If I wanted MATLAB syntax, I'd use MATLAB or
maybe Octave or Scilab) Let's not make the same mistakes Matlab made. It
started as a linear algebra tool (MATrix LABratory), and has evolved
into a general purpose number-crunching tool (it's still suffers form
that LA heritage, and it is by no means a general purpose programming
language). I'd like to see Python remain the general purpose tool it is,
with some added number crunching capability, but not focused in Linear
Algebra.

I'm going to go check out MatPy now.

-chris



Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list