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…
A new release for GNU Octave
31–40 of 99 posts
Re: A new release for GNU Octave
#32Earlier 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.
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
#33I’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…
Re: A new release for GNU Octave
#34Earlier 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.
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
#35I’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.
Re: A new release for GNU Octave
#36Earlier 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))
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
#37Earlier 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…
Re: A new release for GNU Octave
#38Earlier 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?
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
#39Earlier 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.
Re: A new release for GNU Octave
#40I’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.