Skip to main content

AxiomPy: The Python Mathematics & Computation Engine

PyPI version PyPI Downloads License: MIT Python Versions DOI

Author: RK Riad Khan (rkriad585)


Overview

AxiomPy is a Python mathematics engine built from first principles. It provides a unified API for linear algebra, graph analysis, number theory, automatic differentiation, optimization, signal processing, statistics, caching, constants, CLI tools, and number-theoretic novelties — all wired through a single Axiom singleton.

Features

  • First-principle implementations — algorithms written from scratch.
  • Linear algebraVector, Matrix, Tensor, SparseMatrix, decompositions.
  • Graph analysis — PageRank, MST, max flow, bipartiteness, topological sort.
  • Number theory — CRT, Miller-Rabin, discrete log, totient, prime sieves.
  • Automatic differentiation — reverse-mode AD with sin, exp, log, tanh.
  • Calculus — numerical derivatives, integration, ODE solvers (RK4, adaptive).
  • Optimization — gradient descent, Newton, Nelder-Mead, L-BFGS, simulated annealing.
  • Signal processing — FFT, convolution, FIR filters, spectrograms.
  • Statistics — descriptive stats, hypothesis tests, distributions, Bayesian.
  • Electromagnetism — Coulomb fields, potentials, magnetic fields.
  • Constants — 35 built-in math/physics/astronomy constants with search.
  • Cache — LRU cache with TTL, hit/miss stats, async memoize, persistence.
  • CLIaxiompy eval, factors, convert, constants, stats, help, shell.
  • Magic functions — roman numerals, number words, Kaprekar, Goldbach, look-and-say, Ulam spiral, Smith numbers, emirps, and more.
  • ASCII visualization — line plots, histograms, bar charts, field plots.
  • Clean APIfrom axiompy import Axiom gives access to everything.

Installation

pip install axiom-math

Requirements: Python ≥ 3.9, numpy.

Quick start

from axiompy import Axiom

# Linear algebra
M = Axiom.Matrix([[1, 2], [3, 4]])
v = Axiom.Vector([5, 6])
print(M @ v)           # Vector([17.0, 39.0])
print(M.determinant)   # -2.0

# PageRank
g = Axiom.Graph()
g.add_edge("A", "B"); g.add_edge("B", "C"); g.add_edge("C", "A")
print(Axiom.graph_analysis.pagerank(g))

# Automatic differentiation
x = Axiom.autodiff.Variable(3.0)
y = x ** 2 + 2 * x + 1
y.backward()
print(x.grad)          # 8.0 (dy/dx)

# Constants & CLI
Axiom.constants.PI           # 3.14159...
Axiom.constants.find("mass") # search by name

CLI

axiompy eval "2 * pi * 5^2"    # evaluate expression
axiompy factors 84              # prime factorization
axiompy constants mass          # search constants
axiompy convert 42              # binary, hex, roman, words
axiompy stats                   # cache & system info
axiompy help magic              # topic help
axiompy shell                   # interactive REPL

Documentation

Guides are in the docs/ directory:

Document Description
Tutorial Step-by-step intro for beginners
CLI Reference Command-line tool usage
Overview Architecture, module layout, API reference
Usage Guide Full API with code snippets per module
Getting Started Installation, first script, examples

Examples

Ready-to-run scripts in examples/:

uv run python examples/linear_algebra.py
uv run python examples/pagerank.py
uv run python examples/autodiff.py
uv run python examples/number_theory.py
uv run python examples/electric_field.py
uv run python examples/covariance.py
uv run python examples/ascii_plot.py

Development

git clone https://github.com/rkriad585/AxiomPy.git
cd AxiomPy
uv sync
uv build

Contributing

See docs/contributing.md. Bug reports and pull requests welcome on the GitHub repository.

License

MIT — see LICENSE.

Download files

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

Source Distribution

axiom_math-4.0.0.tar.gz (84.9 kB view details)

Uploaded Source

Built Distribution

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

axiom_math-4.0.0-py3-none-any.whl (99.8 kB view details)

Uploaded Python 3

File details

Details for the file axiom_math-4.0.0.tar.gz.

File metadata

  • Download URL: axiom_math-4.0.0.tar.gz
  • Upload date:
  • Size: 84.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for axiom_math-4.0.0.tar.gz
Algorithm Hash digest
SHA256 b4fa05dcc5bffe1af797e75f38ec71ca0f50acd60193dc65bc93b79479a246c4
MD5 e01343f2d997ba1caf5aa3cc6b52295f
BLAKE2b-256 c947da9e16dd5e7a9528932507589d31d243d6486db2f2d486794ac2d5b0029c

See more details on using hashes here.

File details

Details for the file axiom_math-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: axiom_math-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 99.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for axiom_math-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22e2583b3fb689ebdd374fb1dd405c07f7ed258f20f181c22ea3795d09d3f4a6
MD5 7f4479b5a3f9dc471a36036bcfb2e7ed
BLAKE2b-256 c57a0d6625de583a00a64e0ee47c27e3865478b041364455d9f90ca3ae0d1527

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