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.0.tar.gz (123.6 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.0-cp37-abi3-win_amd64.whl (27.2 MB view details)

Uploaded CPython 3.7+Windows x86-64

symbolica-1.5.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.6 MB view details)

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

symbolica-1.5.0-cp37-abi3-macosx_11_0_arm64.whl (21.9 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

symbolica-1.5.0-cp37-abi3-macosx_10_12_x86_64.whl (24.1 MB view details)

Uploaded CPython 3.7+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for symbolica-1.5.0.tar.gz
Algorithm Hash digest
SHA256 f07ee745469e1daedc79b968c2128687ff5c3a1aa7ab60c22819200dfce22ea8
MD5 d2b5131ce0508c466185639f8a9e6b05
BLAKE2b-256 0ed59527b9b36cbe27552cf721640451a7d9a2b40498382912551d29a3f78ee2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for symbolica-1.5.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 90fdbe83358ef55a78d607b8e4e97547bb936063757ef8300fcbf9fc9ad9d309
MD5 f722a14393f67fd4965c6f984bb967cf
BLAKE2b-256 b630482a8502a2c0b079145b332abddc8364bed6a7078218dfe874b5397ff55e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-1.5.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b3989482ab103c5740c8b855cbc6af1c126612cac711d8b5b5cdb51eaf1dc3f0
MD5 9de50e2fab7693f7716e71d41bbad72e
BLAKE2b-256 436e4ee91210b8a53181edec2d0a317e984674a1d7f19b1c8fd23619a72a2a97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-1.5.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 628756c719b6773b646afb68a5e9863492c8866bc93bba1c8bb82fe93704a18e
MD5 437c3b8efbc5fb1cbaf08958ec01d57d
BLAKE2b-256 6b19943cdfce13f6dbb79fb41d67968d6b968119793af7e6b7d6e1c08c98b4b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-1.5.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ec383182acace105ab4e5a3e3278fa73f6ee3a54cbfe348a91c25b47175ca09c
MD5 d26e1d65d6b2dc9ba248656bdab093ab
BLAKE2b-256 f1330d18130271e5b6ad0615ffb8bc370c0f1313364db12fa5a381826e43a594

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