Live data from Hacker News

In Defense of Matlab Code

runmat.org

61–70 of 174 posts

Re: In Defense of Matlab Code

#61
post #15
post #7

Earlier quoted context omitted.

Precisely; today Julia already solves many of those problems. It also removes many of Matlab's footguns like `[1,2,3] + [4;5;6]`, or also `diag(rand(m,n))` doing two different things depending on whether m or n are 1.

I don't think Julia really solves any problems that aren't already solved by Python. Python is sometimes slower (hot loops), but for that you have Numba. And if something is truly performance critical, it should be written or rewritten in C++ anyway. But Julia also introduces new problems, such as JIT warmup (so it's not really suitable for scripting) and is still not considered trustworthy: https://yuri.is/not-julia…

> I don't think Julia really solves any problems that aren't already solved by Python.

But isn't the whole point of this article that Matlab is more readable than Python (i.e. solves the readability problem)? The Matlab and Julia code for the provided example are equivalent[1]: which means Julia has more readable math than Python.

[1]: Technically, the article's code will not work in Julia because Julia gives semantic meaning to commas in brackets, while Matlab does not. It is perfectly valid to use spaces as separators in Matlab, meaning that the following Julia code is also valid Matlab which is equivalent to the Matlab code block provided in the article.

    X = [ 1 2 3 ];
    Y = [ 1 2 3;
          4 5 6;
          7 8 9 ];
    Z = Y * X';
    W = [ Z Z ];

Re: In Defense of Matlab Code

#62
post #38

For MATLAB, there exist many high quality free and/r open source toolboxes from community and academia. Also there are high quality free and/or open source alternatives. GNU Octave https://octave.org and Octave online https://octave-online.net/ Freemat https://freemat.sourceforge.net/ (sadly no ongoing development) Scilab https://www.scilab.org/ and Scilab online https://cloud.scilab.in/

Shameless plug for RunMat (we wrote this blog article, also an open source alternative for MATLAB): https://runmat.org

glad I have your ear

as much as I love the meme in your post, it's the reason I won't be able to share it with work colleagues who use matlab every day

just something to consider

Re: In Defense of Matlab Code

#63
post #15
post #7

Earlier quoted context omitted.

Precisely; today Julia already solves many of those problems. It also removes many of Matlab's footguns like `[1,2,3] + [4;5;6]`, or also `diag(rand(m,n))` doing two different things depending on whether m or n are 1.

I don't think Julia really solves any problems that aren't already solved by Python. Python is sometimes slower (hot loops), but for that you have Numba. And if something is truly performance critical, it should be written or rewritten in C++ anyway. But Julia also introduces new problems, such as JIT warmup (so it's not really suitable for scripting) and is still not considered trustworthy: https://yuri.is/not-julia…

>I don't think Julia really solves any problems that aren't already solved by Python.

You read the article that compares MATLAB to Python? It's saying MATLAB, although some issues exist, still relevant because it's math-like. GP points out Julia is also math-like without those issues.

Re: In Defense of Matlab Code

#64
post #45

Matlab is an great tool, if you can afford it. It was a very unpleasant feeling when I graduated from my PhD and realized that most, if not all, of the Matlab scripts I had used for my research would now be useless to me unless I joined a company or national laboratory that paid for licenses with the specific toolboxes I had used. I'm glad that a significant portion of tools in my current field are in open source lan…

> And yes, I'm aware of Octave. It does not have the capabilities of Matlab in the areas that I worked in

Was there a specific reason for that? Or was it simply nobody wrote the code?

Re: In Defense of Matlab Code

#65
post #15

Earlier quoted context omitted.

I don't think Julia really solves any problems that aren't already solved by Python. Python is sometimes slower (hot loops), but for that you have Numba. And if something is truly performance critical, it should be written or rewritten in C++ anyway. But Julia also introduces new problems, such as JIT warmup (so it's not really suitable for scripting) and is still not considered trustworthy: https://yuri.is/not-julia…

> I don't think Julia really solves any problems that aren't already solved by Python. But isn't the whole point of this article that Matlab is more readable than Python (i.e. solves the readability problem)? The Matlab and Julia code for the provided example are equivalent[1]: which means Julia has more readable math than Python. [1]: Technically, the article's code will not work in Julia because Julia gives semanti…

This snippet is also cleaner than one in article and more in spirit. Also the image next to whiteboard has a no-commas example.

Re: In Defense of Matlab Code

#66
post #15
post #7

Earlier quoted context omitted.

Precisely; today Julia already solves many of those problems. It also removes many of Matlab's footguns like `[1,2,3] + [4;5;6]`, or also `diag(rand(m,n))` doing two different things depending on whether m or n are 1.

I don't think Julia really solves any problems that aren't already solved by Python. Python is sometimes slower (hot loops), but for that you have Numba. And if something is truly performance critical, it should be written or rewritten in C++ anyway. But Julia also introduces new problems, such as JIT warmup (so it's not really suitable for scripting) and is still not considered trustworthy: https://yuri.is/not-julia…

Sometimes slower? No, always slower. And no one wants to deal with the mess that is creating an interface with C or C++. And I wouldn’t want to code in that either, way too much time, effort, headache.

Re: In Defense of Matlab Code

#67
post #64
post #45

Matlab is an great tool, if you can afford it. It was a very unpleasant feeling when I graduated from my PhD and realized that most, if not all, of the Matlab scripts I had used for my research would now be useless to me unless I joined a company or national laboratory that paid for licenses with the specific toolboxes I had used. I'm glad that a significant portion of tools in my current field are in open source lan…

> And yes, I'm aware of Octave. It does not have the capabilities of Matlab in the areas that I worked in Was there a specific reason for that? Or was it simply nobody wrote the code?

Octave has not implemented all of Matlab's functionality. You can see a list of Matlab functions that have not yet been implemented in Octave at the link below. It's a long list.

https://hg.savannah.gnu.org/hgweb/octave/file/tip/scripts/he...

EDIT: If the original link above isn't working, here's a fairly recent archived version:

https://web.archive.org/web/20250123192851/https://hg.savann...

Re: In Defense of Matlab Code

#68
post #64
post #45

Matlab is an great tool, if you can afford it. It was a very unpleasant feeling when I graduated from my PhD and realized that most, if not all, of the Matlab scripts I had used for my research would now be useless to me unless I joined a company or national laboratory that paid for licenses with the specific toolboxes I had used. I'm glad that a significant portion of tools in my current field are in open source lan…

> And yes, I'm aware of Octave. It does not have the capabilities of Matlab in the areas that I worked in Was there a specific reason for that? Or was it simply nobody wrote the code?

You could say that no one wrote that code. But Matlab has serious packages in numerous engineering fields and it’s not anywhere close to easily replicable.

It’s like how open source will never replace Excel but probably worse because it’s multiple fields and it’s way harder to replicate it.

Re: In Defense of Matlab Code

#69
post #62
post #38

Earlier quoted context omitted.

Shameless plug for RunMat (we wrote this blog article, also an open source alternative for MATLAB): https://runmat.org

glad I have your ear as much as I love the meme in your post, it's the reason I won't be able to share it with work colleagues who use matlab every day just something to consider

Appreciate the comment actually! It's good feedback -- we weren't sure if it's mixing work/memes too much, and keeping our materials clean like engineering docs are probably a good way to go. We may edit it out of the post.

Cheers for the comment!

Re: In Defense of Matlab Code

#70

There's also Julia. Earlier in my career, I found that my employers would often not buy Matlab licenses, or would make everyone share even when it was a resource needed daily by everyone. Not having access to the closed-source, proprietary tool hurt my ability to be effective. So I started doing my "whiteboard coding" in Julia and still do.

I remember the pitch for Julia early on being matlab-like syntax, C-like performance. When I've heard Julia mentioned more recently, the main feature that gets highlighted is multiple-dispatch. https://www.youtube.com/watch?v=kc9HwsxE1OY I think it seems pretty interesting.

Julia is actually faster than C for some things.
Post reply on HN