r/Python • • Aug 05 '19

Python's response to MATLAB

Post image
4.3k Upvotes

372 comments sorted by

View all comments

426

u/Stereoisomer Aug 05 '19 edited Aug 05 '19

In my experience, a programmer saying they actually like MATLAB immediately attracts every python dev in a five mile radius

Edit: someone edit this meme and post here for a karma double-dip I’m too lazy

31

u/Alexanderdaawesome Aug 05 '19

romans_stabbing.jpg

297

u/cue_the_strings Aug 05 '19

In my experience, a programmer saying they actually like MATLAB means they either know very little about general programming, are not primarily a programmer but an engineer or have been pidgeonholed into doing just one thing that MATLAB does okay for quite a while.

The language is ugly and some relatively normal features are horribly clunky to use (object-oriented stuff, GUI primitives, ...), antiquated syntax that reminds me of BASIC. If you used any moderately modern language, (C++, Java, JavaScript, Python, Rust, Nim, ...) or even old ones like C, Lisp, Haskell - you just cannot like it.

0

u/[deleted] Aug 05 '19

[deleted]

152

u/kaihatsusha Aug 05 '19

Per seat. Per year maintenance.

87

u/[deleted] Aug 05 '19

I ditched them at an HPC center when they wanted to charge per core on a supercomputer.

Nonsense. @Matlab, your business model is broken.

152

u/Stereoisomer Aug 05 '19 edited Aug 06 '19

I worked at a research nonprofit that houses over 300 PhDs and they wanted to charge us the commercial rate when we generate datasets and develop free software and tools for our field. We actually really wanted to use matlab but they were obstinate about not giving us the academic rate so we chose python instead. Now, a few years later, they incessantly call us trying to offer us the academic pricing but it’s way too little too late and our institution has been a large part of dragging the field towards python

42

u/[deleted] Aug 06 '19

Good!

15

u/seismic_swarm Aug 06 '19

They missed out, but this was good for everyone. Nobody should be developing in a proprietary language that offers, arguably less, than languages like Python or Julia.

18

u/Ferentzfever Aug 05 '19

Yeah, their HPC model is/was broken. I believe they've recently changed their pricing model to be similar to Abaqus pricing (i.e. expensive, but reasonable).

13

u/acousticpants Homicidal Loganberry Connoisseur Aug 06 '19

that's an Oracle level move right there. next financial year they'd be changing to charge you per CPU cycle. guaranteed.

→ More replies (2)
→ More replies (1)
→ More replies (8)

97

u/Eurynom0s Aug 05 '19

My favorite thing about Matlab is it has both i and j defaulted as the imaginary unit, but will silently let you overwrite those values. I'm not saying that's an invalid design decision, but it doesn't really make sense to spring on the intended audience: physicists/engineers/etc who don't really have a programming background but need to be able to code some simulations. That crowd is often going to want to basically just type in the equations in their textbooks (hence reserving both i and j for the imaginary unit—in electrical contexts, i is current, so they use j for the imaginary unit), which will often result in looping over ijk indices since those are what textbooks usually use for 3D vectors/matrices. That crowd will also typically not have the background to realize the potential problem here.

I found out about this via someone on reddit saying that they spent an entire summer pulling their hair out trying to figure out why their complex equation was returning a pure real result and finally figured out it was because he'd used i as a loop variable and instead of being reset to sqrt(-1), it was staying as the last value it hit while iterating through the loop. If they want to keep the behavior they should really at least print a warning about what you're doing to the console.

30

u/cue_the_strings Aug 05 '19

Our instructor warned us of the j, k that when giving us an intro to loops and stuff. This design decision further shows that MATLAB was meant for the engineering / physics crowd. As you already know, using i and j as unnamed counters is pretty much a convention in computer programming (C-derived languages especially), the designers certainly knew that it would be a problem, yet they decided they'd just make it more convenient for the non-programmer crowd.

I see MATLAB as a mutation of an ancient attempt to make a tool + language for engineers and scientists, which would be 'simple to learn' and have everything they need for numerical computation, visualization, ... But decidedly not for programmers. The dumb BASIC-like syntax is a consequence of that decision - at the time, BASIC was considered the 'easy' language for non-programmers that everybody could learn. It was even taught in schools.

Anyway, as it usually goes, once something is made one way, it's really hard to change it. There are and were large swaths of people to whom MATLAB is the only language they use. They don't know or care about any subtleties of programming as long as MATLAB helps them do their job. And those people learned it one way and are very resistant to change, they would be pissed off if the syntax was changed (say, for the better, not that they would know). So the language was just added onto and never revised, there are often multiple ways to do one thing because removing syntax is a taboo. The result is, of course, a hot mess.

→ More replies (4)
→ More replies (26)

0

u/[deleted] Aug 05 '19

[deleted]

17

u/cue_the_strings Aug 05 '19

I had it in my head that Haskell was from the 80s for some reason.

26

u/bakmano Aug 05 '19

Perhaps you've confused Haskell with Pascal.

24

u/[deleted] Aug 05 '19

The rascal!

(sorry)

15

u/LoyalSol Aug 05 '19 edited Aug 05 '19

It's ok, it's a BASIC mistake.

(Ok I'm going to go hide after that one)

→ More replies (6)
→ More replies (3)
→ More replies (3)

54

u/mexiKobe Aug 05 '19 edited Aug 05 '19

The language is ugly

Not at all for numerical calculations / matrix math etc. It’s very good for that, better than Python with numpy. Look at these comparisons https://docs.scipy.org/doc/numpy-1.15.0/user/numpy-for-matlab-users.html

I mean saying it is uglier than C++ is kind of silly. Try doing simple vectorized calculations from MATLAB but in C++ and get back to me on that. And JavaScript? Come on man lol.

But yeah the problem is when engineers and scientists only use it and try to write applications with it. I’ve seen some FUCKED UP code written in MATLAB being used at huge research hospitals and in national security, and “subversioned” with duplicates on Dropbox. It’s actually extremely common, which should be shocking

→ More replies (37)

14

u/fear_the_future Aug 05 '19

Haskell an old language? Haskell is the playground for programming language theory. It has every feature 20 years before any other mainstream language adopts them.

17

u/Zomunieo Aug 05 '19

(Lisp (would (like (a (word))))).

→ More replies (12)

33

u/koobear Aug 05 '19

Meanwhile, us R users are sitting in a corner somewhere by ourselves.

41

u/tunisia3507 Aug 05 '19

And there you can stay.

14

u/koobear Aug 05 '19

More library paste for us!

→ More replies (11)
→ More replies (11)