Exact irrational constants — sqrt(2)**2 == 2, by construction.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mobius_constant-0.1.0.tar.gz.
File metadata
- Download URL: mobius_constant-0.1.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3f524179ab7466d037edccfc96555ac892bfaebfa42f6b41191b27c868aac20
|
|
| MD5 |
782b99848c519cb2491de0a55d4ccc95
|
|
| BLAKE2b-256 |
6cdace77af08476c34236d33c29036ad26ff97c5e32c66c5c26b7e3ae30e989d
|
File details
Details for the file mobius_constant-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mobius_constant-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97214c34850aa61e206365e3d220aa8b62273a3142fd9c1ebdbb8c9dc5578304
|
|
| MD5 |
b60d596e51af99cdd4028a028e49a2d3
|
|
| BLAKE2b-256 |
3e979c1b042c6dce9fbb646c0fc15519475b9da06ae298713d17854446031182
|