by scythe · 4y ago · 0 comments
Python defeated Matlab. I know because I cheered it on. I was there. I watched my roommates and friends struggle with introductory scientific computing in Matlab and I joined the chorus that was practically begging for Python, even though I didn't really like it. I can't even begin to explain how awful it is to try to teach programming concepts in Matlab. But something like Python or Matlab had to be the choice because the schools wanted to teach programming through a language where you could just call "graph" and the computer would display a graph.
Python's team, unlike Lua's, aggressively courted educational institutions by offering scientific, numerical and graphical libraries within a programming language that works like a programming language, not a glorified computer algebra system. They even added a dedicated operator for matrix multiplication. It's a great example of finding a niche and filling it: I still don't like using Python, but I can't dispute that no other language/ecosystem comes close to offering what we need to teach programming to physics students.
You want to beat Python? Build a type system that can capture dimensional analysis. Warning: it won't be easy.
We also ditched simulink because it is very difficult to version control and collaborate with a graphical interface.
Matlab is pushed heavily in the schools so all the engineers knew it and were comfortable with it. Matplotlib and numpy mimicing matlab very closely allowed the transition to be easy. We're not looking back. Only a handful of people still use matlab for their individual work because the python camp hit critical mass and the transition is not hard.
Matlab working to control serial ports, ethernet, visa/gpib instruments, all without the friction of getting extra licenses was icing on the cake. Matlab has a buy the cadillac model: the wheels, doors, hood, gas cap, mirrors are all optional add-ons. Each point causes friction, as only a few people had the whole tool, and therefore nobody could reliably share code.
Curious about your thoughts on pint and Unitful.jl — pint doesn’t really go all the way to a full type system, and Unitful.jl doesn’t work with everything (autograd is a problem still I think). But Unitful.jl is super cool.
https://pint.readthedocs.io/en/stable/wrapping.html#checking...
This is the answer. Scientific Python was originally an alternative to MATLAB. When I was in grad school, I did most of my research in MATLAB. Then we had a visiting student who was doing very similar computations in SciPy, and he assured me performance was not a problem. I migrated my MATLAB scripts to Python and never looked back.
It was only after being a viable alternative to MATLAB did people decide it can be used for much more than what you typically get with MATLAB.
A benefit of Matlab remains that it all comes from one place, with one installer, meaning that you can get a classroom full of students up and running almost instantly. And it offers some relief for students who will never grasp programming, through its collection of pre-written apps.
Hang on! In what world can you just call "graph" in Python and it would display a graph?
In matplotlib on MacOS at least you try that and you get some bizarre shit about how Python isn't a framework, and you google it and find you have to do some obscure import and the import has to be in a particular order relative to other imports (totally unpythonic). https://stackoverflow.com/a/34583958/583763
Jupyter notebook... don't get me started! You do one thing and it starts a "server", and then you use that to start a "kernel" (and if my CS is dodgy and I don't really know wth these things are then I'm not having a great time already). Then this kernel thing is running Python. But oh, what version? And is it using my virtualenv? And then you google some matplotlib imports. And finally, yes you call "graph" and an ugly matplotlib png is displayed rather small in your web browser.
R however. There you just call "graph".
(In particular, that’s how things have gone in the materials physics/solid-state/quantum chemistry field. It absolutely beat out Matlab in other fields. One of the underrated benefits was being a lingua franca across more of physics!)