mathxlab.nt.zeta¶
Riemann zeta function and related numerical helpers.
Stability
Status: Experimental.
This project treats the documented names as the public surface, but details may still evolve.
If you need strict API guarantees, add __all__ = [...] to each module and version releases accordingly.
Design notes¶
Functions are designed for experiment-scale inputs (not cryptographic workloads).
Prefer explicit parameters (e.g.,
n_max) for reproducibility.
Examples¶
Approximate ζ(2) via a partial series¶
from mathxlab.nt.zeta import zeta_series_partial
print(zeta_series_partial(2, 10_000))
Public API¶
Name |
Kind |
Summary |
|---|---|---|
|
class |
Settings for zeta-related numerical evaluations. |
|
function |
Temporarily set the mpmath precision (decimal digits). |
|
function |
Compute the partial Dirichlet series for the Riemann zeta function. |
|
function |
Compute the partial Dirichlet eta series. |
|
function |
Recover zeta(s) from eta(s) via the identity. |
|
function |
Compute a partial Euler product approximation of zeta(s). |
|
function |
Compute the factor chi(s) in the functional equation of zeta. |
|
function |
Compute Hardy’s Z-function at height t. |
|
function |
Return the Riemann–von Mangoldt main term for N(T). |
Reference¶
Classes¶
Functions¶
- mathxlab.nt.zeta.mp_workdps(dps)[source]¶
Temporarily set the mpmath precision (decimal digits).
- Parameters:
dps – Decimal digits of precision.
- Yields:
None. The previous precision is restored on exit.
Examples
>>> from mathxlab.nt.zeta import mp_workdps >>> mp_workdps
- mathxlab.nt.zeta.zeta_series_partial(s, n_max, *, settings=None)[source]¶
Compute the partial Dirichlet series for the Riemann zeta function.
- This computes:
sum_{n=1..n_max} n^{-s}
- Parameters:
s – Complex exponent.
n_max – Number of terms.
settings – Optional evaluation settings.
- Returns:
Complex partial sum as a Python complex number.
Examples
>>> from mathxlab.nt.zeta import zeta_series_partial >>> round(zeta_series_partial(2.0, 2000).real, 3) 1.644
- mathxlab.nt.zeta.eta_series_partial(s, n_max, *, settings=None)[source]¶
Compute the partial Dirichlet eta series.
- This computes:
eta(s) = sum_{n=1..n_max} (-1)^{n-1} n^{-s}
- Parameters:
s – Complex exponent.
n_max – Number of terms.
settings – Optional evaluation settings.
- Returns:
Complex partial sum as a Python complex number.
Examples
>>> from mathxlab.nt.zeta import eta_series_partial >>> eta_series_partial
- mathxlab.nt.zeta.zeta_via_eta(s, eta_value)[source]¶
Recover zeta(s) from eta(s) via the identity.
- For s != 1:
zeta(s) = eta(s) / (1 - 2^{1-s})
- Parameters:
s – Complex argument.
eta_value – Value of eta(s) (possibly a partial sum).
- Returns:
Complex approximation of zeta(s).
Examples
>>> from mathxlab.nt.zeta import zeta_via_eta >>> zeta_via_eta
- mathxlab.nt.zeta.euler_product_partial(s, primes, *, settings=None)[source]¶
Compute a partial Euler product approximation of zeta(s).
- This computes:
prod_{p in primes} (1 - p^{-s})^{-1}
- Parameters:
s – Complex argument.
primes – Iterable of prime numbers.
settings – Optional evaluation settings.
- Returns:
Complex approximation as a Python complex.
Examples
>>> from mathxlab.nt.zeta import euler_product_partial >>> euler_product_partial
- mathxlab.nt.zeta.chi_factor(s, *, settings=None)[source]¶
Compute the factor chi(s) in the functional equation of zeta.
- One convenient form is:
zeta(s) = chi(s) * zeta(1 - s)
- where:
chi(s) = 2^s * pi^{s-1} * sin(pi s / 2) * Gamma(1 - s)
- Parameters:
s – Complex argument.
settings – Optional evaluation settings.
- Returns:
chi(s) as a Python complex.
Examples
>>> from mathxlab.nt.zeta import chi_factor >>> chi_factor