Live data from Hacker News

Python+Scipy+Matplotlib vs Matlab?

news.ycombinator.com

11–20 of 45 posts

Re: Python+Scipy+Matplotlib vs Matlab?

#11
post #3

I've had a lot of luck building scientific / research tools in Python / NumPy with Matplotlib. Integrating Fortran / C / C++ code is extremely easy as well, things like Cython / Pyrex also ease that quite a bit as well. My biggest complaint about Matlab (besides the licensing) is that it's just a horrendously bad programming language (if you can call it a language at all). Any self-respecting hacker deserves better.…

Just thought I'd mention that `ipython -pylab` exists. It's a fantastic python repl (tab completion, all that nice stuff) which integrates nicely with matplotlib/numpy.

Matlab does have one advantage, though: scientific library support. Need neural networks, TV based image processing algorithms or something else similarly specialized? Matlab wins.

Re: Python+Scipy+Matplotlib vs Matlab?

#12
post #10

Most universities have studen license servers for Matlab afaik. And, Matlab is really really, annoyingly powerful. You've got almost anything to try your ideas, implement an academic paper. But, it is slow (execution time). Prototype with Matlab, implement with C++. That's what I usually prefer. I am not a Python expert, just learning it. but I think it will be slower than C, and less powerful than Matlab, from my pe…

I think you'd be surprised at how powerful NumPy is. Try timing multiplying large matrices (I can tell you who wins, and not by a small margin) One downside is you do have to poke around for the right functions, whereas in Matlab you have all the functions sitting in your (always global) namespace.

It seems that NumPy is the equivalent of Perl's PDL. PDL is some inline C code so you get the benefit of both languages.

Re: Python+Scipy+Matplotlib vs Matlab?

#13
post #3

I've had a lot of luck building scientific / research tools in Python / NumPy with Matplotlib. Integrating Fortran / C / C++ code is extremely easy as well, things like Cython / Pyrex also ease that quite a bit as well. My biggest complaint about Matlab (besides the licensing) is that it's just a horrendously bad programming language (if you can call it a language at all). Any self-respecting hacker deserves better.…

Just thought I'd mention that `ipython -pylab` exists. It's a fantastic python repl (tab completion, all that nice stuff) which integrates nicely with matplotlib/numpy. Matlab does have one advantage, though: scientific library support. Need neural networks, TV based image processing algorithms or something else similarly specialized? Matlab wins.

Yes, libs are my biggest concern but Python has neural net libs, don't know the quality though. Also very good image processing libs but perhaps not one for TV-stuff.

Re: Python+Scipy+Matplotlib vs Matlab?

#14
Depending on your bent, you may find R (http://www.r-project.org/) with Python (http://www.omegahat.org/RSPython/) a very powerful combination. More statistical than some of the others you mention, and sadly constrained by memory unless you play some games, you will probably find that most cutting edge stats code is available for R. Data mining and AI folks also use R, but as you point out, other matrix and functional languages may fit your specific approach.

Re: Python+Scipy+Matplotlib vs Matlab?

#15
In my opinion,"Python+Scipy+Matplotlib" can replace the "equal" libs in MATLAB. I had the same problem with python when I decided to develop a face detection software by useing Neural Networks ! In that period of time, there were no complete N.N. lib for python. I don't think that there is any comprehensive one too. long story short, if you want to stick to some small libs, that mixture is OK. But if you want to develop your field (like blending NN and DIP) you will fall in trouble .... As a solution, you can mix python and libs like OpenCV for computer vision and image processing . Check pyOpencv too :)

Re: Python+Scipy+Matplotlib vs Matlab?

#18
I'm going to say the unthinkable here:

In my Information Retrieval class, I got numpy/scipy set up and went about implementing homework assignments with it.

However, no matter how much I tried to push as much as possible down into the matrix libraries implemented in C/C++, the surrounding Python code slowed everything down. I was having trouble getting everything to finish in time to hand in my homework by the deadline.

I talked to a classmate who was using Java, and not having any speed problems at all. The night before it was due, I rewrote the whole thing in Java and got it to finish running (I handed in a day late, but at least I had something to hand in.)

I'm sure there are tricks to make things faster in Python. (For example, I later figured out a method I was calling was running all Python code, and if I had called a different method, it would have dropped directly into the fast C code.) But with Java, I didn't have to think about performance. It was just fast.

Java almost certainly has a library for anything you might possibly want to do. "But," I hear you say, "that means I have to write my program in...Java! shudder"

And I empathize with you. Which is why now I'm doing a lot of experimenting with Clojure. Fast as Java, because it compiles to the JVM (as long as you follow as few guidelines.) Access to any Java library with no extra effort on your part. (One of my favorite moments on one of Rich Hickey's Clojure video is where he shows a macro that makes Java calls requiring FEWER parentheses than Java. He was pretty excited about that.) I found a Java open source matrix library that, while not nearly as pretty as Python, got the job done.

So, that's my totally radical recommendation. Clojure + whatever Java libraries you need to get your work done.

Re: Python+Scipy+Matplotlib vs Matlab?

#19
Well... matplotlib (and scipy to a lesser extent) have atrocious design and documentation from a programming perspective. On the other hand, Matlab is worse in that regard and Python is an excellent general purpose programming language. Unless you plan on using one of the more obscure libraries that come with Matlab, I would advise the python combo.

Re: Python+Scipy+Matplotlib vs Matlab?

#20
If you're affiliated with a university, it's very likely that a Matlab license is already available to you. I do research in graphics, and I find it extremely productive to test ideas in Matlab. you can hardly find a better time-saving procedure than testing an idea in Matlab and knowing in 10 minutes that it doesn't work, instead of spending a week implementing it in C++. Once you find what works, re-implementation in C++ is a breeze.
Post reply on HN