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')# xᐨ¹
div5 = term('4x2')/term('4x2')# 1
Exponentiation
exp1 = term('2x')**2 # supported
exp2 = term('2x')**-1 # supported
exp2 = term('2x')**term('2x')# not supported
exp3 = term('2x')**2.5# 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.1.0.tar.gz
(4.6 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.1.0.tar.gz.
File metadata
- Download URL: algebra.py-1.1.0.tar.gz
- Upload date:
- Size: 4.6 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 |
0ce78011cd72d746f1d87ddc2aa0c7e0aaa15c583fe3a6e4f291c72e0e7c47a0
|
|
| MD5 |
8256e9c9cdccd0431a8cb9f2c24a6acd
|
|
| BLAKE2b-256 |
0edef4372e6a2465df153e4ea9303f0a649e4ede71f5d041b9fe85a57597f83d
|
File details
Details for the file algebra.py-1.1.0-py3-none-any.whl.
File metadata
- Download URL: algebra.py-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 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 |
7ea34f48e47d6bdce5b5905cf1173b4e3690203ba105852c232c0fac6b346cf9
|
|
| MD5 |
b19ebb3c7efb37655ea86433d1f9421e
|
|
| BLAKE2b-256 |
fd125ec4b96423651bcaed503ee9ff3f25446a845962fea65e0a4f61289fc811
|