Symbolipy
Symbolipy is a lightweight package to present mathematical equations, equality, and inequality in symbol format.
This package does not contain algebraic operations, but can be used with packages that support symbols.
The idea behind this package is to prevent default python equality operation on Operation object. Unlike other Symbol packages, == will yield to equality equation.
Version History
0.1.0
- Initial release
Installation
The latest Symoblipy release is hosted on PyPI. The package can be installed using pip command
pip install symbolipy
Python Version
Symbolipy will work on python version >= 3.8. No earlier version is officially supported.
Starting with Symbolipy
A symbol can be defined by following:
from symbolipy import Symbol
x = Symbol('X')
An equation is a combination of symbols, operands, and objects (including numbers). An equation can be formed by simply typing a mathematical equation.
>>> y = x**2 + 4*x + 6
>>> y
Add(((X ** 2) + (4 * X)), 6)
Similarly equality or inequality equation can be defined as following:
>>> z = y == x + 1
>>> z
Eq((((X ** 2) + (4 * X)) + 6), (X + 1))
The mathematical equation can be displayed by:
>>> str(y)
'(((X ** 2) + (4 * X)) + 6)'
the RHS and LHS of any equation can be accessed using .rhs and .lhs, respectively.
>>> y.rhs
6
>>> y.lhs
Add((X ** 2), (4 * X))
>>> y.lhs.lhs
Pow(X, 2)
>>> y.lhs.rhs
Mul(4, X)
>>> y.lhs.rhs.rhs
Symbol(X)
Symbols can be replaced by values using the .replace(values: dict[symbol_name, value]).
Note: to replace a symbol with a value, the symbol name (string) should be given. This does not work with Symbol object (i.e., {x: 6} does not work).
>>> y.replace({'X': 6})
66
Release files for symbolipy 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| symbolipy-1.0.0.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| symbolipy-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / symbolipy-1.0.0.tar.gz
| Download URL | symbolipy-1.0.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51b2588db26534aa39b8d57506634e68f943fcb40890462699998a112f375094
|
|
BLAKE2b-256 checksum How to use checksums |
6f57a838b4e94051c8967c6fd0996fca47a8a6eaabd0398c031889ccc704c01d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|
Release files / symbolipy-1.0.0-py3-none-any.whl
| Download URL | symbolipy-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e0aa3e552222ec56f4c4d31a564fd4ebb7dcb7fc322cfc16d7f6c1b9aff9bbc
|
|
BLAKE2b-256 checksum How to use checksums |
120c64fd1262931c8aef2fea2f21ae6febcf2d36fd8bd02e5844e923bae411ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|