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 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.1.tar.gz (23.7 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.1-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: algepy_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 23.7 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.1.tar.gz
Algorithm Hash digest
SHA256 9f3f0d83d317763e67afb6398b145da98cdbd2e2c4983e769f688c7dcfa24841
MD5 9305aa5650e31c17d3403dec152d4b0f
BLAKE2b-256 0266695189f3f790b1f6e19bf9faca9371d61b79f80bb88f03cf0d5e85278499

See more details on using hashes here.

File details

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

File metadata

  • Download URL: algepy_tools-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 65aae2aab83c053eb01925fee0ac5283b864df006de8c939791820271c1b46ab
MD5 5455ff7ad5b9cc0c801760a71c7e980d
BLAKE2b-256 cc2fa18baa9965e6a2c8f1f7d370e6986d6ea93417f0e9cd97f4442c2a530ba6

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