Skip to main content

Community-enhanced version of Symbolica: a blazing fast computer algebra system

Project description


logo

Symbolica website Zulip Chat Symbolica website Codecov

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:

A demo of Symbolica

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:

A demo of Symbolica

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

symbolica-1.5.1.tar.gz (123.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

symbolica-1.5.1-cp37-abi3-win_amd64.whl (27.5 MB view details)

Uploaded CPython 3.7+Windows x86-64

symbolica-1.5.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.8 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ x86-64

symbolica-1.5.1-cp37-abi3-macosx_11_0_arm64.whl (22.2 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

symbolica-1.5.1-cp37-abi3-macosx_10_12_x86_64.whl (24.3 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

Details for the file symbolica-1.5.1.tar.gz.

File metadata

  • Download URL: symbolica-1.5.1.tar.gz
  • Upload date:
  • Size: 123.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.1

File hashes

Hashes for symbolica-1.5.1.tar.gz
Algorithm Hash digest
SHA256 22768cef5963f7d40ee0704c45de304621274b1e4facb58e71fead4d62c9ac39
MD5 03f8bdd493822de478eef65476f18199
BLAKE2b-256 77e887414337068ab1deebc1d298f623681ea3b0ace670b63a031b5cb19c48dd

See more details on using hashes here.

File details

Details for the file symbolica-1.5.1-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: symbolica-1.5.1-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 27.5 MB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.1

File hashes

Hashes for symbolica-1.5.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1dff615e9637f80f73ec06c61a1efa73ad93768f083fbcd0e885bd4e71567d1c
MD5 fede8216ae8865d51b8d21d4e18eebd7
BLAKE2b-256 33f813b2c460be229b05a7eda4a5ac96a852e39a7dfa1543656f3a5637d22afa

See more details on using hashes here.

File details

Details for the file symbolica-1.5.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for symbolica-1.5.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f607bfe9fa4a4b38651ad094b1a944d171f40401c3806e91ccc5d4146ceab347
MD5 c58562e19eea7302e2ae4fa6baa526e5
BLAKE2b-256 17398b5b1cee183c6b96ba68175da260e646daa12515bb3791afd92890ea0fb5

See more details on using hashes here.

File details

Details for the file symbolica-1.5.1-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for symbolica-1.5.1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb48682121b6847c9bd99c048f1ec9a349a7ff8095088e3d1aa9fa0912cc7d01
MD5 3a4f19d525ade7d034ed19061c11ee98
BLAKE2b-256 e6e1d8713932f9f40fa3fe63cd0b5b9e648a2fccdbf8eaf44228e79fa8c21d09

See more details on using hashes here.

File details

Details for the file symbolica-1.5.1-cp37-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for symbolica-1.5.1-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e8344275aad57531cb2bbab3e1e74d0b34a98debb1428a626bcae2f0e775dea9
MD5 be01402b4fb342c8b40b7a02194ccaea
BLAKE2b-256 838cd1678e43a63a5decaa05408a9cbcf41c4d17af6261fda750619b737979f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page