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 E(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 + 3
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+2)]
value = matrix(C, n+1, n+1, lambda i,j: mu[i+j+1]).det()
assert value.real().is_finite() and value.imag().is_finite()
assert value.imag().contains_zero()
return value.real()
E(20) # Increase bits if more precision is needed at larger orders.
All 42 moment inputs through order 41 are recomputed from the pole-removed completed product using native Arb/FLINT Taylor series. The unscaled matrices are evaluated by the native complex-ball determinant. Working precision is 1024 bits; every determinant retains at least 830 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 bounded theta integral [2], equations 25.5.13–14, and the Li-coordinate transform [1], equation (8.3). Both omitted theta summands and the infinite integration tail have explicit bounds. At 1152 bits, a separately implemented Bareiss determinant uses factorial row and column scaling, reversed exactly. Every independent enclosure is checked strictly inside the corresponding stored decimal interval. Nonzero quadrature, initial-moment, factorial-moment and signed-measure controls pass. Wrong sign, factor, matrix size, offset, normalization, omitted rescaling, NaN and wide-ball controls are rejected. The methods share completed-xi theory and Arb/FLINT arithmetic. Executable checks, analytic bounds and checkpoints are attached.