mobius-constant
Exact irrational constants — sqrt(2)**2 == 2, by construction.
>>> from mobius_constant import Sqrt2, Pi, Phi
>>> Sqrt2 ** 2 == 2
True
>>> Pi + Pi == Pi * 2
True
>>> Phi ** 2 == Phi + 1
True
IEEE 754 gets all three wrong. MöbiusConstant gets them right.
The Problem
import math
math.sqrt(2) ** 2 == 2 # False → 2.0000000000000004
math.sqrt(3) ** 2 == 3 # False
phi = (1 + math.sqrt(5)) / 2
phi ** 2 == phi + 1 # False → violates defining identity
Forty-one years of IEEE 754 and irrational constants still can't satisfy their own identities.
The Fix
Every constant is stored as two strands:
| Strand | Role | Example (√2) |
|---|---|---|
| Binary | float64 — hardware-fast |
1.4142135623730951 |
| Truth | Verified digit string — 100 digits, no loss | 1.41421356237309504880168872420969807856... |
The float gives you speed. The digits give you truth. Comparison uses truth.
The digits are pre-verified, not computed on demand:
- π and α cross-check via the SECS equation: α⁻¹ + S·α = 4π³ + π² + π
- √2, √3, φ are verified by their minimal polynomials
- e is verified by Taylor series convergence
- Round-trip π → α → π recovers all 100 digits exactly
Install
pip install mobius-constant
Pure Python. One dependency: mpmath (for non-integer exponentiation only).
Constants
| Constant | Symbol | Value | Identity |
|---|---|---|---|
Pi |
π | 3.14159265... | Cross-checked via α |
Euler |
e | 2.71828182... | Taylor convergence |
Sqrt2 |
√2 | 1.41421356... | x² − 2 = 0 |
Sqrt3 |
√3 | 1.73205080... | x² − 3 = 0 |
Phi |
φ | 1.61803398... | x² − x − 1 = 0 |
Ln2 |
ln 2 | 0.69314718... | — |
Alpha_inv |
α⁻¹ | 137.035999... | SECS equation |
Alpha |
α | 0.00729735... | 1/α⁻¹ |
Compute Your Own
from mobius_constant import MC, sqrt
# Any square root, exact to 100 digits
s5 = sqrt(MC(5))
assert s5 ** 2 == 5
# Arithmetic propagates both strands
x = MC("1.41421356237309504880168872420969807856967187537694")
y = x * x # truth strand: exact multiplication of all digits
The α ↔ π Relationship
The fine-structure constant α and π are not circularly defined. Both are independently real:
- π — computable by Chudnovsky, Machin, BBP, dozens of algorithms
- α — measurable from electron g-2, cesium recoil, rubidium recoil
The equation α⁻¹ + S·α = 4π³ + π² + π is the auditor, not the definition. It validates that the digits of both constants are correct. If the round-trip fails at digit N, either your π or your α is wrong — the equation tells you where.
See Also
- mobius-number — Complementary residue arithmetic for rationals (
0.1 + 0.2 == 0.3) - mobius-integer — Möbius function and Dirichlet series in Rust
License
MIT — Jay Carpenter, 2026
Metadata
Release files for mobius-constant 0.1.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 |
|---|---|---|---|---|
| mobius_constant-0.1.0.tar.gz | 11.2 kB | Without provenance | Details for mobius_constant-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mobius_constant-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mobius_constant-0.1.0-py3-none-any.whl |
Total release size: 21.3 kB
Release files / mobius_constant-0.1.0.tar.gz
| Download URL | mobius_constant-0.1.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3f524179ab7466d037edccfc96555ac892bfaebfa42f6b41191b27c868aac20
|
|
BLAKE2b-256 checksum How to use checksums |
6cdace77af08476c34236d33c29036ad26ff97c5e32c66c5c26b7e3ae30e989d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / mobius_constant-0.1.0-py3-none-any.whl
| Download URL | mobius_constant-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97214c34850aa61e206365e3d220aa8b62273a3142fd9c1ebdbb8c9dc5578304
|
|
BLAKE2b-256 checksum How to use checksums |
3e979c1b042c6dce9fbb646c0fc15519475b9da06ae298713d17854446031182
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for mobius-constant 0.1.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.