# Org mode + Gnu Octave session

I interact with the Gnu Octave's inferior mode and everything seems to be working fine there:

``````octave> pkg load symbolic
octave> syms x
g = (x+1)/sqrt(x^2 - 1)
simplify(diff(g,x))
octave> g = (sym)

x + 1
───────────
________
╱  2
╲╱  x  - 1

octave> ans = (sym)

-1
───────────────────
________
╱  2
(x - 1)⋅╲╱  x  - 1
``````

Now I do the same using org mode and babel where I get an error:

``````#+begin_src octave :session :eval never-export :results verbatim
pkg load symbolic
syms x
g = (x+1)/sqrt(x^2 - 1)
ans = simplify(diff(g,x))
#+end_src
``````

And when I evaluate the above code, I see the following error in the inferior mode's octave session:

``````octave> > > error: fprintf: wrong type argument 'class'
error: called from
dlmwrite at line 195 column 7
``````

Any idea on what I'm doing wrong ?

• I suggest you send a bug report to the Org mode mailing list. – NickD Jan 29 at 17:48

## 1 Answer

So I have found an workaround by playing around with different header arguments. This works for me:

``````#+begin_src octave :session :eval never-export :results value verbatim output replace
pkg load symbolic
syms x
g = (x+1)/sqrt(x^2 - 1)
ans = simplify(diff(g,x))
#+end_src

#+RESULTS:
#+begin_example

octave> g = (sym)

x + 1
───────────
________
╱  2
╲╱  x  - 1
ans = (sym)

-1
───────────────────
________
╱  2
(x - 1)⋅╲╱  x  - 1
#+end_example
``````
• `:results value ... output ...` is (or should be) the same as `:results ... output ...` - the manual says `value` and `output` are mutually exclusive, but practically the last one wins. – NickD Jan 30 at 12:42