11 ms·
I’m curious, are there any Octave users on HN? What are your use cases, in particular different to just an open-source Matlab-like clone? Why Octave not Python?
by rich_sasha 6y ago
I’m curious, are there any Octave users on HN? What are your use cases, in particular different to just an open-source Matlab-like clone? Why Octave not Python?
I’m curious, not saying either option is bad.
- Haemm0r 6y agoI use it from time to time. Octave performs very well to the point, where you have several encapsulated for-loops, where Matlab is several times faster in my experience.
- gautamdivgi 6y agoI actually went the other way from Octave to scipy, numpy and matplotlib. This really long ago though - around 2007. As a programmer moving into quants needing to process huge amounts of data python/matplotlib seemed a much better fit for me. It also enabled me to run multiprocess number crunching on my 8-core desktop at home. Octave would be able to use just 1 core, I could code the python scripts to use all 8. Octave was really good to prototype and enabled me to get somethings done really quick. But once I got to know the python libraries better it just seemed easier. I could do all my data processing and quants in a single language. I'm sure much has changed and was actually quite sad when the original author of Octave (John Eaton) mentioned in 2017 that he was unable to maintain it. I've lost touch on Octave over the years and genuinely pleased to see that it is still being actively maintained. I think its time for me to see what I've missed in the past 13 years.
- Qem 6y agoSee https://mattermodeling.stackexchange.com/a/3680 https://mattermodeling.stackexchange.com/a/3680
- tripa 6y agoI drop to octave any time I need to do some one-off matrix computation. Also as an interface to GLPK.
- sudosysgen 6y agoI use it to do general linear algebra scripts and as a linalg calculator. The language is imo much nicer at this than python, and it also starts up way faster. Also, symbolic calculation is a lot less cumbersome than in python!
- ai_gandalf 6y agoI was introduced to octave through Andrew Ng's Machine Learning course, its good..
- deleted 6y ago[deleted]
- abdullahkhalids 6y agoI use Octave to quickly plot graphs or do quick non-trivial calculations during my lectures. Better than python because I don't have to import libraries.
- smallpipe 6y agoI’ve used it to copy a matlab library into hobby software, whilst being able to debug it to compare. Details in my previous comment: https://news.ycombinator.com/item?id=25441585 https://news.ycombinator.com/item?id=25441585
- kergonath 6y agoI use Matlab-likes (actually Scilab rather than Octave) for one offs and interactive use. That’s usually playing with a dataset, test some analysis techniques, quick regressions, solving linear equations systems, this sort of things. I hate having to set up the whole machinery when doing this in Python. Also, the general-purpose nature of Python gets in the way, whereas the Matlab-like syntax is very focused and much less cumbersome. This does not matter much in a script, but is a pain for interactive use. On the other hand, Matlab is terrible to write scripts, with its inconsistencies and its almost-Fortran-but-weirder syntax. Once the pipeline is set, Python is for scripts that need to be run more than about a dozen times, or need to be run on several datasets, or for things that need to be reproduced exactly (like stuff that goes into a paper). I also use it to prepare datasets from large numbers of calculations where the useful results need to be gathered from dozens/hundreds of files in a more or less complex file structure, often on different computers, with the occasional pass with some post-processing tools. I really dislike Matplotlib, so rendering is done in something else, usually gnuplot. That’s for my stuff (mostly atomic-scale modelling and quantum chemistry in materials science), it might be different for other use cases...
- enriquto 6y ago> I really dislike Matplotlib, so rendering is done in something else, usually gnuplot. This! My biggest gripe against Python numerical stuff was matplotlib, until I realized that it is an entirely optional component of the stack, and you can plot by other, much saner means.
- mkl 6y agoYes, there are many good alternatives. Seaborn, Plotly, and many more. I still use Matplotlib for most things (with the OO API), as I can control its fine details and it's more versatile. For non-graph visual things that I could use Matplotlib for, I've been generating SVGs and displaying them directly in Jupyter notebooks (with Cairo is one option, but just directly is pretty easy too).
- enriquto 6y ago
- mkl 6y agoI'll say one option is bad :-) I don't use Octave, but I have a little in the past, and I have to teach students to use Matlab (2021 should be the last year of that before we switch to Python though), and I've done a lot of numerical and other programming in Python and Matlab, in each for ~20 years. In my opinion Matlab is a terribly designed language that has haphazardly grown features by accretion. Anything other than matrices and vectors is far more difficult than it needs to be. Therefore I consider Octave a bit of a lost cause; I think aiming for compatibility with terrible won't lead anywhere good. Actually Octave has one useful feature Matlab is missing, operators +=, -=, etc., so perfect compatibility is not exactly the goal. It seems to me the only reason to use Octave is if you happen to have a large legacy Matlab code base that doesn't depend on any of Matlab's proprietary toolboxes (unlikely, as those toolboxes are one of the main reasons people use Matlab). I believe Python is superior to Matlab/Octave in almost every way. I think Matlab/Octave has two or three very small advantages over Python, and one larger but very niche one: 1) Matlab/Octave's matrix literal syntax is nicer and less verbose ([1 2; 3 4] vs. np.array([[1, 2], [3, 4]])). Irrelevant in most cases, as most substantive programs will have few literals in them. Note that those missing commas are a frequent source of bugs, too, e.g. [1 -2; 1 - 2] is an error, so really the Matlab/Octave is better written as [1, 2; 3, 4]. 2) Because Matlab/Octave is primarily for numerical calculations, you don't need to import libraries to get started. Not a big deal as I always have a Jupyter QtConsole running with Python, Numpy and Sympy ready to use. 3) Basic 3D plotting in Matlab is still a little easier (Python is better for complex 3D plotting though). Not sure what Octave's story is for 3D plots. 4) The aforementioned proprietary Matlab toolboxes, if you happen to be working in one of the narrow niches they're good for. Python has similar large library advantages in other (and more) areas. Octave has some equivalent open source library bindings, but that's the biggest incompatibility with Matlab. 20 years ago Matlab was pretty good, but it's barely changed since then, and Python has long overtaken it in most areas. Octave seems to have caught up with Matlab on the GUI front (but Jupyter Notebooks are much nicer for many things (Octave can do Jupyter too), and Python has a selection of mostly equivalent IDEs, e.g. Spyder). Python, being a general purpose programming language, can do all the non-maths things surrounding the maths much easier. Data input/output, data processing, string processing, network access, etc., as well as UI things like Jupyter Notebooks. In my opinion Python's also better at quite a lot of maths stuff, like large integers, arbitrary precision, symbolic algebra, higher dimensional arrays, or dataframes with Pandas. I also much prefer 0-based indexing and half-open ranges. Matlab's licensing is quite problematic. Licenses for business/research use are incredibly expensive, and licenses for student use are relatively cheap. I consider it unethical to teach students to use a proprietary language that will cost their future employers thousands, but that's been Matlab's sales strategy for decades. Switching to Octave is an option for teaching and some business/research use, but switching to Python, with its much bigger ecosystem, seems more sensible to me (unless you have a big existing Matlab code base).
- enriquto 6y agoI have always used Octave and never Matlab. The professor who introduced me to Octave some 15 years ago was quite the free software activist and did not even tell us that it was a clone. Today, I am a heavy user of Octave's linear algebra algorithms for large sparse matrices. I also use Python/numpy for other things, and sometimes for linear algebra too (due to the insistence of my coworkers), but it is much less pleasurable and quite annoying. Also, the linear solvers in scipy are sub-par compared to the state of the art solvers in Octave. Once, we found a well-conditioned 6x6 system that linalg.solve failed to solve! As an aside, I have never used Octave for plotting, and I hate the gui interface; my use case is 100% non-interactive, using scripts.
- tpoacher 6y agoI wouldn't call it a clone, anymore than I would call, say, Linux, a "clone" of Windows for needing to have a similar feature-set to appease newcomers. Much like linux vs windows, octave and matlab started life as completely different things, but octave being the 'underdog' and having a similar enough syntax necessarily tried to match matlab's syntax, to the extent that they pride on compatibility (and treat non-compatibility as 'bugs'), but extend the matlab language to include other features. Now that both projects are mature, I think it's safe to say that matlab has 'borrowed' a lot of octave's nicer features over the years too (though obviously it's not something that can be publically admitted), like implicit broadcasting, command-line functions etc. Obviously, neither matlab nor octave are strict subsets of each other. Also, I get the impression that matlab has started taking octave's compatibility very seriously in recent years, and has taken non-trivial steps to break it (annoying, but totally fair, in my view), which octave has resisted for the sake of backwards compatibility. Ironically this often makes octave a more reliable base for runnin older matlab scripts, than matlab itself. (e.g. in the same way that Wine is more reliable for running Win98 applications than Windows 10)
- skissane 6y ago> I wouldn't call it a clone, anymore than I would call, say, Linux, a "clone" of Windows for needing to have a similar feature-set to appease newcomers. Much like linux vs windows, octave and matlab started life as completely different things, but octave being the 'underdog' and having a similar enough syntax necessarily tried to match matlab's syntax, to the extent that they pride on compatibility (and treat non-compatibility as 'bugs') Nobody calls Linux a "clone" of Windows or vice versa, because even when they implement the same features, in the vast majority of cases the command syntax, APIs, etc, are radically different. There are a few commonalities, but when they exist, they are almost always because both have decided to implement some pre-existing standard. Even when Windows borrows features from Linux/Unix, it normally changes the API in incompatible ways – Windows 10 added pty support copied from Unix and Linux, but came up with an incompatible API to do it (CreatePseudoConsole) It is the fact that Octave quite intentionally copied a lot of Matlab's syntax which leads it to being called a "clone". If they hadn't done that, nobody would apply that term. > I think it's safe to say that matlab has 'borrowed' a lot of octave's nicer features over the years too (though obviously it's not something that can be publically admitted), like implicit broadcasting, command-line functions etc. When Matlab "borrows" features from Octave, does it intentionally choose the same syntax, or does it implement the feature in an incompatible way? The former would constitute cloning, the later would not.
- paijiut 6y agoI use it often. Even after 20 years of using numeric/numarray/numpy, I still feel more productive in Octave and Matlab. Mostly time series analysis, signal processing, image analysis. Occasional modeling and simulation work. I think for me it’s that octave does it’s job well and doesn’t try to do other things. Python grates on me occasionally since it’s libraries seem to lack focus and try to be too much for too broad of an audience. I like focused, simple tools. I do use Python, but not as my sole tool. I don’t understand he mindset that one tool/language should do everything. Easier for me to learn many languages than one language and have to learn many independently designed libraries.
- _0ffh 6y agoI wonder how much of this is due to the availability of the dot-operator syntax beside the extensive libraries and the easy extensibility (just create a new function in the Matlab search path and Bob's your uncle - no further installation or registration rituals needed).
- billfruit 6y agoMatlab never feels a particularly elegant system to me, and most Matlab codebases I have seen are huge messes, with not much structuring and organization. In that respect I prefer python, that it naturally seems to lead to saner manner of organizing code, and also being very helpful in massaging/parsing/reformatting data into forms more amenable to processing.
- marmaduke 6y ago> Matlab codebases I have seen are huge messes I can confirm this, but, Conway's Law suggest that this reflects more the user group that the language. Matlab provides all the typical suspects for structuring codebases (packages, classes, functions, globals, etc) but look what users do with it. This suggests simply that research groups " communication structure"s are huge messes.
- IshKebab 6y agoMATLAB/Octave's main advantage over Python is that the syntax for manipulating matrices is way way way nicer. They also have a lot of toolboxes and maths related functions that would really take a long time to find/implement in Python. MATLAB had another significant advantage over Python. Its plotting support is really really really good. Given how much time scientists spend making graphs it's hard to understate how important that is, or how much better MATLAB is at plotting than Python or Octave (or Julia).
- jb1991 6y ago> how much better MATLAB is at plotting than Python or Octave (or Julia). To make sure I’m understanding you correctly, you’re saying Matlab is much better at plotting than Octave? I’ve only ever used the latter, so I guess that would be one reason to consider switching to the former.
- _0ffh 6y agoLast time I tried a few years ago, Octave couldn't hold a candle to Matlab's plotting functions. It's a different league.
- rightbyte 6y agoOctave's plots are missing some property editor and GUI tools which can be quite annoying. Like the brush or regression tool.
- tpoacher 6y agoInteresting. My experience has been the exact opposite. The quality of matlab's plots paled compared to that of Octave's.
- _0ffh 6y agoDidn't really notice any major difference in quality... I was talking ease-of-use and richness of options. What quality differences do you refer to?
- xvilka 6y agoI would say "Why Octave not Julia?" since Julia is specifically designed for the scientific notations and speed, unlike Python.
- rich_sasha 6y agoGood point, Julia is the Matlab of 21st century. Pythonista here, so Julia didn’t come to mind first.
- leephillips 6y agoI have my own answer at the end of the article. It is: use Julia if you’re serious; but Octave will serve you well if you’re already used to MATLAB or have MATLAB scripts and just want to do some numerical work.
- pletnes 6y agoIn several cases over the years, I’ve inherited matlab code and tried to run it on octave. Never worked, once. There were always just one small missing syntax, function, edge case of handling filenames... Once I inherited code written for octave. Did its job, worked like a charm, mostly. The CLI interface was clunky compared to typical shell tools so I had to do some shell wrappers and incantations to automate what I wanted. I don’t know if this is due to the author or to octave but I suspect its focus is on interactive use to the detriment of developing programs. I keep a jupyterlab docker container running at all times on my win10 laptop, with windows-home mounted. Instantly available notebooks from my browser - works like a charm for interactive use. I much prefer python since it lets you move continuously from one-off hack in a notebook cell to a web scale application, parses any weird file, serves web content in 3 lines, etc.
- bayindirh 6y agoAs a MATLAB license holder, I'm currently migrating some MATLAB code to be compatible with both. My license doesn't allow multiple computers, so MATLAB is living on my laptop. I'd rather run longer computations on my desktop system, which can handle these loads for a long period time without getting stressed thermally. My use case is to run ground-truth code designed by my professor and cross-check the results generated by my scientific software. These MATLAB/Octave generated values are also incorporated to sanity check and CI pipelines to test developed software's sanity and computational integrity.
- Frost1x 6y agoThis is the main use case where I've used octave: working with someone of a group who has developed fairly involved Matlab codebase and we need to make it more scalable in some way, either for long running computation, reducing license costs, perform distributed memory work, or enable more robust parametric space exploration. The Achilles heel here is that in Matlab, there's quite often a licensed toolbox dependency which makes portability more challenging. Every now and again I've seen pure Matlab code and the Octave transition is smooth. Sometimes there are so many toolbox dependencies that it just isn't even worth trying.
- bayindirh 6y agoThe luck in my case is, since we're testing either algorithms for formulations, most (if not all) code is written in pure MATLAB and has no toolbox dependency. However, we're living in a matrix world. MATLAB is slow and Octave is even slower while working with matrices. I have no idea how to fix that part.
- Jtsummers 6y ago> MATLAB is slow and Octave is even slower while working with matrices. I'm curious what you mean with this. Matlab was always fast with matrices (but my experience is now from 2 decades ago). The thing that was slow was loops. That is: for i = 1:100 c(i) = a(i) + b(i); end would always be slower than this: c = a .+ b; The trick in my work was to always find matrix/vector operations that were equivalent to my desired loop and conditional structures. I could improve execution by 100x or more for many programs doing this.
- PoachedSausage 6y agoI use for it for the various RF/EE/Controls related matrix stuff, as others have said it is often quicker to use to do some sanity checks even though at work we have actual MATLAB/CST Studio etc.
- marmaduke 6y agoI didn't see it anywhere, so: Octave start up speed is magnificent. If you have a larger shell script and just need to grab some eigenvalues, Octave can be as fast to startup, do its work and exit, as awk or grep would be for text manipulation. MATLAB takes a while to start, Julia and Python need to spend a good amount of time importing/compiling.
- rightbyte 6y agoI use Octave alot for engineering calculations. Writing simple global namespace scripts with "hardcoded" values.
- tpoacher 6y agoI did all my work and wrote my entire biomedical engineering (specifically medical image analysis) thesis on octave. In the beginning I had started with matlab because my lab mostly used matlab functions. Obviously it's not that I couldn't finish my work on matlab, but I found octave nicer to use, better publication-quality graphs, very friendly open-source community, submitted bugs typically fixed within a couple of days (which was not the case when I submitted bugs in matlab, of which I had reported plenty, particularly when it came to misbehaving graphics), interesting outlooks from studying its source code, ability to keep or distribute my code in the absence of a prohibitive matlab licence, etc. It is probably true that it is not necessarily as quick as matlab or julia these days, however there is a big red flag when one looks at "benchmarks" online, which is typically that these are used in such contrived ways that a proper octave user would probably not consider as good octave code. (I remember this was also true of julia's benchmarks against python for instance). Octave in fact is very powerful. Not to mention that to the serious user, much of its power comes from its incredibly powerful interface to its vast library of open-source c++-implemented functions. As for the why octave and not python (or any other X) question ... honestly, I don't know. E.g. why Linux and not Windows? Honestly, both are fine. But, without having an explicit list of arguments, I just find linux is more enjoyable and gets out of my way, whereas on windows I find myself having to do extra steps and double-check things at every turn. Well, somehow, I have the same vibe when working on octave vs python or julia. But that's not to say I don't enjoy those other languages too. To me it just feels Octave is just ... nicer and gets out of your way somehow. It's definitely my language of choice for quickly trying ideas out.
- yummypaint 6y agoUsing Octave over matlab is preferable for me for the same reasons many people use GIMP over photoshop. I use octave for things that are reasonably self-contained, like the metaphorical editing of a single image. I like Python over octave for the kinds of uses that might cause someone to use python over GIMP for image processing, to extend the metaphor.
- BlueTemplar 6y agoAs a student of Computational Physics, because we have more teachers using Octave than Python. However, its lack of support for Unicode variables and filenames is very frustrating in this day and age… (I understand that they are being stuck due to Matlab having poor support too.)
- fafner 6y agoI believe Unicode support was improved in this (6.1) release
- BlueTemplar 6y agoYes, it's mentioned in the review, but there are no details given. I doubt that Octave suddenly started supporting either of those features.
- andi999 6y agoHere is my story. We used Matlab, but then the polling of the license server got more and more aggressive(or we were unlucky). Just when you want to work on the 8h flight the thing popping up and saying 'need to connect to the internet' is not fun. Now we had a volume license(I think). And it needs server access every 10 times you run a script. Try making software which wants to use the Ethernetport with something else, it is just annoying. So you pay a lot of money and get annoyed... Octave is slower than Matlab (at least last time, no loop acceleration), and no GUI library. So we went straight to python.
- enriquto 6y ago> Octave is slower than Matlab (at least last time, no loop acceleration), and no GUI library. So we went straight to python. But don't you find python slower? I prefer octave to python, in part, because the linear solvers are much faster (and the startup time, too).
- andi999 6y agoTo get fast you need to vectorize. I found that vectorizing algorithms in Matlab makes them unmaintainable (maybe I am not good at that). In python this is much smoother.
- enriquto 6y ago> I found that vectorizing algorithms in Matlab makes them unmaintainable. In python this is much smoother. Are you using numpy? If so, can you give a concrete example?, in my case the opposite seems to be true. The numpy notation seems to be much clunkier. Apart from that, this sentence: > To get fast you need to vectorize. describes a very sad tragedy of numerical computing. It makes no sense that in 2021 interpreters for scientific languages are not able to optimize loops. The so-called "vectorization" should be a non-issue in a modern interpreted language. The running time of calling "C=A*B" and that of the triple loop to fill the elements of the matrix C should be identical.
- 6y ago
- thatsadude 6y agoSignal processing, 15 years using Matlab/Octave and 10 years using Python. It's easier to prototyping signal processing algorithms in Matlab/Octave. Some important functions in Scipy perform much worse than Matlab/Octave.