Issues with the octave plugin – Symbolic pkg not working properly

I’m on TeXmacs 2.1.4 under OS X 15.7. The octave plugin works fine but there are some issues when I want to use octave’s symbolic pkg.

In an octave session I did

  • pkg load symbolic;

  • sympref diagnose;
    and all test passed successfully. Then I declared x as a symbolic variable:

  • syms x;
    which correctly produced the following message

  • Symbolic pkg v3.2.1: Python communication link active, SymPy v1.12.
    and then I defined a function;

  • f = x^3 + 3*x^2 - 10*x;
    When I wanted octave to factor that expression

  • factor(f)
    I get this error message:

      error: sym/horzcat method failed
      error: called from 
          pycall_sympy__ at line 179 column 7
          sym at line 489 column 11
          horzcat at line 64 column 17 
          flush_verbatim at line 13 column 3 
          tmdisp at line 17 column 5
          tmrepl at line 71 column 7  
         /Users/tilda/.TeXmacs/plugins/octave/octave/tmstart.m at line 54 column 1
    

I wonder what is going on. All these commands run perfectly fine, both under octave-gui and octave-cli. Does anyone know how these issues in the octave plugin might be fixed?

Thanks in advance
Tilda

I do not know anything about how plugins work. This said: is there a way to get back the properties of f? So that one knows what Octave sees in input.

I’m not quite sure what you mean. As mentioned above, in stand-alone octave these commands work fine. Within the plugin the octave session freezes after issuing factor(f);

I went down the list of the package’s functions after I wrote my post and I think that

char(f)

or

char(x^3 + 3*x^2 - 10*x)

might give you the information you need for debugging (https://octave.sourceforge.io/symbolic/function/@sym/char.html).

It may be that translating the input between TeXmacs and Octave something changes and getting the input back as a string might show it.

Dear Giovanni, thanks for your fast replies, I did char(f) and the output was x**3 + 3*x**2 - 10*x. When I issued factor(x**3 + 3*x**2 - 10*x) I received

parse error:
syntax error
factor(x^3 + 3x^2 - 10x);

At least the session didn’t freeze.

I might not be able to help but I am curious. What happens with

sympy (f)

?
Also, it might be helpful if one were able to use the Octave debug functions from TeXmacs. For example

dbstop horzcat

If noone is able to help better I might install Octave and try myself, but I cannot be quick.

sympy (f)

yielded

Add(Pow(Symbol(‘x’), Integer(3)), Mul(Integer(3), Pow(Symbol(‘x’), Integer(2))), Mul(Integer(-1), Integer(10), Symbol(‘x’)))

Running

dbstop horzcat

gave

add_breakpoints_in_function: unable to find function ‘horzcat’

I installed Octave, I confirm the behaviour (bug) and this happens for me too. I have found the location of the file in Ubuntu but I still do not know how to get a breakpoint in it; the full path contains a dot and Octave does not like it. I postpone working on this further (copying the file to the current directory might be a “quick and dirty” way to place a breakpoint in it). Perhaps in the meantime someone else will tell what is wrong.

1 Like

The TeXmacs output is failing. I do not understand the details, this said.

I think that the package symbolic overloads horzcat. flush_verbatim calls horzcat. The overloaded horzcat, in turn, does not like being called with a string and a symbolic variable as arguments. Try for example

["verbatim:", x]

with x a symbolic variable.

There is an error but in this case, though, TeXmacs does not hang. I do not know why with factor TeXmacs hangs, and I do not know how to fix the bug. Maybe one needs a modification of flush_verbatim

1 Like

Thanks for your research and debugging.

Fixing this is beyond my skills. Maybe we should call @darcy Shen in or at least inform him about the issue.

Cheers, Tilda

Darcy’s plan to remove GNU Octave in Mogan and Why

I’m about to remove the GNU Octave plugin in Mogan, because Julia is a better choice.

For symbolic computing, Maxima/FriCAS and Sympy plugin is recommended. Maxima is built-in in Mogan, because it works fine on all platform. And I’ve removed FriCAS from Mogan, because FriCAS does not work fine on Windows and macOS during that time.

For Mogan STEM Suite, I prefer to make Maxima and Julia as the built-in plugin and let other plugins community driven.

The GNU Octave plugin

Last time, I remember I worked on the GNU Octave plugin, because I want to learn Andrew Ng’s machine learning course, that’s my second attempt to learn Andrew Ng’s Machine Learning course. And I failed the second time. The good news is that I finally improved the GNU Octave plugin (for GNU Octave 5.2.0).

And recently (maybe in 2023), I tried to make the plotting functionality work for newer GNU Octave on Windows. And I failed.

I’m not an Octave expert. My last attempt is based on other people’s (the developer who share his/her octave plugin on the mail list) work. It is totally a minor rewrite based on my engineering taste.

I’ve removed the sympy plugin because the python binary finding mechanism does not work well on Windows. Some people are enjoying the Python based plugins on Linux and macOS, while other people are complaining about the Python based plugins on Windows.

(I think for guys who are using macOS and Linux, installing python based plugins to TEXMACS_HOME_PLUGIN should not be that hard.)

And in Mogan, I’ve introduced the binary plugin mechanism, and I tried to make it easy for most people to install Python and get it work with Mogan. And I’d like to make the sympy plugin as a Mogan built-in plugin again later.

In a word, only cross-platform and easy-to-use plugins will be built-in in Mogan. I do not want to upset the users by delivering the low quality built-in plugins.

Most of the work for plugins should be done by individual maintainers: if the developers have to take care that each plugin works, it results in too much work and it will mean there will be just a few plugins. I found a discussion here for Mogan and I agree with the proposals there, but I am not able to see how it fits with the current status of Mogan. Moreover, the same would be good for TeXmacs too.

1 Like

Thanks for understanding my decision!

On the same theme, I think that TeXmacs would benefit a lot if authors had a way to publish their plugin officially with minimal contact with the TeXmacs developers.
That is, a web space, moderated in a very light way by TeXmacs developers and linked to from the TeXmacs webpages where people can upload their work.

tm-forge does not yet fulfill this role, because there is no link to it from www.texmacs.org
If there can be no link because github is not free software, then it is maybe best to open a new space.