Advanced Math Utilities (adpkg)
Welcome! 👋 This package gives you a bunch of handy tools for math, finance, and geometry in Python. You don’t need to be a math expert—just import and use!
It includes modules for:
- Finance: Calculate compound interest easily
- Number Theory: Check primes, factorials, permutations, combinations
- Strings: Reverse words or phrases
- Matrices: Add, multiply, transpose, and find determinants
- Statistics: Mean, median, mode
- Geometry: Triangle area with Heron’s formula
📦 Installation
Install from PyPI (make sure you have Python installed):
pip install adpkg
Check if it worked:
python -m pip show adpkg
🚀 Quick Start
Here are simple examples to get you started. More detailed examples are below.
from adpkg import finance, adcustom, triangle
# Calculate compound interest
print(finance.interest(1000, "1y", 12, 5))
# Factorial
print(adcustom.factorial(5))
# Reverse a string
print(adcustom.string_reverse("hello"))
# Area of a triangle
print(triangle.areaoftriangle(3, 4, 5))
💰 Finance Module
interest(prime_amount, time_duration_str, n, rate)
- Calculates compound interest based on years/months.
- Duration formats:
"2y","6m", or"1y6m".
from adpkg import finance
print(finance.interest(1000, "1y", 12, 5)) # 51.161
print(finance.interest(2000, "5y", 4, 7)) # 816.622
# Edge case: invalid input
print(finance.interest(1000, "abc", 12, 5)) # None
🔢 AdCustom Module
Number Theory
check_prime(n) → 1 if prime, 0 if not, None if invalid.
print(adcustom.check_prime(17)) # 1
print(adcustom.check_prime(10)) # 0
factorial(n)
print(adcustom.factorial(5)) # 120
print(adcustom.factorial(-2)) # None
permutation(n, r)
print(adcustom.permutation(5, 2)) # 20
combination(n, r)
print(adcustom.combination(5, 2)) # 10
Strings
string_reverse(s)
print(adcustom.string_reverse("hello")) # "olleh"
Matrices
matrix_addition(a, b)
print(adcustom.matrix_addition([[1,2],[3,4]], [[5,6],[7,8]]))
# [[6,8],[10,12]]
matrix_multiplication(a, b)
print(adcustom.matrix_multiplication([[1,2],[3,4]], [[5,6],[7,8]]))
# [[19,22],[43,50]]
matrix_transpose(a)
print(adcustom.matrix_transpose([[1,2,3],[4,5,6]]))
# [[1,4],[2,5],[3,6]]
determinant_value(a)
print(adcustom.determinant_value([[1,2],[3,4]])) # -2
Statistics
mean(data)
print(adcustom.mean([1,2,3,4,5])) # 3.0
median(data)
print(adcustom.median([1,3,2,5,4])) # 3
mode(data)
print(adcustom.mode([1,2,2,3,4,4,4,5])) # ([4], 3)
🔺 Triangle Module
areaoftriangle(a, b, c, unit='')
- Uses Heron’s formula.
print(triangle.areaoftriangle(3, 4, 5)) # 6.0
print(triangle.areaoftriangle(3, 4, 5, "sq cm")) # "6.0 sq cm"
🧪 Running Tests
We included some test files (test1.py – test5.py).
Run one test:
python test1.py
Run all tests at once:
python -m unittest discover -s . -p "test*.py"
🛠️ Contributing
Want to help? Awesome! Here’s how:
- Fork this repo → Make your own copy on GitHub.
- Create a branch → Work on your changes in a separate branch.
- Add your code and tests → Make sure it works!
- Open a Pull Request → Propose your changes.
🗺️ Roadmap
- ✅ Current: Finance, number theory, strings, matrices, stats, triangles
- 🔜 Next: Probability, calculus, polynomials, advanced linear algebra
- 📊 Future: Machine learning helpers, symbolic algebra, optimization
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
📬 Contact
Metadata
Release files for adpkg 0.1.4
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 | |
|---|---|---|---|---|
| adpkg-0.1.4.tar.gz | 13.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| adpkg-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.4 kB
Release files / adpkg-0.1.4.tar.gz
| Download URL | adpkg-0.1.4.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a2a098baeb2b7cf55b263d90109b19a50de9eeda17ef7e26e8fd4c5e4fef41c
|
|
BLAKE2b-256 checksum How to use checksums |
0d105d54772fd6a1833664d77f16100cce8d10040728e2d48387115f7f4a4c99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / adpkg-0.1.4-py3-none-any.whl
| Download URL | adpkg-0.1.4-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
321492a21c11552622af709c08feb03038c5e78021e9b454a386f8116590a614
|
|
BLAKE2b-256 checksum How to use checksums |
7084e36ec8931a576c562d11305b1be22f9341248c8700fcd3c3aed13f611a32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for adpkg 0.1.4
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.