No project description provided
Reason this release was yanked:
bad documentation, doesn't work
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
-
Import the
BubbleMath
library into your Python script.import BubbleMath
-
Execute the desired functions.
Square Root
Calculate the square root of any number.
>>> square_root(4) 2 >>> 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 ± √(b² - 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² + b² = c²
>>> 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² = c² - a²
>>> 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
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
Built Distribution
Hashes for BubbleMath-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4538020d4dc8cd678c23330e5cb0b23609d5d86a15236f053752ad63d4a37b8c |
|
MD5 | 93a4484a39ab0d07d79785301dbec5c9 |
|
BLAKE2b-256 | ce70748f749c633880c089a7849bcb140d4ff2020eb0d348cd654becb810a1ad |