pysym is an experimental Python package for symbolic manipulation with limited scope (as in minimal). It tries to stay compatible with the API of SymPy. It should be viewed as a prototype and not as a "production" package.
The capabilities include:
- Differentiation
- (slow) numerical evaluation (including "lambdify" support)
The above capabilities are exactly what is needed by pyodesys and pyneqsys.
Autogenerated API documentation is found here: https://pythonhosted.org/pysym (and dev docs are here: http://hera.physchem.kth.se/~pysym/branches/master/html).
Simplest way to install pysym and its (optional) dependencies is to use pip:
$ pip install --user pysym pytest $ python -m pytest --pyargs pysym
or the conda package manager:
$ conda install -c bjodah pysym pytest $ python -m pytest --pyargs pysym
There are no requirements outside the Python standard library.
Source distribution is available here: https://pypi.python.org/pypi/pysym
Differentiation
>>> from pysym import Symbol, tan
>>> x, y = map(Symbol, 'x y'.split())
>>> expr = x*y**2 - tan(2*x)
>>> print(expr.diff(x))
((y**2) - ((1 + (tan((2*x))**2))*2))
for more examples, see examples/, and rendered jupyter notebooks here: http://hera.physchem.kth.se/~pysym/master/examples
The source code is Open Source and is released under the simplified 2-clause BSD license. See LICENSE for further details. Contributors are welcome to suggest improvements at https://github.com/bjodah/pysym
Björn I. Dahlgren, contact:
- gmail address: bjodah