<h1 align="center">
<br>
<img src="https://symbolica.io/logo.svg" alt="logo" width="200">
<br>
</h1>
<p align="center">
<a href="https://symbolica.io"><img alt="Symbolica website" src="https://img.shields.io/static/v1?label=symbolica&message=website&color=orange&style=flat-square"></a>
<a href="https://zulip.symbolica.io"><img alt="Zulip Chat" src="https://img.shields.io/static/v1?label=zulip&message=discussions&color=blue&style=flat-square"></a>
<a href="https://github.com/benruijl/symbolica"><img alt="Symbolica website" src="https://img.shields.io/static/v1?label=github&message=development&color=green&style=flat-square&logo=github"></a>
<a href="https://app.codecov.io/gh/benruijl/symbolica"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/benruijl/symbolica?token=N43MATK5XJ&style=flat-square"></a>
</p>
# Symbolica ⊆ Modern Computer Algebra
Symbolica is a blazing fast computer algebra system for Python and Rust, born of a need to push the boundaries of computations in science and enterprise.
Check out the live [Jupyter Notebook demo](https://colab.research.google.com/drive/1VAtND2kddgBwNt1Tjsai8vnbVIbgg-7D?usp=sharing)!
For documentation and more, see [symbolica.io](https://symbolica.io).
## Quick Example
Symbolica allows you to build and manipulate mathematical expressions, for example from a Jupyter Notebook:
<img width="600" alt="A demo of Symbolica" src="https://symbolica.io/resources/demo.light.svg">
You are able to perform these operations from the comfort of a programming language that you (probably) already know, by using Symbolica's bindings to Python and Rust:
<img width="600" alt="A demo of Symbolica" src="https://symbolica.io/resources/completion.light.png">
# Installation
Symbolica can be installed for Python >3.5 using `pip`:
```sh
pip install symbolica
```
Visit the [Get Started](https://symbolica.io/docs/get_started.html) page for detailed installation instructions.
# Examples
Below we list some examples of the features of Symbolica. Check the [guide](https://symbolica.io/docs/) for a complete overview.
### Pattern matching
Variables ending with a `_` are wildcards that match to any subexpression.
In the following example we try to match the pattern `f(w1_,w2_)`:
```python
from symbolica import *
x, y, w1_, w2_, f = S('x','y','w1_','w2_', 'f')
e = f(3,x)*y**2+5
r = e.replace_all(f(w1_,w2_), f(w1_ - 1, w2_**2))
print(r)
```
which yields `y^2*f(2,x^2)+5`.
### Solving a linear system
Solve a linear system in `x` and `y` with a parameter `c`:
```python
from symbolica import *
x, y, c, f = S('x', 'y', 'c', 'f')
x_r, y_r = Expression.solve_linear_system(
[f(c)*x + y + c, y + c**2], [x, y])
print('x =', x_r, ', y =', y_r)
```
which yields `x = (-c+c^2)*f(c)^-1` and `y = -c^2`.
### Series expansion
Perform a series expansion in `x`:
```python
from symbolica import *
e = E('exp(5+x)/(1-x)').series(S('x'), 0, 3)
print(e)
```
which yields `(exp(5))+(2*exp(5))*x+(5/2*exp(5))*x^2+(8/3*exp(5))*x^3+𝒪(x^4)`.
### Rational arithmetic
Symbolica is world-class in rational arithmetic, outperforming Mathematica, Maple, Form, Fermat, and other computer algebra packages. Simply convert an expression to a rational polynomial:
```python
from symbolica import *
p = E('(x*y^2*5+5)^2/(2*x+5)+(x+4)/(6*x^2+1)').to_rational_polynomial()
print(p)
```
which yields `(45+13*x+50*x*y^2+152*x^2+25*x^2*y^4+300*x^3*y^2+150*x^4*y^4)/(5+2*x+30*x^2+12*x^3)`.
# Community packages
The PyPi version of Symbolica ships with the following community packages:
- [spenso](https://github.com/alphal00p/spenso): perform tensor network computations
- [idenso](https://github.com/alphal00p/spenso): perform Dirac and color algebra
- [vakint](https://github.com/alphal00p/vakint): compute massive vacuum bubbles
They can be accessed through:
```python
import symbolica.community.spenso
```
Example use can be found [here](https://github.com/benruijl/symbolica-community/tree/main/examples).
## Development
Follow the development and discussions on [Zulip](https://reform.zulipchat.com)!
Raw data
{
"_id": null,
"home_page": null,
"name": "symbolica",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "math, algebra, polynomial, expression, manipulation",
"author": null,
"author_email": "Ben Ruijl <benruyl@gmail.com>, Lucien Huber <mail@lucien.ch>, Valentin Hirschi <valentin.hirschi@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f8/87/8ea8f29b0f4193b6feb2eda0094422684863ad94062a75414cdee600cdeb/symbolica-0.18.0.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">\n <br>\n <img src=\"https://symbolica.io/logo.svg\" alt=\"logo\" width=\"200\">\n <br>\n</h1>\n\n<p align=\"center\">\n<a href=\"https://symbolica.io\"><img alt=\"Symbolica website\" src=\"https://img.shields.io/static/v1?label=symbolica&message=website&color=orange&style=flat-square\"></a>\n <a href=\"https://zulip.symbolica.io\"><img alt=\"Zulip Chat\" src=\"https://img.shields.io/static/v1?label=zulip&message=discussions&color=blue&style=flat-square\"></a>\n <a href=\"https://github.com/benruijl/symbolica\"><img alt=\"Symbolica website\" src=\"https://img.shields.io/static/v1?label=github&message=development&color=green&style=flat-square&logo=github\"></a>\n <a href=\"https://app.codecov.io/gh/benruijl/symbolica\"><img alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/benruijl/symbolica?token=N43MATK5XJ&style=flat-square\"></a>\n</p>\n\n# Symbolica \u2286 Modern Computer Algebra\n\nSymbolica is a blazing fast computer algebra system for Python and Rust, born of a need to push the boundaries of computations in science and enterprise.\nCheck out the live [Jupyter Notebook demo](https://colab.research.google.com/drive/1VAtND2kddgBwNt1Tjsai8vnbVIbgg-7D?usp=sharing)!\n\nFor documentation and more, see [symbolica.io](https://symbolica.io).\n\n\n\n## Quick Example\n\nSymbolica allows you to build and manipulate mathematical expressions, for example from a Jupyter Notebook:\n\n<img width=\"600\" alt=\"A demo of Symbolica\" src=\"https://symbolica.io/resources/demo.light.svg\">\n\nYou are able to perform these operations from the comfort of a programming language that you (probably) already know, by using Symbolica's bindings to Python and Rust:\n\n<img width=\"600\" alt=\"A demo of Symbolica\" src=\"https://symbolica.io/resources/completion.light.png\">\n\n# Installation\n\nSymbolica can be installed for Python >3.5 using `pip`:\n\n```sh\npip install symbolica\n```\n\nVisit the [Get Started](https://symbolica.io/docs/get_started.html) page for detailed installation instructions.\n\n\n# Examples\n\nBelow we list some examples of the features of Symbolica. Check the [guide](https://symbolica.io/docs/) for a complete overview.\n\n### Pattern matching\n\nVariables ending with a `_` are wildcards that match to any subexpression.\nIn the following example we try to match the pattern `f(w1_,w2_)`:\n\n```python\nfrom symbolica import *\nx, y, w1_, w2_, f = S('x','y','w1_','w2_', 'f')\ne = f(3,x)*y**2+5\nr = e.replace_all(f(w1_,w2_), f(w1_ - 1, w2_**2))\nprint(r)\n```\nwhich yields `y^2*f(2,x^2)+5`.\n\n### Solving a linear system\n\nSolve a linear system in `x` and `y` with a parameter `c`:\n\n```python\nfrom symbolica import *\n\nx, y, c, f = S('x', 'y', 'c', 'f')\n\nx_r, y_r = Expression.solve_linear_system(\n [f(c)*x + y + c, y + c**2], [x, y])\nprint('x =', x_r, ', y =', y_r)\n```\nwhich yields `x = (-c+c^2)*f(c)^-1` and `y = -c^2`.\n\n### Series expansion\n\nPerform a series expansion in `x`:\n\n```python\nfrom symbolica import *\ne = E('exp(5+x)/(1-x)').series(S('x'), 0, 3)\n\nprint(e)\n```\nwhich yields `(exp(5))+(2*exp(5))*x+(5/2*exp(5))*x^2+(8/3*exp(5))*x^3+\ud835\udcaa(x^4)`.\n\n### Rational arithmetic\n\nSymbolica is world-class in rational arithmetic, outperforming Mathematica, Maple, Form, Fermat, and other computer algebra packages. Simply convert an expression to a rational polynomial:\n```python\nfrom symbolica import *\np = E('(x*y^2*5+5)^2/(2*x+5)+(x+4)/(6*x^2+1)').to_rational_polynomial()\nprint(p)\n```\nwhich yields `(45+13*x+50*x*y^2+152*x^2+25*x^2*y^4+300*x^3*y^2+150*x^4*y^4)/(5+2*x+30*x^2+12*x^3)`.\n\n\n# Community packages\n\nThe PyPi version of Symbolica ships with the following community packages:\n- [spenso](https://github.com/alphal00p/spenso): perform tensor network computations\n- [idenso](https://github.com/alphal00p/spenso): perform Dirac and color algebra\n- [vakint](https://github.com/alphal00p/vakint): compute massive vacuum bubbles\n\nThey can be accessed through:\n\n```python\nimport symbolica.community.spenso\n```\n\nExample use can be found [here](https://github.com/benruijl/symbolica-community/tree/main/examples).\n\n## Development\n\nFollow the development and discussions on [Zulip](https://reform.zulipchat.com)!\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Community-enhanced version of Symbolica: a blazing fast computer algebra system",
"version": "0.18.0",
"project_urls": null,
"split_keywords": [
"math",
" algebra",
" polynomial",
" expression",
" manipulation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a045cfae4a98a1fe9663e5a0e7f232f547308cff3ea732933b2fcb0b7a38ab65",
"md5": "4382125d0db815c9fcae356b61044266",
"sha256": "4fb8bd329642b7ec51a0b9a226954b0312425323b3542f2e63c171e48df05b52"
},
"downloads": -1,
"filename": "symbolica-0.18.0-cp310-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "4382125d0db815c9fcae356b61044266",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.7",
"size": 20398835,
"upload_time": "2025-09-04T08:36:03",
"upload_time_iso_8601": "2025-09-04T08:36:03.815228Z",
"url": "https://files.pythonhosted.org/packages/a0/45/cfae4a98a1fe9663e5a0e7f232f547308cff3ea732933b2fcb0b7a38ab65/symbolica-0.18.0-cp310-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9c82d3cf3df128c9188e1b064f87fd88b55b1d8019d959ea1e74cc4558db63f6",
"md5": "d1040d9337051e637a4afa5ed45e8fca",
"sha256": "959dbf51c201db529fe526335df08f4876489f9d63b69c34381364711a5936f6"
},
"downloads": -1,
"filename": "symbolica-0.18.0-cp310-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "d1040d9337051e637a4afa5ed45e8fca",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.7",
"size": 18412032,
"upload_time": "2025-09-04T08:36:14",
"upload_time_iso_8601": "2025-09-04T08:36:14.162919Z",
"url": "https://files.pythonhosted.org/packages/9c/82/d3cf3df128c9188e1b064f87fd88b55b1d8019d959ea1e74cc4558db63f6/symbolica-0.18.0-cp310-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b90515b29986eed6b470e622046967ca6a20457331439feca63588ce8e97a9f4",
"md5": "e1083988e8e80265eea41a323358a538",
"sha256": "730145ff41ea683339288c4bbbe95a088cd90522989280fb8c8c02ab8b051b62"
},
"downloads": -1,
"filename": "symbolica-0.18.0-cp312-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "e1083988e8e80265eea41a323358a538",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.7",
"size": 22288106,
"upload_time": "2025-09-04T08:36:48",
"upload_time_iso_8601": "2025-09-04T08:36:48.375731Z",
"url": "https://files.pythonhosted.org/packages/b9/05/15b29986eed6b470e622046967ca6a20457331439feca63588ce8e97a9f4/symbolica-0.18.0-cp312-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "da076a5e5ea0656efcddb7198cd23fce0780709aef480bbd0757bd2e8194cef0",
"md5": "b58b5dcc0a80dfa38384f08fbb831818",
"sha256": "f462839b0a5837a8ecbe7dba981e9bb5d57562ef614d94c4597445f707fcd161"
},
"downloads": -1,
"filename": "symbolica-0.18.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "b58b5dcc0a80dfa38384f08fbb831818",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.7",
"size": 20874383,
"upload_time": "2025-09-04T08:35:52",
"upload_time_iso_8601": "2025-09-04T08:35:52.222596Z",
"url": "https://files.pythonhosted.org/packages/da/07/6a5e5ea0656efcddb7198cd23fce0780709aef480bbd0757bd2e8194cef0/symbolica-0.18.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f8878ea8f29b0f4193b6feb2eda0094422684863ad94062a75414cdee600cdeb",
"md5": "f46866d8123ed1227e34d0b9da26e204",
"sha256": "60f06ac3c61864af6835eb448114521c3eb3adc2d4e7439cd9396b5d884f08a9"
},
"downloads": -1,
"filename": "symbolica-0.18.0.tar.gz",
"has_sig": false,
"md5_digest": "f46866d8123ed1227e34d0b9da26e204",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 84251,
"upload_time": "2025-09-04T08:35:24",
"upload_time_iso_8601": "2025-09-04T08:35:24.628914Z",
"url": "https://files.pythonhosted.org/packages/f8/87/8ea8f29b0f4193b6feb2eda0094422684863ad94062a75414cdee600cdeb/symbolica-0.18.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-04 08:35:24",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "symbolica"
}