Command: sympref cmd
Command: sympref cmd args
Function: r = sympref ()
Function: r = sympref (cmd)
Function: r = sympref (cmd, args)

Preferences for the Symbolic package.

sympref can set or get various preferences and configurations. The various choices for cmd and args are documented below.

Run diagnostics on your system:

sympref diagnose
  -| ...

Display of syms:

sympref display
  ⇒ ans = unicode

syms x
sympref display flat
sin(x/2)
  ⇒ (sym) sin(x/2)

sympref display ascii
sin(x/2)
  ⇒ (sym)
         /x\
      sin|-|
         \2/

sympref display unicode
sin(x/2)
  ⇒ (sym)
         ⎛x⎞
      sin⎜─⎟
         ⎝2⎠

sympref display default

By default, a unicode pretty printer is used to display symbolic expressions. If that doesn’t work (e.g., if you see ? characters) then try the ascii option.

Communication mechanism:

sympref ipc
  ⇒ ans = default

This default depends on your system. If you have loaded the Pythonic package, the default will be the native mechanism. Otherwise, typically the popen2 mechanism will be used, which uses a pipe to communicate with Python. If that doesn’t work, try sympref ipc system which is much slower, as a new Python process is started for each operation.

Other options for sympref ipc include:

  • sympref ipc popen2: force popen2 choice.
  • sympref ipc native: use the py interface to interact directly with an embedded Python interpreter, e.g., provided by the Octave Pythonic package.
  • sympref ipc system: construct a long string of the command and pass it directly to the python interpreter with the system() command. This typically assembles a multiline string for the commands, except on Windows where a long one-line string is used.
  • sympref ipc systmpfile: output the python commands to a file in tempdir and then call that. For debugging, will not be supported long-term.
  • sympref ipc sysoneline: put the python commands all on one line and pass to python -c using a call to system(). For debugging, will not be supported long-term.

Except for native, all of these communication interfaces depend on the current Python executable, which can be queried:

sympref python
  ⇒ ans = python

Changing this might help if you’ve installed a local Python interpreter somewhere else on your system. The value can be changed by setting the environment variable PYTHON, which can be configured in the OS, or it can be set within Octave using:

setenv PYTHON python3
setenv PYTHON ${HOME}/.local/bin/python
setenv PYTHON C:\Python\python.exe
sympref reset

If the environment variable is empty or not set, the package uses a default setting (often python).

Reset: reset the SymPy communication mechanism. This can be useful after an error occurs and the connection with Python becomes confused.

sympref reset                              % doctest: +SKIP

Default precision: control the number of digits used by variable-precision arithmetic (see also the ‘digits’ command).

sympref digits          % get
  ⇒ ans = 32
sympref digits 64       % set
sympref digits default

Be quiet by minimizing startup and diagnostics messages:

sympref quiet
  ⇒ ans = 0
sympref quiet on
sympref quiet default

Report the version number:

sympref version
  ⇒ 3.2.1

See also: sym, syms.

Package: symbolic