The python stator interface.
Project description
Stator is a header-only compile-time and runtime C++17 Computer Algebra System. Its designed to be fast, and uses metaprogramming to achieve much of this speed.
Aside from the math, it has some tools for application in event-driven dynamics/ray-tracing/collision-detection and is being extended towards thermodynamics applications.
For full details, see the Documentation: https://toastedcrumpets.github.io/stator
C++ interface
Example to come!
Python bindings
Stator has python bindings to allow "fast" math in python. Its built around the parser
import stator
# Use the built-in expression parser to make objects like variables
x = Expr("x")
# You can then create more complex expressions
f = x*x+2
# And print them
print(f) # x*x+2
# They're still Expr objects
print(repr(f)) # Expr('x*x+2')
# You can evaluate them by substitution
result = sub(f, {x:2})
# And the result becomes a python float
print(result) # 6.0
# We can parse more complex expressions, like lists
funcs = Expr('[1, x, x^2/2, x^3/6, sin(x), sin(y)]')
# And take derivatives
print(derivative(funcs, x)) # [0, 1, 4*x/4, 18*x^2/36, cos x, 0]
# You'll note simplification is not very advanced (yet)
# Substitution can use dictionaries to provide computation 'contexts'
print(sub(funcs, {x:1, Expr('y'): 2})) # [1.0, 1.0, 0.5, 0.16666666666666666, 0.8414709848078965, 0.9092974268256817]
Alternatives/Similar software
For the compile-time C++ library:
- ViennaMath: A nice compile-time math library, stator has most of this functionality except the extensions to FEM.
- SymbolicC++: A nice library, but behind in adopting modern compiler extensions (last released in 2010). Also you seem to need to buy the book to get the docs, but at least it has them!
For the python bindings:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stator-0.0.2-cp39-cp39-manylinux2014_x86_64.whl.
File metadata
- Download URL: stator-0.0.2-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 196.6 kB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9751510a800e7156dc1bf4d2c5c73b2300fa68bc029be120af40065f4bc2ad30
|
|
| MD5 |
b9623073dc3489a022324eb3b7a6a8e6
|
|
| BLAKE2b-256 |
e165a9d9b9323fbeed33eb2a2104b7289dd7042ebae4a09c225a731335ff5fae
|
File details
Details for the file stator-0.0.2-cp38-cp38-manylinux2014_x86_64.whl.
File metadata
- Download URL: stator-0.0.2-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 197.2 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82375d132533c84da5ce0f4364b1de2070875ec8e9b5aed42f94bc3de9a57812
|
|
| MD5 |
aed03056887c3c04d391b5d3d784d73a
|
|
| BLAKE2b-256 |
a177f9cb3405ad38103401ab67e77942abb5b85c5ddbdbf3c1a8e3b6af7e4dfb
|
File details
Details for the file stator-0.0.2-cp37-cp37m-manylinux2014_x86_64.whl.
File metadata
- Download URL: stator-0.0.2-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 196.0 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8102427b72e09ec116c81e5cb3b3ade837c6e9eab88e3fadc8eca1bce777cded
|
|
| MD5 |
61f34c3c1c87cf6b98108f3d87e164ca
|
|
| BLAKE2b-256 |
bb80e2845c2b76bb1e63cc8193dcbcf40b70e64fa1fad825fe0975d542877073
|
File details
Details for the file stator-0.0.2-cp36-cp36m-manylinux2014_x86_64.whl.
File metadata
- Download URL: stator-0.0.2-cp36-cp36m-manylinux2014_x86_64.whl
- Upload date:
- Size: 195.9 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
777af9bbca62e86d696b213ca22fc7cf5ba868cd5cf03dbe112728dce243046e
|
|
| MD5 |
095053bf85f9a4c31c929a5b4c5a45dc
|
|
| BLAKE2b-256 |
b9b2450a0feb029a391ccfa0251fcf70fd0de5b0d3d91e001d82771986506b50
|