AxiomPy: The Python Mathematics & Computation Engine
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 algebra —
Vector,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.
- CLI —
axiompy 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 API —
from axiompy import Axiomgives 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.
Metadata
Release files for axiom-math 4.0.0
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 |
|---|---|---|---|---|
| axiom_math-4.0.0.tar.gz | 84.9 kB | Without provenance | Details for axiom_math-4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| axiom_math-4.0.0-py3-none-any.whl | Python 3 | none | any | Details for axiom_math-4.0.0-py3-none-any.whl |
Total release size: 184.8 kB
Release files / axiom_math-4.0.0.tar.gz
| Download URL | axiom_math-4.0.0.tar.gz |
|---|---|
| Size | 84.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4fa05dcc5bffe1af797e75f38ec71ca0f50acd60193dc65bc93b79479a246c4
|
|
BLAKE2b-256 checksum How to use checksums |
c947da9e16dd5e7a9528932507589d31d243d6486db2f2d486794ac2d5b0029c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / axiom_math-4.0.0-py3-none-any.whl
| Download URL | axiom_math-4.0.0-py3-none-any.whl |
|---|---|
| Size | 99.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22e2583b3fb689ebdd374fb1dd405c07f7ed258f20f181c22ea3795d09d3f4a6
|
|
BLAKE2b-256 checksum How to use checksums |
c57a0d6625de583a00a64e0ee47c27e3865478b041364455d9f90ca3ae0d1527
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for axiom-math 4.0.0
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.