Skip to main content

Python bindings for ni-number — high-precision Ni constant

Project description

ni-number-py

PyPI - Python Version PyPI License: MIT

Python bindings for ni-number — high-precision computation of the Ni constant (η_ν), the quantum energy scattering constant.

η_ν = 1.88937666040491913115597775087642096081019761538215...

Powered by Rust under the hood — no Rust installation required.


What is the Ni Constant?

The Ni constant is defined by the series:

$$\eta_{\nu} = \sum_{n=1}^{\infty} \frac{\pi^n}{n! \cdot 2^{n^2}}$$

It represents the total amplitude of gauge-field attenuation at sub-Planckian distances, where interaction carriers leak into compactified extra dimensions (Calabi–Yau manifolds).

Author of the hypothesis: NiZaMinius


Installation

pip install ni-number-py

No system dependencies required. The package ships precompiled wheels for Windows, macOS, and Linux.


Usage

import ni_number_py

# Fast f64 constant — precomputed, instant (~15 digits)
print(ni_number_py.NI_F64)
# 1.8893766604049191

# Fast f32 constant (~7 digits)
print(ni_number_py.NI_F32)
# 1.8893767

# First 50 digits — static string, instant
print(ni_number_py.ni_50_digits())
# 1.88937666040491913115597775087642096081019761538215

# Arbitrary precision — returns a string with n digits after the decimal point
print(ni_number_py.ni_digits(100))
# 1.8893766604049191311559777508764209608101976153821588...

# Clear the internal cache (frees memory after high-precision computation)

ni_number_py.clear()
from decimal import Decimal
import ni_number_py

# Get 100 digits as string
ni_str = ni_number_py.ni_digits(100)

# Convert to Python's high-precision Decimal for math operations
ni_high_precision = Decimal(ni_str)

API

Function / Constant Returns Description
NI_F64 float Precomputed constant at double precision (~15 digits)
NI_F32 float Precomputed constant at single precision (~7 digits)
ni_50_digits() str First 50 decimal digits, static string
ni_digits(n) str Decimal string with n digits after the point, cached
clear() None Free cached values from memory

Performance

The series converges in fewer than 10 iterations for any practical precision level. Results are cached after the first call — subsequent calls at the same precision are instant.

Benchmarks measured on release build:

Digits First Computation (Cold Start) Subsequent Calls (Cached / Hot)
100 ~25 ms ~0.004 ms
1 000 ~1.5 s ~0.003 ms
5 000 ~85 s ~0.003 ms

Note: For computations beyond 1,000 digits with faster cold start times, use the compiled ni-number-py-fast version (powered by the GMP/Rug backend).


Related


License

MIT — see LICENSE.

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

ni_number_py-0.1.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

ni_number_py-0.1.1-cp312-cp312-win_amd64.whl (706.7 kB view details)

Uploaded CPython 3.12Windows x86-64

File details

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

File metadata

  • Download URL: ni_number_py-0.1.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for ni_number_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 47d8ce986f117e3758152bcef6eac4aeb9d26f73cd499e8e56f4dc8308a5c728
MD5 d9fad22594f02f9673ee1570733e6575
BLAKE2b-256 b6e927daa0854533c4a1b952500630c906d6943e225a525c5eccaa3e204d609b

See more details on using hashes here.

File details

Details for the file ni_number_py-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ni_number_py-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f76b0aaf9df8ea0ca568dc16629c77f9183d9e03dda0b17613da3ce1777753ea
MD5 24f26a69d5a3629f14a37511c70db006
BLAKE2b-256 a9817312d68dd80ae639ddd15edd0da1fcb70ab941cf5ca0828920cdaac8805a

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