Skip to main content

No project description provided

Project description

BubbleMath

Overview

BubbleMath is a lightweight Python library for common mathematical operations and equations such as the quadratic formula and the Pythagorean Theorem (as well as inverse pythag).

Usage

To use the BubbleMath library, simply import it and call the desired functions.

Examples

  1. Import the BubbleMath library into your Python script.

    import BubbleMath
    
  2. Execute the desired functions.

    Square Root

    Calculate the square root of any number.

    >>> square_root(4)
    2.0
    >>> square_root(2)
    1.4142135623730951
    >>> square_root(2, precision=5)
    1.41421 # Rounded to 5 decimal places
    

    Factorial

    Calculate the factorial of any non-negative integer.

    >>> factorial(5)
    120
    >>> factorial(10)
    3628800
    

    Quadratic

    Calculate the roots of a quadratic equation using this formula:

    x = (-b +- root(b^2 - 4ac)) / (2a)

    >>> quadratic(1, -3, 2)
    (2.0, 1.0)
    >>> quadratic(3, -5, 2, precision=3)
    (1.0, 0.667)  # Rounded to 3 decimal places
    >>> quadratic(1, 0, -2, precision=5)
    (1.41421, -1.41421)  # Rounded to 5 decimal places
    

    Pythagorean Theorem

    Calculate the length of the hypotenuse using the Pythagorean theorem.

    a^2 + b^2 = c^2

    >>> pythag(3, 4)
    5.0
    >>> pythag(5, 9, 1) # Round to 1 decimal place
    10.3
    >>> pythag(2.3, 3.9, 3) # Round to 3 decimal places
    4.528
    

    Inverse Pythagorean Theorem

    Calculate the length of one missing side using the inverse Pythagorean theorem.

    b^2 = c^2 - a^2

    >>> inverse_pythag(5, 4)
    3.0
    >>> inverse_pythag(4.528, 2.3)
    3.9
    >>> inverse_pythag(10.3, 5, 1)
    9.0
    

Precision

For functions that return floats, you can choose your desired decimal point precision by passing the precision=n parameter at the end of the function you are executing, n being a positive integer. If left blank, the precision will use the function's default (all of these are in the type hints of the function itself).

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

BubbleMath-0.0.4.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

BubbleMath-0.0.4-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file BubbleMath-0.0.4.tar.gz.

File metadata

  • Download URL: BubbleMath-0.0.4.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for BubbleMath-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a325a44901f8dfc94828d6490c1017b9cd07d4398c3117be8605639954f860eb
MD5 42bd9cbc4f88e5331e52c1018c5b4e1a
BLAKE2b-256 8f2a927644fe6873d390f94482efec9e57aa93ba813c1f9ea064e34a51318737

See more details on using hashes here.

File details

Details for the file BubbleMath-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: BubbleMath-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for BubbleMath-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a8ac6da9e33361cce3f59dd22b9c72c0b5969e24aabb56489224faf727af0c47
MD5 dc7cd129f2bf0030baae28a4e743767c
BLAKE2b-256 23d414490ce95b2d0e0a074a565e966da15fbf051e5d9e9f8e577d66f0183626

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