@sym
: sympy (x) ¶The underlying SymPy representation as a string.
Each symbolic sym
expression has an underlying Python
object, which is stored as a character array consisting of the
the object’s srepr
(“String Representation”).
This method returns that string and can be helpful for debugging
or for copy-pasting a sym
object into a Python environment
such as Jupyter.
Example:
syms x positive srepr = sympy (x) ⇒ srepr = Symbol('x', positive=True)
Unlike @sym/char
, the result can be passed directly back
to sym
with perfect fidelity:
x2 = sym (srepr) ⇒ x2 = (sym) x x2 == x ⇒ (sym) True
See also: @sym/char, @sym/disp, @sym/pretty, sym.
Package: symbolic