Skip to main content

Symbolica is 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

Visit the Get Started page for detailed installation instructions.

Python

Symbolica can be installed for Python >3.5 using pip:

pip install symbolica

Rust

If you want to use Symbolica as a library in Rust, simply include it in the Cargo.toml:

[dependencies]
symbolica = "0.13"

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).

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-0.13.0.tar.gz (679.5 kB view details)

Uploaded Source

Built Distributions

symbolica-0.13.0-cp37-abi3-win_amd64.whl (8.0 MB view details)

Uploaded CPython 3.7+ Windows x86-64

symbolica-0.13.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.3 MB view details)

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

symbolica-0.13.0-cp37-abi3-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.7+ macOS 11.0+ ARM64

symbolica-0.13.0-cp37-abi3-macosx_10_12_x86_64.whl (8.1 MB view details)

Uploaded CPython 3.7+ macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for symbolica-0.13.0.tar.gz
Algorithm Hash digest
SHA256 7d6e39b4368f68484c32c837506d5ad560a895b1340e5b49548a3bec75c6bf55
MD5 c5c3b5d5d68324bc4b2636fa2bbcbf91
BLAKE2b-256 e1305d0e2d0720043b7ee1338f18cdbc87158d8068808cae9186aadf05c3444f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-0.13.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 77cdc69a95c8706cc8b1e3cc7734ad89e6d5058bcb508aed23a903ddde77e578
MD5 4466c4a5b3d570c950b71c01d5dc385c
BLAKE2b-256 1fc8b19eabe9a37f6cae515543badf144565502af56625489f4f506f06a166ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-0.13.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8638378720f943255c66b0dae77a7131b27d761c7a7267ae7186f392d8802db6
MD5 d4e8e88b6d3da3e5ab1a945f3ed4da39
BLAKE2b-256 823e07fad1b5a095d67a8a7bca9c6f5e1e82a641b1028c303ccaeb248ac32e5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-0.13.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a31f028a49bd76e07fbd04198f3254dd2d04b453ab4c4f92f46798fc7564350
MD5 2663226d2cf94a6fe7898eddfcef82a1
BLAKE2b-256 e4fd6165f2cfaf59842213de11fe12157c3d9093ef177f3aad0baf1b68279d25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for symbolica-0.13.0-cp37-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 465124fe28fb589aa28c4fd1f5cd752bd24c6b1b5d54fb464f89d55841aa6167
MD5 0cdf4cd31b7738ab9195883cc8723a88
BLAKE2b-256 ef819c95c76498a69414300216f62887f088f7bbe51533b00d5155292d24ac38

See more details on using hashes here.

Supported by

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