3 ms·
I've been working with Matlab for years and have been quite intrigued by claims that SciPy is the new, better, Matlab. But every time I tried it, it felt like a
by rrrrtttt 13y ago
I've been working with Matlab for years and have been quite intrigued by claims that SciPy is the new, better, Matlab. But every time I tried it, it felt like a cheap knockoff.
For example, let's say I want to apply DCT to a matrix. In Matlab it's simply dct(A). How do you do that in Python? Well, there's scipy.fftpack.dct, but when I try it, it turns out it operates on the rows of A, instead of the columns. So I start searching the help, and find there's a parameter called "axis", with the useless description "Axis over which to compute the transform." So I try axis=1, axis=2, then finally axis=0, and presto, it works. So sure, it's functionally equivalent to Matlab, but do I really want to go through all this every time I want to accomplish a simple task?
- jurassic 13y agoSo, basically, you're panning the massive open collaborative effort behind SciPy/NumPy/Pandas because you can't be bothered to learn a slightly different and more flexible syntax? Because that's what it sounds like.
- rrrrtttt 13y agoHaving the dct operate row-wise is not a different syntax, it's broken. The dct is a linear transformation and linear transformations operate on columns, not on rows. (Unless you apply them to the transpose of the matrix, which is what the SciPy dct is doing.)
- maurits 13y agoNo it runs deeper than that. In my experience Matlab is used by people who are not programmers and don't aspire to be them. Ever. They want to easily prototype ideas and have zero interest in the machinery that makes it run. Scipy/Numpy/Pandas are, at the moment, not the comprehensive, well documented and consistent platform that Matlab is. Simple things like a less than painless install process and numpy examples like "a*b" can be element wise multiplication or matrix multiplication pending if "a" is array or matrix are enough to put of my coworkers off for at least a year or two before contemplating a switch again.
- ProblemFactory 13y agoNumpy, Scipy and Matplotlib aren't a 100% clone of Matlab, but they do provide much of similar matrix manipulation and data visualisation tools. Where they really shine though, is scientific code that needs to do a bit more than numerical computation. I've tried Matlab briefly, and it was hell. Things like parsing strange text files for the source data, scraping data from websites, pulling data in from a SQL database, or publishing the computation as a web service are all easy with Python. Spending a small bit of extra time on the core matrix code is okay to get the rest of the Python ecosystem and libraries (and even for loops that make sense).
- lake99 13y agoSciPy's description could have been better. However, if Python/SciPy feels like a cheap knockoff, it's entirely your fault. By that logic, SciPy is also a cheap knockoff of BASIC, C#, R, Tcl, etc. "NumPy and SciPy were created to do numerical and scientific computing in the most natural way with Python, not to be MATLAB® clones." [1] SciPy's DCT is meant for multidimensional arrays. Array indexing begins at 0 in Python, just like it does in many other languages. So, it's only natural that they'd count axis numbers that way too. > do I really want to go through all this every time I want to accomplish a simple task? Entirely your choice. Your choice is not a reflection on the quality of the product. [1] http://wiki.scipy.org/NumPy_for_Matlab_Users http://wiki.scipy.org/NumPy_for_Matlab_Users
- jofer 13y agoOn a side note, in the case you mentioned, it would probably be more intuitive to pass in "A.T" instead of "A", rather than using the "axis" keword.