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')# 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


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.1.tar.gz (4.7 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-1.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: algebra.py-1.1.1.tar.gz
  • Upload date:
  • Size: 4.7 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-1.1.1.tar.gz
Algorithm Hash digest
SHA256 fd436271bf173c13dc59f234c6bd17c95e145acc15380aa629baf7e2bb184789
MD5 ae2866797002eefd600b11fe3d6efec6
BLAKE2b-256 fd0500fc7cf34b46e2ff0e7f22113b69dc01c001c7ce929785b22d47d447202f

See more details on using hashes here.

File details

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

File metadata

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

Hashes for algebra.py-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 877120a396a3b39d1ce688e2f0a2a028a1cee02c283398a2e9b7827b0ce4508b
MD5 8f1ca44784888c0b40ebc64e1d59e5a5
BLAKE2b-256 6b97ad8f41648835167ddf599d465e7ef79e60c0a806412696f2582daf31803e

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