Symbolic Package for GNU Octave
An implementation of a symbolic toolbox using SymPy.
[https://octave.sourceforge.io/symbolic]
Note: Development for most Octave packages tends to take place in sourceforge. However, unlike most other Octave packages, the main development repository for this package is on github (https://github.com/cbm755/octsympy), and only mirrored on sourceforge (https://sourceforge.net/p/octave/symbolic/). If you are thinking of contributing and you're looking at this README file from the sourceforge website, please consider visiting our github page and contributing there instead, as we do not tend to monitor sourceforge for activity.
Goals
Feature parity with the other symbolic toolboxes.
How to Install
-
The dependencies are Octave, Python, and SymPy. Consult the SymPy website for details on how to install SymPy.
-
Start Octave.
-
At Octave prompt type
pkg install -forge symbolic
. -
At Octave prompt, type
pkg load symbolic
. -
At Octave prompt, type
syms x
, thenf = (sin(x/2))^3
,diff(f, x)
, etc.
How to install on Ubuntu
- Install the dependencies with
sudo apt-get install octave liboctave-dev python-sympy
. - Follow steps 2--5 above.
How to Install on Windows
-
Get Octave for Windows.
-
At the Octave prompt, type
pkg install -forge symbolic
. -
At the Octave prompt, type
pkg load symbolic
. -
At the Octave prompt, type
syms x
, thenf = (sin(x/2))^3
,diff(f, x)
, etc.
If you encounter any difficulties (even minor ones) please read and if possible help us improve the wiki page on Windows Installation.
How to Install on Matlab
Although this package is designed for GNU Octave, it will work with Matlab. Currently only the slower system()-based communication is available.
-
Download the latest release, e.g.,
octsympy-matlab-2.7.0.tar.gz
. -
Unzip it somewhere and add it to your Matlab Path.
The .m files for Matlab have been reformatted for Matlab comment conventions, but are otherwise the same as the Octave source.
How to Help
We have a list of things to work on tagged help wanted. Some of these should be quite easy to fix and would be a great way to get involved. Come join us!
How to hack on the code:
-
Clone the repo with git (preferred, but you can use the "Download ZIP" instead if you want).
-
Run Octave in the
octsympy/inst/
directory. It should be safe to do this even if you have the released version of the package installed (but not loaded).
Implementation
Python code is generated to do the actual work. Each sym object keeps
a text field for display purposes and a string (a SymPy srepr
). The
objects are communicated between Python and Octave by passing the
srepr string back-and-forth. Currently pure m-file (and Python)
implementation, no code to be compiled.
Related Projects
-
There was a previous "symbolic" package in Octave Forge based on GiNaC. Its history has now been merged into this project.
-
"SymPy CAS" by Jonathan Lister. Calls SymPy commands using system().