Hacker News new | ask | show | jobs
by mc-lovin 4754 days ago
Python and Matlab are not interchangeable.

Matlab is unique in its expressiveness for numerical and matrix computation, and value semantics.

Value semantics matter a lot because they result in functional programming without even having to think about it, while copy-on-write means that you can pass big objects into pure functions and they never get copied if you don't modify them.

e.g. in Matlab, the following function is pure (and never makes a copy of big_matrix)

  function y = my_pure_function(x, big_matrix)
  x = x + big_matrix(i, j);
  y = x ^ 2;
  end
1 comments

> Python and Matlab are not interchangeable.

Matlab and Python are perfectly interchangeable for the overwhelming majority of undergrads and graduate students. Claiming that they are not interchangeable based on the difference between pass-by-reference and copy-on-write is just silly.

You're ignoring the typical use case for an engineering student: general math & plotting. In Python, that is easily accomplished with NumPy, SciPy, and Matplotlib. These are all free.

Kudos on knowing how these languages work and understanding some low-level design specifications, but negative kudos for not understanding the education system and the immense fiscal burden it places on students for books & software. Sure, many schools provide a free license... here is a little tidbit of information for you: ain't nothing free.

> Claiming that they are not interchangeable based on the difference between pass-by-reference and copy-on-write is just silly.

Actually I gave one more reason.

> Matlab is unique in its expressiveness for numerical and matrix computation

It really isn't. http://wiki.scipy.org/NumPy_for_Matlab_Users

it is.

I read that link already, in fact used it as a reference when I did convert from Matlab to python. I converted back when I realized that in spite of the apparent syntactic similarities, matlab is still very different to scipy.

In matlab, everything is a matrix. The only "gotchas" when it comes to types, is that

  f = X(X > 0)
and

  f = X(double(X > 0))
give different answers because logical indexing requires actual logical type. Apart from this, you will almost never have to do type conversions in matlab.

Python arrays are not scipy matrices or arrays. And a scipy 1 x n array is not a matrix.

All these little things add up to more time spent thinking about programming and less about mathematics.

Don't think of me as some biased matlab fanatic.

I am a grad student, and I found the appeal of python as strong as those who advocate it as a substitute for matlab. The difference is that when it came down to doing my actual work, I just couldn't do it as easily in python. I am the student whose interests you claim to be advocating, and I'm explaining why I, and so many others, make the choice of matlab.

Oh well... easy for me, hard for you. Best of luck! :)