symbolica


Namesymbolica JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
SummarySymbolica is a blazing fast computer algebra system
upload_time2024-04-15 13:40:16
maintainerNone
docs_urlNone
authorBen Ruijl
requires_pythonNone
licenseNone
keywords math algebra polynomial expression manipulation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
  <br>
  <img src="https://symbolica.io/logo.svg" alt="logo" width="200">
  <br>
</h1>

<p align="center">
<a href="https://symbolica.io"><img alt="Symbolica website" src="https://img.shields.io/static/v1?label=symbolica&message=website&color=orange&style=flat-square"></a>
  <a href="https://reform.zulipchat.com"><img alt="Zulip Chat" src="https://img.shields.io/static/v1?label=zulip&message=discussions&color=blue&style=flat-square"></a>
    <a href="https://github.com/benruijl/symbolica"><img alt="Symbolica website" src="https://img.shields.io/static/v1?label=github&message=development&color=green&style=flat-square&logo=github"></a>
    <a href="https://app.codecov.io/gh/benruijl/symbolica"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/benruijl/symbolica?token=N43MATK5XJ&style=flat-square"></a>
</p>

# Symbolica

Symbolica is a blazing fast and modern computer algebra system which aims to handle huge expressions. It can easily be incorporated into existing projects using its Python, Rust or C++ bindings.
Check out the live [Jupyter Notebook demo](https://colab.research.google.com/drive/1VAtND2kddgBwNt1Tjsai8vnbVIbgg-7D?usp=sharing)!

For documentation and more, see [symbolica.io](https://symbolica.io).



## Quick Example

Symbolica allows you to build and manipulate mathematical expressions through matching and replacing patterns, similar to `regex` for text:

<img width="600" alt="A demo of Symbolica" srcset="https://symbolica.io/resources/demo.light.gif">

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, Rust and C++:

<img width="600" alt="A demo of Symbolica" src="https://symbolica.io/resources/completion.light.png">

# Installation

Visit the [Get Started](https://symbolica.io/docs/get_started.html) page for detailed installation instructions.

## Python

Symbolica can be installed for Python >3.5 using `pip`:

```sh
pip install symbolica
```

The installation may take some time on Mac OS and Windows, as it may have to compile Symbolica.

## Rust

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

```toml
[dependencies]
symbolica = "0.4"
```

# Examples

Below we list some examples of the features of Symbolica. Check the [guide](https://symbolica.io/docs/) 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_)`:

```python
from symbolica import Expression
x, y, w1_, w2_ = Expression.vars('x','y','w1_','w2_')
f = Expression.fun('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`:

```python
from symbolica import Expression

x, y, c = Expression.vars('x', 'y', 'c')
f = Expression.fun('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 the Taylor series in `x` of an expression that contains a user-defined function `f`:

```python
from symbolica import Expression

x, y = Expression.vars('x', 'y')
f = Expression.fun('f')

e = 2* x**2 * y + f(x)
e = e.taylor_series(x, 0, 2)

print(e)
```
which yields `f(0)+x*der(1,f(0))+1/2*x^2*(4*y+der(2,f(0)))`.

### 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:
```python
from symbolica import Expression
x, y = Expression.vars('x','y')
p = Expression.parse('(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](https://reform.zulipchat.com)!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "symbolica",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "math, algebra, polynomial, expression, manipulation",
    "author": "Ben Ruijl",
    "author_email": "benruyl@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/34/ca/e2b134d11c3dc7abbf4c6de9cedb6b7a3e5dc646f680e9de188890888742/symbolica-0.4.0.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n  <br>\n  <img src=\"https://symbolica.io/logo.svg\" alt=\"logo\" width=\"200\">\n  <br>\n</h1>\n\n<p align=\"center\">\n<a href=\"https://symbolica.io\"><img alt=\"Symbolica website\" src=\"https://img.shields.io/static/v1?label=symbolica&message=website&color=orange&style=flat-square\"></a>\n  <a href=\"https://reform.zulipchat.com\"><img alt=\"Zulip Chat\" src=\"https://img.shields.io/static/v1?label=zulip&message=discussions&color=blue&style=flat-square\"></a>\n    <a href=\"https://github.com/benruijl/symbolica\"><img alt=\"Symbolica website\" src=\"https://img.shields.io/static/v1?label=github&message=development&color=green&style=flat-square&logo=github\"></a>\n    <a href=\"https://app.codecov.io/gh/benruijl/symbolica\"><img alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/benruijl/symbolica?token=N43MATK5XJ&style=flat-square\"></a>\n</p>\n\n# Symbolica\n\nSymbolica is a blazing fast and modern computer algebra system which aims to handle huge expressions. It can easily be incorporated into existing projects using its Python, Rust or C++ bindings.\nCheck out the live [Jupyter Notebook demo](https://colab.research.google.com/drive/1VAtND2kddgBwNt1Tjsai8vnbVIbgg-7D?usp=sharing)!\n\nFor documentation and more, see [symbolica.io](https://symbolica.io).\n\n\n\n## Quick Example\n\nSymbolica allows you to build and manipulate mathematical expressions through matching and replacing patterns, similar to `regex` for text:\n\n<img width=\"600\" alt=\"A demo of Symbolica\" srcset=\"https://symbolica.io/resources/demo.light.gif\">\n\nYou 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, Rust and C++:\n\n<img width=\"600\" alt=\"A demo of Symbolica\" src=\"https://symbolica.io/resources/completion.light.png\">\n\n# Installation\n\nVisit the [Get Started](https://symbolica.io/docs/get_started.html) page for detailed installation instructions.\n\n## Python\n\nSymbolica can be installed for Python >3.5 using `pip`:\n\n```sh\npip install symbolica\n```\n\nThe installation may take some time on Mac OS and Windows, as it may have to compile Symbolica.\n\n## Rust\n\nIf you want to use Symbolica as a library in Rust, simply include it in the `Cargo.toml`:\n\n```toml\n[dependencies]\nsymbolica = \"0.4\"\n```\n\n# Examples\n\nBelow we list some examples of the features of Symbolica. Check the [guide](https://symbolica.io/docs/) for a complete overview.\n\n### Pattern matching\n\nVariables ending with a `_` are wildcards that match to any subexpression.\nIn the following example we try to match the pattern `f(w1_,w2_)`:\n\n```python\nfrom symbolica import Expression\nx, y, w1_, w2_ = Expression.vars('x','y','w1_','w2_')\nf = Expression.fun('f')\ne = f(3,x)*y**2+5\nr = e.replace_all(f(w1_,w2_), f(w1_ - 1, w2_**2))\nprint(r)\n```\nwhich yields `y^2*f(2,x^2)+5`.\n\n### Solving a linear system\n\nSolve a linear system in `x` and `y` with a parameter `c`:\n\n```python\nfrom symbolica import Expression\n\nx, y, c = Expression.vars('x', 'y', 'c')\nf = Expression.fun('f')\n\nx_r, y_r = Expression.solve_linear_system(\n    [f(c)*x + y + c, y + c**2], [x, y])\nprint('x =', x_r, ', y =', y_r)\n```\nwhich yields `x = (-c+c^2)*f(c)^-1` and `y = -c^2`.\n\n### Series expansion\n\nPerform the Taylor series in `x` of an expression that contains a user-defined function `f`:\n\n```python\nfrom symbolica import Expression\n\nx, y = Expression.vars('x', 'y')\nf = Expression.fun('f')\n\ne = 2* x**2 * y + f(x)\ne = e.taylor_series(x, 0, 2)\n\nprint(e)\n```\nwhich yields `f(0)+x*der(1,f(0))+1/2*x^2*(4*y+der(2,f(0)))`.\n\n### Rational arithmetic\n\nSymbolica is world-class in rational arithmetic, outperforming Mathematica, Maple, Form, Fermat, and other computer algebra packages. Simply convert an expression to a rational polynomial:\n```python\nfrom symbolica import Expression\nx, y = Expression.vars('x','y')\np = Expression.parse('(x*y^2*5+5)^2/(2*x+5)+(x+4)/(6*x^2+1)').to_rational_polynomial()\nprint(p)\n```\nwhich 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)`.\n\n## Development\n\nFollow the development and discussions on [Zulip](https://reform.zulipchat.com)!\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Symbolica is a blazing fast computer algebra system",
    "version": "0.4.0",
    "project_urls": {
        "homepage": "https://symbolica.io",
        "repository": "https://github.com/benruijl/symbolica"
    },
    "split_keywords": [
        "math",
        " algebra",
        " polynomial",
        " expression",
        " manipulation"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3547baf98c47ec028240556543afd7f68d40533312fedc3d8152d6a648cfc44a",
                "md5": "894cef54cbe61ed3edd25aa0fbf42d86",
                "sha256": "3b2fc064acab94b03beaeaf1d35929baae1eb93901785824817b46fc4533f8b1"
            },
            "downloads": -1,
            "filename": "symbolica-0.4.0-cp37-abi3-macosx_10_12_x86_64.whl",
            "has_sig": false,
            "md5_digest": "894cef54cbe61ed3edd25aa0fbf42d86",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": null,
            "size": 4008522,
            "upload_time": "2024-04-15T14:02:13",
            "upload_time_iso_8601": "2024-04-15T14:02:13.906569Z",
            "url": "https://files.pythonhosted.org/packages/35/47/baf98c47ec028240556543afd7f68d40533312fedc3d8152d6a648cfc44a/symbolica-0.4.0-cp37-abi3-macosx_10_12_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "796884ef05a41e5aae4675aba0e6ab8bfb1d417a890f386c6ac89a8c29d17698",
                "md5": "6af21385e162589298f7f3e1163a6e7e",
                "sha256": "ec12c3f638d45019195afeb1f512e551c40e545f68826eb4352dd91b535341f4"
            },
            "downloads": -1,
            "filename": "symbolica-0.4.0-cp37-abi3-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "6af21385e162589298f7f3e1163a6e7e",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": null,
            "size": 3342009,
            "upload_time": "2024-04-15T14:02:24",
            "upload_time_iso_8601": "2024-04-15T14:02:24.475207Z",
            "url": "https://files.pythonhosted.org/packages/79/68/84ef05a41e5aae4675aba0e6ab8bfb1d417a890f386c6ac89a8c29d17698/symbolica-0.4.0-cp37-abi3-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d97d0fb384093ffa4f46907c0af5f25226efeda149c624fce221467f9426a21c",
                "md5": "83e2f0f3df675b4ea17a3cafc085aa6b",
                "sha256": "e28538d9fec773d8f8ea90b6d29d4ae9364c588b437a803611f2bc46ac46eccd"
            },
            "downloads": -1,
            "filename": "symbolica-0.4.0-cp37-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "83e2f0f3df675b4ea17a3cafc085aa6b",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": null,
            "size": 3796300,
            "upload_time": "2024-04-15T13:40:12",
            "upload_time_iso_8601": "2024-04-15T13:40:12.674861Z",
            "url": "https://files.pythonhosted.org/packages/d9/7d/0fb384093ffa4f46907c0af5f25226efeda149c624fce221467f9426a21c/symbolica-0.4.0-cp37-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "34cae2b134d11c3dc7abbf4c6de9cedb6b7a3e5dc646f680e9de188890888742",
                "md5": "d86d753f27aa7a99ed479cbf6f8e1c86",
                "sha256": "200e2e15134c42f23a3eae61862e117a15b751a82515d17baf39a9a8702531b4"
            },
            "downloads": -1,
            "filename": "symbolica-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d86d753f27aa7a99ed479cbf6f8e1c86",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 540213,
            "upload_time": "2024-04-15T13:40:16",
            "upload_time_iso_8601": "2024-04-15T13:40:16.232406Z",
            "url": "https://files.pythonhosted.org/packages/34/ca/e2b134d11c3dc7abbf4c6de9cedb6b7a3e5dc646f680e9de188890888742/symbolica-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-15 13:40:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "benruijl",
    "github_project": "symbolica",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "symbolica"
}
        
Elapsed time: 0.23853s