MathLib
A lightweight Python math utility library providing basic arithmetic, number theory, sequence operations, and mathematical helper functions.
This project is under active development and is not yet stable for production use. The library is planned to grow to 50+ functions before being published on PyPI.
Features
Basic Operations
- Addition
- Subtraction
- Multiplication
- Division
- Modulus
- Power
- Absolute value
- Rounding (round, ceil, floor)
- Clamp (value bounding)
Statistics & Utilities
- Minimum / Maximum
- Average
- Percentage calculations
- Percentage change
Number Theory
- GCD (Greatest Common Divisor)
- LCM (Least Common Multiple)
- Prime check
- Prime factorization
- Parity (Even / Odd)
Sequences
- Fibonacci (number / series)
- Range-based sum
- Range-based product
Geometry
- Distance (2D Euclidean distance)
- Hypotenuse calculation
Trigonometry (radians)
- sin, cos, tan, cot (Taylor series approximation)
- Degree ↔ Radian conversion
Mathematical Functions
- Factorial
- Square root
- Cube root
- Nth root
Advanced Mathematics
- Exponential function (exp)
- Natural logarithm (ln)
- Logarithm (log)
- Sigmoid function
- Numerical derivative (finite difference)
- Numerical integral (trapezoidal rule)
Installation
Clone the repository:
git clone https://github.com/andacberkaye/MathLib
cd MathLib
Import
Import the module
from Core import transactions as ts
Usage Examples
Basic Operations
ts.add(1, 2, 3)
ts.sub(10, 3, 2)
ts.multi(2, 3, 4)
ts.division(10, 2)
Advanced Math Functions
ts.round_number(3.6)
ts.ceil_number(3.1)
ts.floor_number(3.9)
ts.cube_root(27)
ts.nth_root(16, 4)
ts.percentage(200, 15)
ts.sin(0)
ts.cos(1.5708)
ts.tan(0.7854)
ts.cot(0.7854)
ts.degrees_to_radians(180)
ts.radians_to_degrees(3.14159)
ts.hypotenuse(3, 4)
ts.exp(1)
ts.ln(2.71828)
ts.log(8, 2)
ts.sigmoid(0)
ts.derivative(lambda x: x**2, 3)
ts.integral(lambda x: x**2, 0, 1)
ts.distance_2d(0, 0, 3, 4)
ts.clamp(150, 0, 100)
Number Theory
ts.gcd(60, 36)
ts.lcm(12, 18)
ts.prime_factors(84)
ts.is_prime(13)
Fibonacci
ts.fibonacci(6, "series")
ts.fibonacci(6, "number")
Range Operations
ts.add_range(1, 5)
ts.product_range(1, 5)
Square Roots
ts.sqrt(16)
Basic Operations
from Core import transactions
Roadmap
- Expand to 50+ functions
- Add vector and matrix operations
- Improve numerical stability (adaptive precision methods)
- Add unit tests (pytest)
- Optimize factorial and series computations
- Add error handling improvements
- Prepare PyPI release
- Add documentation site (docs-style)
Notes
- Division by zero raises errors
- Some functions require at least one argument
- Floating point precision may affect results
- Trigonometric functions use Taylor series approximation
- Logarithm and exponential functions use numerical approximations
- Results may slightly differ from Python's math module
Status
Under active development (experimental)
Author
Python math utilities project focused on clean code and modular design.
Metadata
Release files for mathlibtr 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mathlibtr-0.1.0.tar.gz | 7.0 kB | Without provenance | Details for mathlibtr-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mathlibtr-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mathlibtr-0.1.0-py3-none-any.whl |
Total release size: 14.3 kB
Release files / mathlibtr-0.1.0.tar.gz
| Download URL | mathlibtr-0.1.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
529d681a834677637ffa82b74e7a49e2249060bbd7241791e4806681b1a6bc5f
|
|
BLAKE2b-256 checksum How to use checksums |
38d632936f4af5a6fda26dee0e6cb21fd1bda78140bce8865b9abff71bd51d49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / mathlibtr-0.1.0-py3-none-any.whl
| Download URL | mathlibtr-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8089f1de4c97618a8b881841f8c663c51a013ca614cb76da955d4f3bbcf6a406
|
|
BLAKE2b-256 checksum How to use checksums |
112097f7ac3b07274fb8595512d65424959a15df2ece1848c61e8d9713ef26b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for mathlibtr 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.