Community-enhanced version of Symbolica: a blazing fast computer algebra system
Project description
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!
For documentation and more, see symbolica.io.
Quick Example
Symbolica allows you to build and manipulate mathematical expressions, for example from a Jupyter Notebook:
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:
Installation
Symbolica can be installed for Python >3.5 using pip:
pip install symbolica
Visit the Get Started page for detailed installation instructions.
Examples
Below we list some examples of the features of Symbolica. Check the guide 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_):
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:
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:
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:
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: perform tensor network computations
- idenso: perform Dirac and color algebra
- vakint: compute massive vacuum bubbles
They can be accessed through:
import symbolica.community.spenso
Example use can be found here.
Development
Follow the development and discussions on Zulip!
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 Distribution
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 symbolica-1.3.1.tar.gz.
File metadata
- Download URL: symbolica-1.3.1.tar.gz
- Upload date:
- Size: 108.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
845f46e38265e94eadab3bd1aad5b89bc565bdb6de224e10fd7c29490bd93a05
|
|
| MD5 |
5f23d89b564ec8b920a11afbca28538f
|
|
| BLAKE2b-256 |
39c7e5408fb314a87541a4340ce24941153f35addc513107621d137400375088
|
File details
Details for the file symbolica-1.3.1-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: symbolica-1.3.1-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 26.0 MB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e546786d728dc1dde9fce055f016d1a9bf302b70a93b6887126929cf95fb4ff
|
|
| MD5 |
057932b6019c7fd9d95c952a1bd6a93f
|
|
| BLAKE2b-256 |
d0214b8af8a1f6f11fb17276669c2760ba09f4ab0f5a9496e7f87c1ecf8ec019
|
File details
Details for the file symbolica-1.3.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: symbolica-1.3.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 23.6 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
538d53862c3e76681aa4383da286e26ec27159f5de9fe960bc8d859185b6a7e9
|
|
| MD5 |
934c741aab6899bd6a9e474c0aad8cc4
|
|
| BLAKE2b-256 |
1ddec6a584207da3d49d8523c87ed2da044467a6c8bf80590de47f1d6c991b4d
|
File details
Details for the file symbolica-1.3.1-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: symbolica-1.3.1-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 21.1 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edb7e4e5971ca00c40226735e557e1d5014147565cf09523950faf44f38c6584
|
|
| MD5 |
8c5071e6d819051532461f6c16e23b77
|
|
| BLAKE2b-256 |
7f3f8370f1f22257eb4a23953f469c22f4e80d591164ed45ad36fffd186333df
|
File details
Details for the file symbolica-1.3.1-cp37-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: symbolica-1.3.1-cp37-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 23.2 MB
- Tags: CPython 3.7+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aaa28c892fea6ea6712ec5be46c5a8afb19f132908071df0c709ca55fe1ff88c
|
|
| MD5 |
1c4f4b2abbc0bdc34612b1f2c6d8c76d
|
|
| BLAKE2b-256 |
9966ae35d9d8e08eccc01418bee0dc2e883da0f73903b61b40b6485453415830
|