56 comments

[ 3.1 ms ] story [ 64.9 ms ] thread
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 still clunky for these purposes! you can't even plot two things at the same time without it being weird and there's still a ton of textual noise when expressing linear algebra in it. (in fact, i'd argue the type system makes it worse!)

matlab is like what it would look like to put the math in an ascii email just like how python is what it would look like to write pseudocode and in both cases it is a good thing.

simulink is the matlab moat ,not just general math expression
> # We must reshape X to be a column vector (3,1)

> # or rely on broadcasting rules carefully.

> Z = Y @ X.reshape(3, 1)

Why not use X.transpose()?

> Why not use X.transpose()?

Or just X.T, the shorthand alias for that

Interesting... I wrote a similar post about MATLAB's syntax a while ago, and I still think MATLAB is one of the best calculators on the market.

RunMat is an interesting idea, but a lot of MATLAB's utility comes from the toolboxes, and unless RunMat supports every single toolbox I need, I'm going to be reaching for that expensive MATLAB license over and over again.

It's funny that you listed 1-based index as a strength, and another poster here lists it as a weakness. Goes to show there's really no agreement when it comes to indexing!
Matlab code is fantastic for prototypes and for getting a "feeling" before doing the expensive optimal implementation.
Many people use Octave https://octave.org/ which is compatible (generally) with Matlab, supports this simple syntax, and is open source software. Indeed, I've taken at least one class where the instructor asked people use Octave for these kinds of calculations.
Yep -- Octave was very helpful for me in school.

Octave is not particularly fast.

RunMat is very fast (orders of magnitude -- see benchmarks).

Its been a while since I worked with MATLAB and others. Whats up with GNU Octave these days? IIRC thats what folks were championing 10 years ago when anyone was talking about the problems with MATLAB.
As an engineer, I use Matlab (or rather, Octave the free equivalent) all the time. It's really great for numerical computing and plotting. Most things 'just work', there's a sizeable collection of packages, and I personally like how flexible the function inputs are.

Biggest drawback though is that it's over-optimized for matrix math, that it forces you to think about everything as matrices, even if that's not how your data naturally lies. The first thing they teach about performant Matlab code is that simple for-loops will tank performance. And you feel it pretty quickly, I saw a case once of some image processing, with a 1000x speedup from Matlab-optimized syntax.

Other things issues I've run into are string handling (painful), and generally OOP is unnatural. Would love to see something with the convenient math syntax of Matlab, but with broader ease of use of something like JS.

It's one of those languages that outgrew its original purpose, as did Python IMHO. So non-matrix operations like string processing and manipulation of data structures like tables (surprisingly, graphs are not bad) become unwieldy in MATLAB - much like Python's syntax becomes unwieldy in array calculations, as illustrated in the original post.
Yes, strings appear like an afterthought, and sadly the Octave version has slight incompatibilities which may be a PITA for any non trivial script which aims to be compatible.
Simulink is great for Rapid Prototyping
What a terrible article. The author does not understand matlab at all and he is also either lying or totally clueless.

Matlab is successful because of precisely one thing, which nobody has replicated. It offers a complete software environment from one source.

Nowhere else can you get scientific computing, a GUI toolkit, a high level embedded software environment, a HiL/SiL toolkit, a model based simulation environment, a plotting and visualization toolkit and so much more in a single cohesive package. Nobody else has any offering that comes even close.

>The engine is closed source. You cannot see how fft or ode45 are implemented under the hood. For high-stakes engineering, not being able to audit your tools is a risk.

This is just a lie. Open matlab and you can inspect all the implementation details behind ode45. It is not a black box.

>The Cloud Gap: Modern engineering happens in CI/CD pipelines, Docker containers, and cloud clusters. Integrating a heavy, licensed desktop application into these lightweight, automated workflows is painful.

Another lie. See: https://de.mathworks.com/help/compiler/package-matlab-standa... Mathworks has done everything hard for you already. I do not understand why the author feels the need to authoritatively speak on a subject he absolutely does not understand.

>> The engine is closed source. You cannot see how fft or ode45 are implemented under the hood. For high-stakes engineering, not being able to audit your tools is a risk. This is just a lie. Open matlab and you can inspect all the implementation details behind ode45. It is not a black box.

How do I see the .c files / trace how `ode45` will execute on my machine? Can I see the JIT's source code?

--

Entitled to your view, but clearly difference of opinion here. From perspective of open / closed source -- maybe for you it qualifies as open source, but I can't follow the logic chain, so to me MATLAB is not open source.

You're too generous here. This has all the hallmarks of an AI-generated article, and HN is once again duped into passionately arguing with something that took zero effort to produce.
They’re trying to sell their product, which seems like a new language + runtime inspired by matlab. Reinventing Julia perhaps? It will be missing all the things that make matlab unique, as you point out.
> Nowhere else can you get scientific computing, a GUI toolkit, a high level embedded software environment, a HiL/SiL toolkit, a model based simulation environment, a plotting and visualization toolkit and so much more in a single cohesive package. Nobody else has any offering that comes even close.

Mathematica does. Arguably Mathematica is even more cohesive because it's not split up into "feature sold separately" packages.

How about fft? If you open fft.m, you get just a commented file that ends with

% Built-in function.

If the algorithm is implemented as a compiled mex function, then you cannot inspect its details.

For me, the main appeal to MATLAB was the REPL experience, allowing me to experiment with ideas and inspect results in the UI. Python notebook have bridged the gap a bit, but always require a combination of libraries (with different docs & design choices) to write a single script.
Every data scientist and statistician who joins our team is always happier moving to Python or R away from Matlab after using it for a bit. I guess it’s ok for academia but at the two large companies I have worked at, no one is using Matlab or complaining about it being gone.
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

Indeed, there are many high-quality alternatives (sometimes described as "MATLAB clones" back in the day) that never gained bigger traction.

Among modern alternatives that don't strictly follow MATLAB syntax, Julia has the biggest mindshare now?

GNU Octave, as a superset of the MATLAB language, was (is) most capable of running existing MATLAB code. While Octave implemented some solvers better than MATLAB, the former just could not replicate a large enough portion of the latter's functionality that many scientists/engineers were unable to fully commit to it. I wonder whether runmat.org would run up against this same problem.

The other killer app of MATLAB is Simulink, which to my knowledge is not replicated in any other open source ecosystem.

When I read "The honest truth: ...", the AI-generated alarm bells go off in my head. Whether the article is human written or not.
In this particular case, there was no need at all for the reshaping, and the result could have been achieved with just:

    Z = Y @ X
    W = np.c_[Z, Z]
Of the things matlab has going for it, looking just like the math is pretty far down the list. Numpy is a bit more verbose but still 1-to-1 with the whiteboard. The last big pain point was solved (https://peps.python.org/pep-0465/) with the dedicated matmul operator in python 3.5.

Real advantages of matlab:

* Simulink

* Autocoding straight to embedded

* Reproducible & easily versioned environment

* Single-source dependency easier to get security to sign off on

* Plotting still better than anything else

Big disadvantages of matlab:

* Cost

* Lock-in

* Bad namespaces

* Bad typing

* 1-indexing

* Small package ecosystem

* Low interoperability & support in 3rd party toolchains

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 languages such as Python and Julia. It widens access to other researchers who can then build upon it.

(And yes, I'm aware of Octave. It does not have the capabilities of Matlab in the areas that I worked in, and was not able to run all of my PhD scripts. I have not tried RunMat yet, but am looking forward to experimenting with it.)

An underrated aspect of Matlab is its call-by-value semantics. Function arguments are copied by default. Python+NumPy is call-by-reference; mutations to array arguments are visible to the caller. This creates a big class of bugs that is hard for non-programmers to understand.
> The issue was never the syntax—it was the runtime. Why readable math still matters in a world aided by LLM-assisted code generation

I’m going to stop you right there. Matlab has 5 issues:

1. The license

2. Most users don’t understand what makes Matlab special and they write for loops over their arrays.

3. The other license

4. The other license

5. The license server

Mathworks seems to have set up licensing to maximize how much revenue they can extract with no thought given to how deeply annoying it is to use.

One small piece of feedback for the dev, since I see you've been replying to comments here.

I had to jump like 3 links and 4 pages down to figure out what runmat actually "is" / "does".

As someone who's done their whole thesis using Octave this looks interesting.

I love Octave, it's one of my favourite languages. And, for reasons I don't understand even myself, I don't like matlab that much (though I admit their documentation is excellent).

How would you "sell" runmat to someone like me?

No. Just no.

Terrible HPC integration.

Proprietary runtime.

I went to college a few miles from Mathworks's global headquarters.

They came to speak at my school and described open source alternatives (Python in particular) as the biggest threat to MATLAB.

I think if they open-sourced the MATLAB runtime and embraced a model similar to Canonical or Red Hat where users paid for support or integrations, they'd make more money. But it's hard to get there from where they are now.

At GKN Aerospace, I was hired predominantly to migrate the team off Matlab and rewrite everything in Python. There was pushback from OEMs who wanted their specs to be in Matlab but eventually everyone folded. Having to need 2 licenses to run on 2 cores was horrible UX IIRC. I'm glad I learnt from that experience.