top | item 18944617

GNU Octave: A high-level interactive language for numerical computations [pdf]

132 points| mindcrime | 7 years ago |octave.org | reply

69 comments

order
[+] wanderfowl|7 years ago|reply
As somebody in an academic field where many scripts exist for MATLAB (mostly digital signal processing focused), there are few projects I want to succeed more than Octave.

It's very hard to recommend that students and colleagues grow invested in toolchains involving proprietary software that they may not reliably be able to afford/activate/use in the future, particularly when some students may end up working in developing nations.

Here's hoping that someday, Octave does to MATLAB what R has done to SPSS and SAS. MATLAB is a dinosaur deeply begging for an asteroid.

[+] joe_the_user|7 years ago|reply
The thing with Matlab is that, just as software, it's "great-terrible". It has an amazing number of cool little tweaks that allow quick development and it has umpteen convenient algorithms and allows one to work with matrices in a very self-contained way.

But all this niceness means really that the software is more in the realm of spreadsheets than standard programming languages. Maintenance is guaranteed to be a nightmare and conversion to an actual programming language similarly.

The problem is that there can't be any small way to get off the beast. Because Matlab isn't a language but a rag-bag of features, nothing can be compatible with it. Indeed, you could be 100% compatible today and wake up incompatible tomorrow. It's position is like that of the monster desktop applications like Excel, Adobe Creative Suit and other nightmare abominations.

"You may think you're being productive but really, you are just feeling a rush from the grade cocaine of technical dept"

[+] cbkeller|7 years ago|reply
I've been porting over a bunch of my old academic Matlab to Julia. It's obviously nowhere as close to Matlab syntax as Octave is, but it's a lot closer than Python. YMMV of course, but there are enough similarities that a decent proportion of my code has worked after pretty easy find/replace changes like switching array indexing from parentheses to square brackets. And I usually end up with something that runs about 2x faster than the original Matlab, which is always nice.
[+] noufalibrahim|7 years ago|reply
The over dependence of academia on MATLAB when (atleast partial) FOSS solutions existed is what prompted the setup of the FOSSEE project in India https://fossee.in/.

They've been conducting several outreach programs to move academics and students off expensive and proprietary (and therefore often pirated) software to free alternatives (mostly around the Python ecosystem).

The project is quite successful from what I know.

[+] wjn0|7 years ago|reply
> It's very hard to recommend that students and colleagues grow invested in toolchains involving proprietary software that they may not reliably be able to afford/activate/use in the future, particularly when some students may end up working in developing nations.

The future is here. As a research student in a developed nation, it's very annoying to deal with MATLAB projects. Our lab has a fairly strict no-new-code-written-in-MATLAB policy. Getting a personal licence is fairly straightforward as a student (for now), but running it on a cluster, or anything beyond my personal computer is very annoying.

[+] marmaduke|7 years ago|reply
> Octave does to MATLAB what R has done to SPSS and SAS

It won’t because all those new algorithms aren’t written in Octave (for the most part), but MATLAB (or Python or Julia).

MATLAB is not a dinosaur: it has had line profiler, JIT compiler, 3D plotting, builtin scriptable debugger in the default installation, long before Python or Julia, who still struggle with these highly valuable tools. Now it has notebooks, and plenty of other new stuff inspired by recent new stuff in Python et al. On top of that there is a Python FFI so you can call out to a Python installation if need be.

[+] sampo|7 years ago|reply
> Here's hoping that someday, Octave does to MATLAB what R has done to SPSS and SAS.

SPSS and SAS have horrible, horrible scripting languages. R is just ...slighly wonky. So as a language, R was a huge improvement on its alternatives. Whereas Octave is just a clone of the Matlab language, (almost) no improvement, just slower and less access to libraries.

[+] chrispeel|7 years ago|reply
just use Julia. It's faster than Matlab, and a better language.
[+] 4thaccount|7 years ago|reply
Just out of curiosity, what is your opinion on other alternatives that are good with matrices such as Scilab, Python + Numpy, or Julia? Is your focus on Octave due to how close it resembles Matlab?
[+] sundar4344|7 years ago|reply
Just curious, what's your opinion on simulink
[+] farmerjoe_eatat|7 years ago|reply
I spent a few years writing software professionally, a large fraction of it in MATLAB (engineering tools development for gas turbine companies). With every project I lost more respect for matlab, which is very slow, and clunkier than the marketing material would suggest (for instance, IPC. Or accidentally passing a large data set to a vectorized O(n^2) operation). And they charge you $20k/year for a single license!

I still have some old personal code left in matlab, and I have been using octave a bit lately just to keep running it- I have to say I do appreciate octave. My biggest complaint is how slow plotting is, for instance, I have a method of characteristics supersonic nozzle design software based on the modified Sauer method and methodology of Zucrow and Hoffman, that runs in a couple seconds, but in octave it takes several minutes to plot no more than a couple hundred lines (no, just straight lines with two points). What gives?

[+] kxyvr|7 years ago|reply
One thing that caught my eye was your $20k/year license fee for MATLAB. How many toolboxes did you purchase?! I maintain a commercial license for a single user and it's nowhere near that. I purchased a perpetual license originally:

https://www.mathworks.com/pricing-licensing.html

which is around $2k, but then pay a yearly maintenance fee to get upgrades, which is vastly less.

[+] std_throwawayay|7 years ago|reply
I have used Matlab and GNU/Octave in parallel for some years half a decade ago. Octave can do most things that I needed but was slower to run for many things. With Octave you didn't run into licensing problems as those floating licenses had their limits and sometimes I needed to run quite a few instances in parallel.

Now I use Python exclusively. The language is so much better and more sane and almost any library is available. I will never go back.

Today, I would recommend Matlab only in rare circumstances. Currently I cannot think of one use case that I had in the last three years where I would prefer Matlab to Python. Using the Matlab language with a portable Octave installation can be useful for teaching matrix/vector topics to people who have little programming experience and don't know Python. You can get results very quickly. The syntax feels most natural for manipulating matrices and everything seems to be a matrix.

Other than that I think the Matlab language and ecosystem is kind of a dead end. But it will provide profits for a few more decades due to sheer inertia.

[+] fiveFeet|7 years ago|reply
^ This! Very similar experience here! Moved to Python from Matlab and never looked back.
[+] sitkack|7 years ago|reply
What benefit does Octave have over the Python ecosystem? Esp as a clone of proprietary software?

The only thing I can see is as a way of running Matlab codes in clusters on cloud w/o having to also run the license servers.

[+] 4thaccount|7 years ago|reply
Matlab and Octave are both easier to do some basic numeric work for people (frequently engineering and science students) with only rudimentary programming experience. In undergrad you write very little code, but do a lot of plotting and it is helpful that the Matlab IDE has all of that natively builtin. I prefer Python & Julia now, but getting something like Matplotlib working with Python would've been more difficult for me in college. Also, Matlab has native support for matrices and numeric operations (inversion, transpose, solve) that students need without having to learn how to use something like Numpy. My preference depends a lot on whether I'm doing exploratory work or trying to craft high quality software to run in production.
[+] sampo|7 years ago|reply
Matlab:

    exp(-i*pi*[0 0.5 1])
Python:

    import cmath
    import numpy as np
    np.exp(-1j*cmath.pi*np.array([0, 0.5, 1]))
Note that you can't use math.exp for complex numbers, and neither math.exp nor cmath.exp works for arrays, you need the separate np.exp. Also, while np.exp actually works on lists, the multiplication doesn't, so you need to keep in mind which variables are python lists (that you mostly cannot do arithmetic on) and which are numpy arrays.

When you are experienced in Python, you know these differences by heart. But if you are a domain specialist and want to test an idea quickly, you will see lots of TypeError messages from Python, you need to google manuals to sort it out, and it will slow you down 10x.

[+] kxyvr|7 years ago|reply
I work as an applied mathematician writing numerical codes and I prefer to prototype in MATLAB/Octave for a number of reasons:

1. I believe it to be far easier to debug an algorithm in MATLAB/Octave than Python. When I drop into the debugger, I can immediately check things like the eigenvalues of a matrix with a simple "eig(A)" or look at the sparsity visually with "spy(A)". Though this is possible in Python, I believe it to be far easier in MATLAB/Octave because the core mathematical functions are immediately available.

2. MATLAB/Octave link into the good factorization codes directly and provide license coverage in different ways. For example, both codes link into things like SuiteSparse, which gives access to fast Choleski and QR factorizations. These routines have different licenses, but the good ones are dual licensed GPL/Commercial. Octave links into the code under GPL licensing. MATLAB provides a commercial license. This means that I can give a customer MATLAB/Octave code and they can choose whether or not they want license coverage using MATLAB or to release the code under GPL and we don't run afoul with the licenses. Candidly, not having to go off and obtain a second license for SuiteSparse is nice.

3. In my opinion, the C-API in MATLAB/Octave is more sane than Python. It's not great, but the matrices are laid out in a rational method in MATLAB/Octave, so it's really, really easy to link into an old C/C++ or Fortran codes. Often, I've used this trick to debug the C/C++ code because I can more quickly visualize the matrices in MATLAB/Octave than I can using the native language.

As for the difference between MATLAB and Octave, I prefer Octave over MATLAB since:

1. Octave is more sane when dealing with the C-API. MATLAB is not bad, but it can be finicky sometimes and I don't feel like I should have to manually set dbmex on.

2. Octave uses the system version of GCC and does not package it's own. MATLAB does and for many years since MATLAB slow played their GCC version, this was a major annoyance when linking to codes that used C++11/14. MATLAB has done a good job in the last few years of catching up, but I still prefer to use the system compiler.

3. There are bugs in some of the Octave packages. MATLAB tends to have fewer such bugs. Most of the time, it doesn't matter till it does. Just file the bug with Octave. They can be slow, but there are a lot of people who volunteer their time and filing such bugs or helping to fix this is just the cost of this kind of software.

And, look, if you like Python, great. I also work with Python. However, again, for prototyping a technical algorithm, I prefer Octave.

[+] tzhenghao|7 years ago|reply
The argument for a language like Octave/Matlab is analogous to why GUI software coexist with CLI alternatives. The Octave/Matlab audience may not be as technical and require a tool that has built in modules/libraries for advanced plots (without a lot of technical pain) etc.
[+] kkylin|7 years ago|reply
I work in an academic setting. If I had the choice I'd prefer Python (or even Julia), but frequently Matlab is what's appropriate in a lower-division STEM (non-CS) course because it's what many engineers are used to and teach or expect their students to know. I'd rather use Octave than Matlab in such settings, and encourage students to do the same. Also, Matlab is still much more common (at least in undergrad engineering courses, not so sure about actual usage in the industry) than Python or other similar tools, and it's good to have a free software alternative.

That said, I sometimes feel Octave is too much a clone of Matlab, warts and all, and I'd rather give up some compatibility for genuine improvement. (Same way I feel about LibreOffice or OpenOffice sometimes.)

[+] bassman9000|7 years ago|reply
For simple stuff, just open the GUI+REPL, and start plotting in Matlab. Great for quick documentation graphics.
[+] dwheeler|7 years ago|reply
It's worth noting that the popular Coursera course "Machine Learning" taught by Andrew Ng uses Octave as its tool. This is mentioned in the Octave book's preface; see https://www.coursera.org/learn/machine-learning if you're interested in the course itself. It is possible to use MATLAB instead, but there's often no real reason to do so. I think a lot of people have already decided to use Octave instead, because it solves their problems just fine.