https://github.com/psaegert/simplipy
Efficient Simplification of Mathematical Expressions
https://github.com/psaegert/simplipy
computer-algebra-system expression-simplificator mathematical-expressions symbolic-regression sympy
Last synced: 2 months ago
JSON representation
Efficient Simplification of Mathematical Expressions
- Host: GitHub
- URL: https://github.com/psaegert/simplipy
- Owner: psaegert
- License: mit
- Created: 2025-06-04T17:40:55.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-18T17:20:29.000Z (3 months ago)
- Last Synced: 2026-03-19T01:57:42.993Z (3 months ago)
- Topics: computer-algebra-system, expression-simplificator, mathematical-expressions, symbolic-regression, sympy
- Language: Python
- Homepage:
- Size: 6.97 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
SimpliPy:
Efficient Simplification of Mathematical Expressions
[](https://pypi.org/project/simplipy/)
[](https://pypi.org/project/simplipy/)
[](https://simplipy.readthedocs.io/en/latest/?badge=latest)
[](https://github.com/psaegert/simplipy/actions/workflows/pytest.yml)
[](https://github.com/psaegert/simplipy/actions/workflows/pre-commit.yml)
[](https://github.com/psaegert/simplipy/actions/workflows/codeql.yaml)
# Publications
- Saegert & Köthe 2026, _Breaking the Simplification Bottleneck in Amortized Neural Symbolic Regression_ (preprint, under review) [https://arxiv.org/abs/2602.08885](https://arxiv.org/abs/2602.08885)
# Usage
```sh
pip install simplipy
```
```python
import simplipy as sp
engine = sp.SimpliPyEngine.load("dev_7-3", install=True)
# Simplify prefix expressions
engine.simplify(('/', '', '*', '/', '*', 'x3', '', 'x3', 'log', 'x3'))
# > ('/', '', 'log', 'x3')
# Simplify infix expressions
engine.simplify('x3 * sin( + 1) / (x3 * x3)')
# > ' / x3'
```
More examples can be found in the [documentation](https://simplipy.readthedocs.io/).
# Performance
Left: Empirical Cumulative Distribution Functions (ECDFs) of simplification wall-clock time. Our SimpliPy rewriting engine (shades of blue, varying Lmax) operates in the low to moderate millisecond regime, orders of magnitude faster than the SymPy [Meurer et al. 2017] baseline (orange, red). Right: ECDF of the simplification ratio |τ ∗|/|τ |. The inset highlights the tail of the distribution. Our method with Lmax ≥ 5 achieves simplification ratios comparable to the SymPy baseline while maintaining high throughput.
Source expressions are sampled with 0 to 17 unique variables and 1 to 35 symbols [Saegert & Köthe 2026]
# Development
## Setup
To set up the development environment, run the following commands:
```sh
pip install -e .[dev]
pre-commit install
```
## Tests
Test the package with `pytest`:
```sh
pytest tests --cov src --cov-report html
```
or to skip integration tests,
```sh
pytest tests --cov src --cov-report html -m "not integration"
```
# Citation
```bibtex
@misc{saegert2026breakingsimplificationbottleneckamortized,
title = {Breaking the Simplification Bottleneck in Amortized Neural Symbolic Regression},
author = {Paul Saegert and Ullrich Köthe},
year = {2026},
eprint = {2602.08885},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2602.08885},
}
% Optionally
@software{simplipy-2025,
author = {Paul Saegert},
title = {Efficient Simplification of Mathematical Expressions},
year = 2025,
publisher = {GitHub},
version = {0.2.14},
url = {https://github.com/psaegert/simplipy}
}
```