
GNU Octave - jordigh
https://www.gnu.org/software/octave/
======
chollida1
Serious Question.....

Matlab usage is on a dramatic downswing from my vantage point in quantitative
fiance. I don't really know anyone under 40 who uses it anymore as one of
their main tools.

And I've never once seen anyone use octave as a substitute, I'm guessing this
is mostly due to money for licenses not really being an issue.

Nowadays, the only tools I see people using are R, python(pandas, numpy) and
very occasionally Julia.

Where does this leave Octave? What's Octaves niche?

Or put another way, why learn Octave/Matlab when there are other languages out
there that provide similar capabilities and that are much more popular?

~~~
sampo
In the Stanford/Coursera machine learning class, Andrew Ng said that his
teaching experience is that students pick up octave/matlab quicker and the
course can cover more actual machine learning, compared to python where more
time is spent learning the language.

So I guess for newcomers and for quick prototyping (just 10s or 100s lines of
code), octave is nicer.

Say, you have some numbers for a matrix and a vector in files and want to read
them in and multiple the vector by the matrix.

In octave you are done in 3 lines of code in 30 seconds.

In python, you first figure which modules to import, the difference between
python arrays and numpy arrays, and god forbid you happen to find the numpy
matrix type instead of numpy array type. After 5 minutes you think you're all
set to calculate the M * v, but then your vector happens to be a line vector
and not a column vector and you need to learn the difference. Also it's nicer
to write M * v than np.dot(M,v).

Most of the features of python that I presented as cons are actually pros when
the codebase is more than 1000 lines and needs structure and safety.

~~~
sampo
Just to illustrate:

Octave:

    
    
        m = [0 1 0; 0 0 1; 1 0 0]
        v = [2 3 1]'
        m\v
        
        ans =
        
           1
           2
           3
    

Python:

    
    
        import numpy as np
        m = np.array([[0,1,0],[0,0,1],[1,0,0]])
        v = np.transpose(np.array([2,3,1]))
        # wtf? oh, I guess then
        v = np.transpose(np.array([[2,3,1]]))
        np.linalg.solve(m,v)
        
        array([[ 1.],
               [ 2.],
               [ 3.]])
    

If you just want to play around, Python has more clutter and gotchas.

Of course, when you start to write real software, then the tools that Python
provides for organizing your code start to weight more and the clumsiness of
np.linalg.solve(m,v) over m\v starts to weight less.

But I can see how a 50-line testing script in Octave organically grows to a
2000-line application, and then it's already a lot of work to rewrite in
Python.

Edit: a reply below makes a good point simplifying the Python code a little
bit.

~~~
messe
What's wrong with:

    
    
        >>> import numpy as np
        >>> m = np.array([[0,1,0],[0,0,1],[1,0,0]])
        >>> v = np.array([2,3,1])
        >>> np.linalg.solve(m,v)
    
        array([ 1.,  2.,  3.])
    

No need to transpose, as numpy handles row and column vectors identically.
Using the above variables `m` and `v`:

    
    
        >>> v @ m   # treated as row vector
        array([1, 2, 3])
    
        >>> m @ v   # treated as column vector
        array([3, 1, 2])
    

Where `@`, for those who don't know, is the matrix multiplication operator
(`np.dot`) introduced in recent versions of python 3.

~~~
TheSpiceIsLife
_What 's wrong with_ .... _introduced in recent versions of python 3._

Exactly.

~~~
foota
Python3 is ancient, can we stop pretending otherwise?

~~~
TAForObvReasons
PEP 465 introduced the infix operator @:
[https://www.python.org/dev/peps/pep-0465/](https://www.python.org/dev/peps/pep-0465/)

Python 3.5 was the first version of python3 to implement the PEP:
[https://docs.python.org/3.5/whatsnew/3.5.html](https://docs.python.org/3.5/whatsnew/3.5.html)

If I am reading the release notes correctly, Python 3.5.0 was released last
year (2015-09-13):
[https://www.python.org/downloads/release/python-350/](https://www.python.org/downloads/release/python-350/)

It's fair to say that this is a relatively new development.

~~~
foota
It's true that infix multiply is new, but infix multiply if I'm not mistaken
is not a breaking change.

------
jordigh
They changed the title. I hope even with the title change, people are aware
that the website design is new, which is why I submitted the URL. We also just
released a 4.2 version on Thursday, with many improvements, but no huge
features like the GUI was for 4.0:

[https://www.gnu.org/software/octave/NEWS-4.2.html](https://www.gnu.org/software/octave/NEWS-4.2.html)

~~~
vedranm
Very happy to see Octave move forward. Few years ago my colleagues at the
university complained about Octave not being on par with MATLAB performance-
wise, has this improved since?

~~~
jordigh
The biggest hit in performance that people see is the lack of a JIT compiler.
If you are able to write your code without loops, Octave performs comparably
to Matlab. No, we still do not have a JIT compiler. It is difficult to attract
this kind of talent, because the kind of people who use Octave know
mathematics and engineering more than they know compilers and languages.

~~~
Alphasite_
I wonder if Octave would benefit from something like Graal, for some common
JIT infrastructure.

~~~
jordigh
We have a toy LLVM attempt that compiled a few trivial loops but hooked into
the unstable C++ LLVM API. Nobody really knew how to maintain it, and we got
tired chasing after the unstable API, so we let it bitrot to death.

I don't expect any other JIT backend (libgccjit could be another possibility)
would require any less knowledge of compilers and language design. Does Graal
have some magic for us? Can it give us a JIT compiler even if most of us are
not compiler writers or language designers?

~~~
yorwba
From
[https://wiki.openjdk.java.net/display/Graal/Publications+and...](https://wiki.openjdk.java.net/display/Graal/Publications+and+Presentations)

 _Forget “this language is fast”, “this language has the libraries I need”,
and “this language has the tool support I need”. The Truffle framework for
implementing managed languages in Java gives you native performance, multi-
language integration with all other Truffle languages, and tool support - all
of that by just implementing an abstract syntax tree (AST) interpreter in
Java.

Truffle applies AST specialization during interpretation, which enables
partial evaluation to create highly optimized native code without the need to
write a compiler specifically for a language. The Java VM contributes high-
performance garbage collection, threads, and parallelism support._

So you won't need the know-how to write a compiler, but instead write an
interpreter optimized for execution with Graal.

------
pkd
Fun fact about Octave. If you start Octave and run the `fact` command, it
emits random jokes about Richard Stallman. Here is one:

> There is no chin under Richard Stallman' beard. There's only another beard.
> Recursively.

~~~
auxym
Ha. The equivalent of "why" on matlab, I guess.

~~~
jordigh
I figured if Matlab could have some fun, why not us. I was really happy when
Dirk Eddelbuettel ported it to R:

[https://rdrr.io/cran/rmsfact/](https://rdrr.io/cran/rmsfact/)

------
elipsey
I'm really grateful that octave exists and that folks let me use it for free.
But the part about "Drop-in compatible with many Matlab scripts" has been kind
of dicey for me. Whenever I try to run code developed with matlab using Octave
I am thwarted by bugs and stubbed functions. I end up either having to find a
machine with a matlab license or just port it. The core functionalities for
doing math and matrix-ey stuff seem great, but when I start pulling in a bunch
of libraries to do less common things, the wider ecosystem doesn't seem as
fully baked as, for example Python or R.

------
bandrami
Great stuff. I did grad school on Octave (and a bit of Maxima) rather than
Matlab; I'm glad my alma mater (Boston U.) was supportive of free software and
the professors allowed that.

I saw the version bump on info-gnu the other day; I haven't updated yet (I'm
kind of in the middle of a project using Octave) but once that's done I can't
wait to try it out.

------
mindcrime
Like many posters here, my first exposure to Octave was from taking the Andrew
Ng class on Machine Learning. For myself, I have to say that I was pretty
impressed with Octave. It does a lot of what you can do with R, but I find the
syntax more accessible. I get the feeling that there aren't quite as many
packages/libraries available for Octave as there are for R, though. Still, I
find myself using Octave from time to time, when I need to do some quick
calculations or whatever. I even bought a Matlab book, intending to invest a
little more effort into learning this ecosystem.

Glad to see Octave development is ongoing. It'll be fun to check out 4.2.0 and
see what it has to offer.

------
samuell
MATLAB was kind of my "first love" as an undergrad in biotech engineering, for
simulating biochemical network in a course.

I have since drifted away towards python, and lately Go, but MATLAB/Octave
always has a directness that I think few languages since have managed to
achieve, and I realize now that it helped lure me out of web-lab, into into
coding and bioinformatics-land.

------
eidsobr
Only one person has mentioned what I think is a critical distinction. MATLAB +
Simulink + Coder Products = hundreds of man-hours saved in the engineering
design-development-prototype-deploy process. Obviously this is not as relevant
to academics and CS, but the thousands of $$$ spent on the tools is made up
many times over in saved highly-trained man-hours.

------
cjdentra
Core Matlab/Octave is great but almost inevitably you end up needing/wanting
toolbox support. For Matlab the cost gets up there quite fast. I've found for
Octave, support at the toolbox level is not as extensive. If Matlab is not an
option it leads to searching for support in other languages. OpenCV for image
processing/understanding and the python libs as mentioned become important for
example. But development cycle time is longer and prototyping algorithms is a
bit more complicated.

Its been a while since I've worked with Octave toolboxes but it would be great
if they were on par with Matlab.

Performance is less of an issue with prototyping than production systems and
Matlab has a path to get to compiled C/C++ (Java and perhaps other?) Is there
Octave support for generating reasonably performant C++ or Java?

------
Maken
>Visualize data with high-level plot commands in 2D and 3D.

And wait an eternity for anything 3D to render. I usually use Octave for
prototyping, and while it is reasonably fast doing calculations once you learn
to vectorize computations, plotting moderately large amounts of data can
easily block the entire program.

------
clw8
Matlab and Simulink are core tools in automotive engineering.

------
wenderen
On the off-chance that the site maintainer is reading this, the "contributing
to Octave's development" link is 404-ing.

Link:
[https://www.gnu.org/software/octave/doc/interpreter/Contribu...](https://www.gnu.org/software/octave/doc/interpreter/Contributing-
Guidelines.html#Contributing-Guidelines)

------
beagle3
There is another GPL Matlab compatible system called FreeMat, which doesn't
get as much as love as Octave (which itself does not get as much love as it
should) - [http://freemat.sourceforge.net/](http://freemat.sourceforge.net/)

~~~
gnufx
There's also Scilab, though it isn't directly compatible like Octave.

------
kbumsik
I used Octave and Matlab back and forth last year for my Computer Vision
class. My experience on Octave was fine except it is increadibly slower than
Matlab... The nice thing about Octave is that it is a portable program that
you can store it in a USB memory then use it anywhere.

------
aikah
Nice, how does it compare to commercial tools or Python ? the pros and the
cons ?

~~~
IshKebab
It's a lot more suited to mathematical problems than Python. Python wasn't
designed for matrix manipulation like Matlab was so the syntax isn't nearly as
nice. Matlab also has a huge library of maths functions built in - even really
obscure ones. Finally Matlab has a nice GUI and plotting support built in
which Python doesn't have. Basically Matlab is almost strictly better than
Python.

The only advantage Python have that I can see are: a) it has better support
for non-maths functions - good luck doing OpenGL in native Matlab (although it
does easily interface with C++ and Java), and b) it is free; Matlab costs a
lot, although they did actually release an affordable 'personal' edition.

Octave is basically a Matlab clone. It's slower, has a less polished GUI
(plotting is especially buggy) and is less comprehensive.

~~~
dorfsmay
Isn't Julia a better alternative than Python if you're doing math these days?

~~~
GFK_of_xmaspast
Julia's gotten a little bit of buzz the last few years, but python's got the
whole rest of the ecosystem.

------
BucketSort
Now if only I can figure out how to get it working on Mac. The official DMG
simply doesn't work and the homebrew method doesn't install the GUI.

~~~
Anechoic
MacPorts does install the GUI (just finished compiling it).

------
sabujp
my ee courses in dsp were heavy with matlab/octave

------
arunc
It's good to know that Octave still uses Mercurial amidst all the Git hype.

~~~
madnight
no its not

------
jjawssd
In the world of Numpy and Scipy, this is obsolete tech.

------
return0
Do people really use octave, the crippled matlab with gnuplot graphs?
matplotlib is way more functional

~~~
bandrami
Many of us don't use plotting at all. Even in Matlab it's only once in a blue
moon I need to plot something.

