A lightweight math library by Andac Berkay.
Project description
Math Toolkit
A comprehensive Python library offering a wide range of fundamental mathematical functions implemented from scratch without relying on external modules. This toolkit aims to provide clear, efficient, and well-documented solutions for common mathematical operations, ideal for educational purposes and lightweight computational tasks.
Features
- Basic arithmetic operations: addition, subtraction, multiplication, division
- Advanced functions: factorial, permutations, combinations, exponents, roots
- Number theory utilities: prime checking, perfect numbers, GCD (Ebob), LCM (Ekok)
- Number system conversions: binary, octal, hexadecimal
- Special number checks: Armstrong number, even/odd classification, perfect numbers
- Additional utilities: digit sums, reverse numbers, logarithm calculations (custom implementation), Pythagorean checks
Function List
Arithmetic
addition(*args)subtraction(*args)multiplication(*args)division(a, b)mod(a, b)absolute_value(a)
Powers & Roots
exponents(a, b)roots(a)log_base(x, base)
Statistical
mean(*args)
Factorials, Permutations, Combinations
factorial(a)permutation(a, b)combination(a, b)
Number Theory
even_odd(a)is_prime(a)perfect_number(a)armstrong_number(a)gcd(a, b)(GCD)lcm(a, b)(LCM)
Number Utilities
digits_sum(a)reverse_number(a)cascad(a)— digit count string
Conversions
binary(a)octal(a)hexadecimal(a)
Geometry
pythagoras_three(a, b, c)hypotenuse(a, b)
Installation
Clone the repository to your local machine:
git clone https://github.com/andacberkaye/math-toolkit.git
No external dependencies required — pure Python.
Usage
Import the module and call desired functions:
from math_toolkit import Addition, Factorial, is_prime
print(addition(1, 2, 3)) # Output: 6
print(factorial(5)) # Output: 120
print(is_prime(17)) # Output: 17 is prime
✅ How to Run Tests
This project includes a lightweight tests.py file to validate core functionality of all implemented mathematical functions — without relying on any external libraries.
Steps
- Make sure you're in the root folder of the project.
- Run the test file using:
python tests.py
If everything works correctly, you will see:
Running tests...
✅ All tests passed successfully!
If any function fails, a clear error message will be shown to help you debug the problem.
Contribution
Contributions are welcome!
Feel free to open issues or submit pull requests to improve functionality, add new features, or fix bugs.
License
This project is licensed under the MIT License — see the LICENSE file for details.
Contact
Created by Andaç Berkaye
GitHub: andacberkaye
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file math_toolkit_tr-0.1.0.tar.gz.
File metadata
- Download URL: math_toolkit_tr-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26764862b9dada9eac317407676ba6425bb455275dc34ff6544cb339257b4a71
|
|
| MD5 |
7a59ebc507c1512cdfedc0d153425683
|
|
| BLAKE2b-256 |
6a0baab39d82b8536bcf120f03f42fac814959c6693b58902aa07782fd75d319
|
File details
Details for the file math_toolkit_tr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: math_toolkit_tr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d356c3379069296f652bb2ca88800e19e43c33362133bcadb5d000b160ef7d4
|
|
| MD5 |
6a1912a345ab588dde015bb90fdeb944
|
|
| BLAKE2b-256 |
7b246af1515b703ca3a68e802aa28ead4d36a8ec84025ca22c969915cef3e008
|