Live data from Hacker News

A new release for GNU Octave

lwn.net

31–40 of 99 posts

Re: A new release for GNU Octave

#31
post #11

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.

I'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 t…

I agree wholeheatedly. Python is everything matlab the language could hope to be and more, if you just want to crunch matrices python beats matlab as it's own game (just the broadcasting features in numpy alone are an amazing step up from matlab's approach, let alone trying to ingest data which isn't a csv). But, some of those toolboxes are pretty damn good and don't have an equivilent in python. For example, if you're doing almost anything with control theory then there's some pretty killer toolboxes that don't have any real competition, especially in the open-source space (there's some basic stuff but it's not particularly usable).

Re: A new release for GNU Octave

#32
post #27

Earlier quoted context omitted.

Can you show the complete code for these snippets to work? I tried import sympy sympy.plot(sympy.sin(x)) and it says "NameError: name 'x' is not defined"

You need to tell Python that you want a symbolic variable named x: from sympy import * x = symbols('x') plot(sin(x)) symbols is sympy.symbols.

It's not particularly elegant, is it?

You just want to plot the sine function, but first you have to import libraries, declare symbols (with a scary correspondence between strings and variable names), and finally plot the damn function.

Re: A new release for GNU Octave

#33

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.

MATLAB/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…

In my experience matplotlib has surpassed MATLAB's plotting functions for most use cases. It's just so much more powerful.

Re: A new release for GNU Octave

#34
post #27

Earlier quoted context omitted.

You need to tell Python that you want a symbolic variable named x: from sympy import * x = symbols('x') plot(sin(x)) symbols is sympy.symbols.

It's not particularly elegant, is it? You just want to plot the sine function, but first you have to import libraries, declare symbols (with a scary correspondence between strings and variable names), and finally plot the damn function.

I literally always have a Jupyter QtConsole open with one tab having Sympy loaded, and every single letter variable defined as a symbolic variable, and another tab with numpy; this is my constant daily-use calculator. In that context, it really is just "plot(sin(x))". It's not really anything more than having a terminal open with Gnuplot running, and no less elegant.

Edit: plus, if I'm plotting with Sympy it's almost certainly something I've calculated symbolically with Sympy, so everything is defined and ready, and it's much more elegant than switching to a separate program. For a one-off "what does function look like?" question, both these tools are far too clunky, and I'd use Desmos or GeoGebra.

Re: A new release for GNU Octave

#35

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.

I 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.

Re: A new release for GNU Octave

#36
post #24

Earlier quoted context omitted.

Sure, but none of these beats gnuplot's uber-elegant "plot sin(x)" syntax :)

Sympy can do that: plot(sin(x)) This of course works with other symbolic manipulation: plot(sin(x).diff()) plot(sin(x).subs(x, x**2))

Yeah, Matplotlib is capable, but it’s heavy and verbose. It’s fine as an API, but the syntax gets in the way very quickly.

My use case is not a scratch pad with one plotting window; it’s dozens of windows with regressions and stuff. Each window is a completely different context; some of them are short lived and some of them are used for weeks. Using as many notebooks is very impractical. For example, seeing where one parameter is going in one calculations is trivial and quicker than starting a notebook and setting it up. Works transparently over ssh, too.

I am more or less fluent in Matplotlib, because I work with people who use it and I need to understand whatever the students are doing (and some of them use Python and some use R, which is a whole other discussion). I just dislike it and don’t use it much for my things. Ultimately, gnuplot’s syntax for regression and complex plots is much more concise.

I any case I think it’s good intellectual hygiene to use several tools regularly, lest you end up stuck in a way of thinking, so I encourage students to try others. It’s also good to have discussions about these things that don’t end up in holy wars; we need to be curious.

Re: A new release for GNU Octave

#37
post #34

Earlier quoted context omitted.

It's not particularly elegant, is it? You just want to plot the sine function, but first you have to import libraries, declare symbols (with a scary correspondence between strings and variable names), and finally plot the damn function.

I literally always have a Jupyter QtConsole open with one tab having Sympy loaded, and every single letter variable defined as a symbolic variable, and another tab with numpy; this is my constant daily-use calculator. In that context, it really is just "plot(sin(x))". It's not really anything more than having a terminal open with Gnuplot running, and no less elegant. Edit: plus, if I'm plotting with Sympy it's almost…

If people have to reduce to this hack, why doesn't the language just declare every character string a symbolic variable by default, like Mathematica?

Re: A new release for GNU Octave

#38
post #34

Earlier quoted context omitted.

I literally always have a Jupyter QtConsole open with one tab having Sympy loaded, and every single letter variable defined as a symbolic variable, and another tab with numpy; this is my constant daily-use calculator. In that context, it really is just "plot(sin(x))". It's not really anything more than having a terminal open with Gnuplot running, and no less elegant. Edit: plus, if I'm plotting with Sympy it's almost…

If people have to reduce to this hack, why doesn't the language just declare every character string a symbolic variable by default, like Mathematica?

Because the vast majority of Python programs aren't doing symbolic maths with Sympy. It's not a hack, and it's pretty trivial. I type "a," and press up, and run the line from my command history with all the letters in it. Sympy also has a submodule named abc you can import variables from, but I like defining them as real number variables so I don't get complex answers when they don't make sense.

Sympy is just a Python library, and one of the types it defines is symbolic maths variables, so you define Python variables just like with any other library, and then use them.

Re: A new release for GNU Octave

#39
post #27

Earlier quoted context omitted.

You need to tell Python that you want a symbolic variable named x: from sympy import * x = symbols('x') plot(sin(x)) symbols is sympy.symbols.

It's not particularly elegant, is it? You just want to plot the sine function, but first you have to import libraries, declare symbols (with a scary correspondence between strings and variable names), and finally plot the damn function.

One import statement is too much?

Re: A new release for GNU Octave

#40
post #16

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.

I would say "Why Octave not Julia?" since Julia is specifically designed for the scientific notations and speed, unlike Python.

Good point, Julia is the Matlab of 21st century. Pythonista here, so Julia didn’t come to mind first.
Post reply on HN