3 ms·
It’s because Matlab (and Mathematica, etc) is proprietary, and therefore you always have to pay the Danegeld. So we use numpy instead because it’s extensible, i
by Robotbeat 5y ago
It’s because Matlab (and Mathematica, etc) is proprietary, and therefore you always have to pay the Danegeld. So we use numpy instead because it’s extensible, it uses all the super fast C/C++/FORTRAN stuff on the backend, and is fairly easy to learn.
I actually still would prefer Matlab as the syntax is more compact and natural than numpy (which is like a matlabified Python), but that’s probably just due to more experience in Matlab.
- pm90 5y agoYep. When I was in grad school all the labs were furiously migrating away from matlab because of its costs and confusing licensing around running multiple replicas.
- kragen 5y agoOctave is free software with Matlab syntax and Matlab-style interactivity (autoreload, etc.) I'm not a huge fan of the language (Matlab/Octave) but it certainly does make it quick to whip things up.
- Robotbeat 5y agoIt sucks compared to Matlab, though. Unfortunately. (Sci lab is better, altho not compatible.) But I have also used it in a pinch. Size of the community means Matlab or Numpy are your best options. If you aren’t happy with Matlab due to cost or licensing stuff, numpy is really good. Also integrates with a lot of Python stuff like machine vision, machine learning, etc, which have expensive or nonexistent packages in Matlab.
- kragen 5y agoInteresting! What are the drawbacks of Octave?
- sideshowb 5y agoIt feels like MATLAB? ;-)
- kragen 5y agoI mean relative to Matlab :)
- ravel-bar-foo 5y agoI used Octave for a year when my institution's Matlab license servers were being improperly administered. (I had a lot of project code written in Matlab, but the license server going down on the weekend before a conference deadline with nobody available to reboot it until Monday was a dealbreaker.) The biggest stumbling block was that Matlab has a huge and heavily used proprietary package library, and a lot of my existing code, (official) tutorials and Stack Overflow code assumed these libraries were available. In Octave I found myself reimplementing the newer parts of the Matlab image processing libraries. This led to the discovery that the Matlab and Octave builtins for handling image data are subtly different, so I ended up having to run tests in the code and write different conditional flows to make it cross-compatible. There are also subtle differences in basic behaviors (was it variable scoping? file handling?) which resulted in some surprise and frustration. Following the licensing and Octave debacle, all my latest code is written in numpy.
- kragen 5y agoThanks! I prefer Numpy myself.
- aimor 5y agoI have the same experience, but it's more than just syntax. The Matlab IDE pulls together so much in a polished and robust product. Python notebooks and IDEs (Spyder, Jupyter, PyCharm, VSCode among a few others I've tried) are frustrating to use in comparison.
- Robotbeat 5y agoYup, I agree 100%. I've been trying to use just vanilla python because of interdependency hell (and changing terms of service for anaconda), and I've been succeeding, but it's a LOT more work and less clear what's going on.
- adgjlsfhk1 5y agoI'd definitely recommend checking out Julia for this usecase. You get code that looks pretty much like matlab, but which runs like fortran/C++. (Also there is very solid and fast interop with python, so you can call anything you need from the python side).
- Robotbeat 5y agoWhat does a Julia environment look like, in practice? Is it anything like the Matlab environment, where not online is there a console and integrated editor and super easy to use debugging/performance measurement, but also all the variables are visible in the GUI? If so, I'd consider switching (as Matlab does that better than vanilla numpy). Julia is pretty great in theory. It is still a very new language for my uses, which means the documentation and community are orders of magnitude smaller than Matlab or Numpy/python.
- ForHackernews 5y agoYes(-ish). You can use Julia in a Jupyter (the Ju- is Julia) notebook, just like Python. This is a pretty user-friendly experience for students, academics and data scientists. https://towardsdatascience.com/how-to-best-use-julia-with-jupyter-82678a482677 https://towardsdatascience.com/how-to-best-use-julia-with-ju...
- Robotbeat 5y agoJupyter notebook is a lot like Mathematica. I’m wondering if visibility to variables is similar to Matlab? With Matlab, I have a list of all the variables in a nice little box, with summary of their contents (byte size, dimensions, type, contents if it’s small enough to be displayed, etc), and to see the full contents, I just double click on it. Looks like Jupyter Lab and Atom/Juno is what I’m looking for. Still not as well-integrated as Matlab is. I suppose that’s my attraction to Matlab. There’s not a bunch of different programs/environments to juggle to get a good, consistent experience for rapidly developing scientific code (for simulation, modeling, etc). All still possible.
- 5y ago