sym package¶
unified wrapper to symbolic manipulation libraries in Python
Submodules¶
sym.backend module¶
-
sym.backend.
Backend
(name=None, envvar='SYM_BACKEND', default='sympy')[source]¶ Backend for the underlying symbolic manipulation pacages
Parameters: name: str (default: None)
Name of package e.g. ‘sympy’
envvar: str (default: ‘SYM_BACKEND’)
name of environmentvariable to read name from (when name is
None
)default: str
name to use when the environment variable described by
envvar
is unset or empty (default: ‘sympy’)Examples
>>> be = Backend('sympy') # or e.g. 'symengine' >>> x, y = map(be.Symbol, 'xy') >>> exprs = [x + y + 1, x*y**2] >>> lmb = be.Lambdify([x, y], exprs) >>> import numpy as np >>> lmb(np.arange(6.0).reshape((3, 2))) array([[ 2., 0.], [ 6., 18.], [ 10., 100.]])
sym.util module¶
-
sym.util.
banded_jacobian
(y, x, ml, mu)[source]¶ Calculates a banded version of the jacobian
Compatible with the format requested by
scipy.integrate.ode()
(for SciPy >= v0.15).Parameters: y: array_like of expressions
x: array_like of symbols
ml: int
number of lower bands
mu: int
number of upper bands
Returns: 2D array of shape
(1+ml+mu, len(y))