Skip to main content

SymCXX

Build status PyPI version Python version License airspeedvelocity coverage

SymCXX is an experimental Python package (with its core implemented in C++) for symbolic manipulation with limited scope (as in minimal). It tries to stay compatible with the API of SymPy. Its main goal is to explore designs related to automatic differentiation and numerical evaluation similar to SymEngine’s Lambdify functionality.

The capabilities include:

  • Differentiation (including taking the jacobian of a matrix)

  • Numerical evaluation

The above capabilities are exactly what is needed by pyodesys and pyneqsys.

Note that integers in symcxx may overflow, i.e. if correctness is important please use SymPy/SymEngine.

Documentation

Currently users may refer to SymPy’s / SymEngine’s documentation.

Installation

Simplest way to install SymCXX and its (optional) dependencies is to use the conda package manager:

$ conda install -c bjodah symcxx pytest
$ python -m pytest --pyargs symcxx

or pip (requires a C++11 compliant compiler):

$ pip install --user symcxx pytest
$ python -m pytest --pyargs symcxx

There are no requirements outside the Python standard library.

Source distribution is available here: https://pypi.python.org/pypi/symcxx

Example

Differentiation

>>> from symcxx import NameSpace
>>> ns = NameSpace()
>>> x, y = map(ns.Symbol, 'x y'.split())
>>> expr = x*y**2 - ns.tan(2*x)
>>> print(expr.diff(x))
Sub(Pow(Symbol(y), Integer(2)), Mul2(Integer(2), Add2(Integer(1), Pow(Tan(Mul2(Symbol(x), Integer(2))), Integer(2)))))

Lambdify

>>> lmb = ns.Lambdify([x, y], expr)
>>> lmb([1.3, 0.2])  # doctest: +NORMALIZE_WHITESPACE
array([[ 0.65359661]])

License

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/symcxx

Author

Björn I. Dahlgren, contact:

  • gmail address: bjodah

Metadata

Release files for symcxx 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for symcxx 0.1.10
File Size Uploaded
symcxx-0.1.10.tar.gz 220.5 kB Details

Release files / symcxx-0.1.10.tar.gz

Download URL symcxx-0.1.10.tar.gz
Size 220.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f200be30b278fb34998b2723e62b4142037299c6ede48f31a5c8183df055586a
BLAKE2b-256 checksum
How to use checksums
df69b55a19bac6a610b0af66aa652002816282ebb0ae1c3b5b8a37557b071c37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.5.2

Release history Release notifications | RSS feed

This release

0.1.10 This release

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page