moment_series.py

back to table · edit · history · where entries came from · files · download

1204 bytes, as of the version from 2026-11-18 20:02 (current). Recorded here, not run.

"""Rigorous completed-product moment coefficients, Suzuki (1.15).

This helper computes fresh inputs; it reads no other NumberDB table.
The zeta pole at s=1 is removed analytically before series multiplication.
"""
from math import factorial
import numberdb.sage as numberdb
from sage.rings.complex_arb import ComplexBallField
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.rational_field import QQ

def moment_balls_at(bits, nmax):
    C=ComplexBallField(bits);P=PolynomialRing(C,'u');u=P.gen();s=1+u
    length=nmax+2
    pole_removed=1+u*s._zeta_series(length,deflate=True)
    gamma=(s*QQ(1)/2)._gamma_series(length)
    pi_factor=(-s*C.pi().log()/2)._exp_series(length)
    xi=(s*pole_removed*gamma*pi_factor/2).truncate(length)
    h=xi._log_series(length)
    sigma=[(-1)**k*(k+1)*h[k+1] for k in range(nmax+1)]
    mu=[]
    for n in range(nmax+1):
        z=factorial(n)*sum(((n-k+1)*2**(n-k)*sigma[k] for k in range(n+1)),C(0))
        if not(z.real().is_finite() and z.imag().is_finite() and z.imag().contains_zero()):
            raise ArithmeticError('Moment coefficient is not finite and real')
        mu.append(z.real())
    return tuple(mu)