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-2.1.0.tar.gz (127.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-2.1.0-cp37-abi3-win_amd64.whl (30.4 MB view details)

Uploaded CPython 3.7+Windows x86-64

symbolica-2.1.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (27.5 MB view details)

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

symbolica-2.1.0-cp37-abi3-macosx_11_0_arm64.whl (24.6 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

symbolica-2.1.0-cp37-abi3-macosx_10_12_x86_64.whl (26.8 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for symbolica-2.1.0.tar.gz
Algorithm Hash digest
SHA256 daace787c3eb8cecfaf0a0534cad0584fcbe65a5370230565a1196b4a1297f9e
MD5 46cb68183be8a7fcfe42d8af9c1d3fb0
BLAKE2b-256 979aa9bcc7703248191dcfff668141193696147667c9eff0f711c604a58ff95c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for symbolica-2.1.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0f1281ba139633e1fc8a26030308c3ff9eeda752d0855098af639d86b5f0249c
MD5 c51da6f7c923164b151f0716dbd7caa6
BLAKE2b-256 c0391ea87b17d3f2e73a62b4aa1fc654edeb215f52f849cd22741ea0a0c65e01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-2.1.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2d4f4b7654c41d80c07dadd8e925e8ca40be7ae516b7442f3e899dbdc18880ca
MD5 b822dcf101adfa1a879a3006ac70eaa6
BLAKE2b-256 e52595ae489bc45dadf28c024196426c5ac682924b2f0390dae8ce1b27531a3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-2.1.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 de100656e89ae310c78d796e33516a2a361a4f54de57aa8d6eb49d579c14bca1
MD5 395db3c480837c96f6d30b66952f720d
BLAKE2b-256 2c73747bd300bc6b289fb79d6322c8f396f7d12f4c70b82c2be64de1b43b58c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-2.1.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c1063b1b1483f4351e0601b896521caa4201cf85def4c2339162ff195ebbf5b5
MD5 7baf8a72309f7204d1bda22cc87f26c4
BLAKE2b-256 8f78da735d30fe363db29a9568f2a41ce2d9a06642c81b38d0440b44829d58a6

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