import numberdb.sage as numberdb
from math import factorial
from sage.rings.complex_arb import ComplexBallField
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
import sage.rings.polynomial.laurent_polynomial_ring
from sage.matrix.constructor import matrix
def D(n, bits=1024):
if n < 0:
raise ValueError("n must be nonnegative")
C = ComplexBallField(bits)
P = PolynomialRing(C, 'u')
u = P.gen()
s = 1 + u
length = 2*n + 2
z = 1 + u*s._zeta_series(length, deflate=True)
h = (s*z*(s/2)._gamma_series(length)
*(-s*C.pi().log()/2)._exp_series(length)/2)._log_series(length)
mu = [factorial(k)*sum(((k-j+1)*2**(k-j)*(-1)**j*(j+1)*h[j+1]
for j in range(k+1)), C(0)) for k in range(2*n+1)]
value = matrix(C, n+1, n+1, lambda i,j: mu[i+j]).det()
assert value.real().is_finite() and value.imag().contains_zero()
return value.real()
D(20) # Increase bits if more precision is needed at larger orders.
The generator recomputes all 41 moment inputs through order 40 using the pole-removed completed product and native Arb/FLINT Taylor series, then evaluates the unscaled matrices with the native complex-ball determinant. Working precision is 1024 bits; every determinant retains at least 833 relative-accuracy bits before conversion to 100 significant decimal digits, with one last-place unit of uncertainty. [3]
A separate implementation recomputes the moments by the theta integral [2], equations 25.5.13–14, and the Li-coordinate transform in [1], equation (8.3). Both omitted theta summands and the infinite integration tail have explicit bounds. At 1152 bits, a separately implemented Bareiss determinant with factorial row and column scaling, reversed exactly, retains at least 843 relative bits. All 21 independent enclosures lie strictly inside the stored decimal intervals. Nonzero quadrature, initial-moment, factorial-moment and signed-measure controls pass; wrong sign, factor, size, offset, normalization, omitted rescaling, NaN and wide-ball controls are rejected. The two routes share completed-xi theory and Arb/FLINT arithmetic. Executable checks, analytic bounds and checkpoints are attached.