A simple python package for algebraic calculations
Project description
algebra
Install with PyPi
pip install algebra.py
How to use
Importing
from algebra.components import term
Initializing
Note: to see the output shown in the comments you need to run print() or str() at the answer
term1 = term('2x')# 2x
#exponent in terms
term2 = term('2x²')# 2x²
term3 = term('2x2')# also works
#supports multiple variables
term4 = term('2x2y3')# 2x²y³
# suports negative coefficients
term5 = term('-2x3')# -2x³
Supported Operations
sum
substraction is supported the same way
sum1 = term('2x') + term('3x')# 5x
sum2 = term('2x') + term('2y')# 2x + 2y
# support for integer sum
sum3 = term('3x') + 4 # 3x + 4
multiplication
mul1 = term('2x') * 4# 8x
mul2 = term('2x') * term('3x')# 6x²
mul3 = term('2x') * term('3y')# 6xy
mul4 = term('2xy') * term('3yz')# 6xy²z
division
div1 = term('4x')/2 # 2x
div2 = term('4x')/term('2x')# 2
div3 = term('4x2')/term('4x')# x
div4 = term('4x')/term('4x2')# not supported yet
div5 = term('4x2')/term('4x2')# not supported yet
Exponentiation
exp1 = term('2x')**2 # supported
exp2 = term('2x')**-1 #not supported
exp2 = term('2x')**term('2x')# not supported
exp3 = term('2x')**2.5# not supported
polynoms
example
pol1 = term('2x') + term('3y') # 2x + 3y
pol2 = term('2x') - 2 # 2x - 2
# sum
pol4 = pol1 + pol2 # 4x + 3y - 2
# multiplication
pol5 = pol1 * pol2 # supported
# exponentiation
pol6 = pol5**2 # supported
pol7 = pol5**2.5 # not supported
pol8 = pol6**pol5 # not supported
polynoms support sum, substraction, multiplication and exponents as terms do. division is not supported
have fun!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
algebra.py-1.0.2.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file algebra.py-1.0.2.tar.gz.
File metadata
- Download URL: algebra.py-1.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c2bbf41683e3665839543b2700c4bf0fd7d1049add71e7c26b5fe0458c7e8fd
|
|
| MD5 |
54d090e2ad3a1673c6fca5e1610698e6
|
|
| BLAKE2b-256 |
ee536c369d4ec4c882e4ac84a68b8281013c7ad374eafe0661c7c06c85a52363
|
File details
Details for the file algebra.py-1.0.2-py3-none-any.whl.
File metadata
- Download URL: algebra.py-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61ae98dc06d6c17bace2e69a219458a806ef0cd2c04c900577ca51288c11b7de
|
|
| MD5 |
1af90c8dd1e0d501f63ed6292f6baa12
|
|
| BLAKE2b-256 |
bfc43625dd7b6fc81ce051361dbd6abe315a0900cc2c94dd94f68237d2840558
|