AlgePy: Algebraic Tools in Pure Python
1. Introduction
Module Overview
AlgePy is a Python library for discrete algebra and computational number theory. It provides efficient, mathematically rigorous tools for working with number theory and algebraic structures. All algorithms are verified for complexity and correctness.
Functionality
DiscreteFunctions
PrimalityTesting: Implements deterministic (Sieve of Eratosthenes) and probabilistic (Fermat, Miller–Rabin) methods for testing prime numbers.PrimeNumberTheorem: Provides functions to estimate the density and count of primes.Factorization: Offers algorithms to compute divisors and perform prime factorization.ArithmeticFunctions: Contains number-theoretic functions such as Euler’s totient, Möbius function, Liouville function, and divisor sums.
SingletonStructures
Z: Represents elements of the ring of integers (ℤ) with overloaded arithmetic and number-theoretic checks.R: Models real numbers (ℝ) with standard arithmetic operations.Z_n&Z_mod_: Provide modular arithmetic (ℤₙ) functionality, including methods for computing orders, inverses, cyclicity, primitive roots, and the Legendre symbol.
QuadraticStructures
C: Models real numbers (ℂ) with standard arithmetic operations.Q: Represents elements of the field of rationals (ℚ) with overloaded arithmetic.QuadInt&QuadIntRing: Provide quadratic integer (ℤ[ω]) functionality, including methods for floor division, greatest-common-divisor (gcd), normalization, and factorization. Also provided are ring-wide functions such as fundamental and imaginary unit search.QuadRat&QuadRatField: Provide quadratic rational (ℚ(√d)) functionality, including true division, several types of embedding, inverses, etc.
AlgePy also integrates empirical complexity analysis to assess the performance of its algorithms.
2. Getting Started
Installation
Install AlgePy via PyPi:
pip install algepy-tools
Or install directly from GitHub:
pip install git+https://github.com/sumaddury/AlgePy.git
Or install directly from source:
git clone https://github.com/sumaddury/AlgePy.git
cd algepy
pip install .
Quick Usage Example
from AlgePy.DiscreteFunctions import PrimalityTesting, Factorization
from AlgePy.SingletonStructures import Z
# Check if a number is prime using the Sieve of Eratosthenes
n = 29
print(f"{n} is prime: {PrimalityTesting.eratosthenes_primality(n)}")
# Factorize a number
print("Factorization of 360:", Factorization.factorize(360))
# Work with the ring of integers ℤ
a = Z(15)
b = Z(10)
print("a + b =", a + b)
For working with quadratic systems:
from AlgePy.QuadraticStructures import QuadRatField, Q
# Create a quadratic rational field Q(√2)
field = QuadRatField(2)
q = field(Q(3, 1), Q(5, 1))
print("q =", q)
print("q inverse =", q.inverse())
3. Documentation & Analysis
Full Documentation: sumaddury.github.io/AlgePy
API Reference: Detailed API docs are automatically generated using Sphinx.
Complexity Analysis: /complexity/
4. Citation
cff-version: 1.2.0
title: "AlgePy"
version: "0.0.1"
date-released: "2025-03-31"
authors:
- given-names: Sucheer
family-names: Maddury
repository-code: "https://github.com/sumaddury/algepy"
license: "Apache-2.0"
Metadata
Release files for algepy-tools 0.1.2
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 |
|---|---|---|---|---|
| algepy_tools-0.1.2.tar.gz | 23.8 kB | Without provenance | Details for algepy_tools-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| algepy_tools-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for algepy_tools-0.1.2-py3-none-any.whl |
Total release size: 47.4 kB
Release files / algepy_tools-0.1.2.tar.gz
| Download URL | algepy_tools-0.1.2.tar.gz |
|---|---|
| Size | 23.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b23c7254a69b603c2594955e6d25f34a3162274c04364d19175b55bb7fe10370
|
|
BLAKE2b-256 checksum How to use checksums |
aac1f22dbbf74fb48d9ed78d1ba47745e518388c2fadeb2acdffb03814f6d030
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / algepy_tools-0.1.2-py3-none-any.whl
| Download URL | algepy_tools-0.1.2-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6369083fb9f340890721a89ff05fb79036bb5c10147d9d3e18ced46f69d9e409
|
|
BLAKE2b-256 checksum How to use checksums |
db63b1f5ad4e8abcd31fe92155b8dabfbba35ab0669102716fefd56997dea803
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for algepy-tools 0.1.2
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.