Skip to main content

A Python library for efficient number theory and abstract algebra, featuring tools for primality testing, factorization, and advanced modular arithmetic.

Project description

AlgePy: Algebraic Tools in Pure Python

AlgePy Logo

License: Apache-2.0 Documentation


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"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algepy_tools-0.1.2.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algepy_tools-0.1.2-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file algepy_tools-0.1.2.tar.gz.

File metadata

  • Download URL: algepy_tools-0.1.2.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for algepy_tools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b23c7254a69b603c2594955e6d25f34a3162274c04364d19175b55bb7fe10370
MD5 7fa68efafbdc52f17b40bb4e01e5edbc
BLAKE2b-256 aac1f22dbbf74fb48d9ed78d1ba47745e518388c2fadeb2acdffb03814f6d030

See more details on using hashes here.

File details

Details for the file algepy_tools-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: algepy_tools-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for algepy_tools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6369083fb9f340890721a89ff05fb79036bb5c10147d9d3e18ced46f69d9e409
MD5 ffac7a486ef8a244a62daa8ade9b4dbb
BLAKE2b-256 db63b1f5ad4e8abcd31fe92155b8dabfbba35ab0669102716fefd56997dea803

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page