Skip to main content

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


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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algebra.py-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file algebra.py-0.1.0.tar.gz.

File metadata

  • Download URL: algebra.py-0.1.0.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

Hashes for algebra.py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ee270b064e50b7111bc739059d8f351a0e5236526efac2e38e13eb13cd7aaaef
MD5 8898f90b22865b741e9258df65b98d4b
BLAKE2b-256 e3dc133ca48f3e21474a09ba6799966cafb75fa8edf977266b4e67f949811799

See more details on using hashes here.

File details

Details for the file algebra.py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: algebra.py-0.1.0-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

Hashes for algebra.py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6e9ba7a66ae7b3f4ee48efa020573f52e68dc84530ea11b1c5bbd1a6a5293be
MD5 c099b3561b455de0615244bf6952cbfd
BLAKE2b-256 28f6a6b32a6f80b5932440fc837fac14ad30a50d1b7ced21fb9037469515cc44

See more details on using hashes here.

Supported by

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