import mpmath as mp
def density(s):
# A value assigned at an isolated integrable singularity changes no integral.
if s == 0:
return mp.mpf(0)
return 1 / (4 * mp.pi * mp.agm(1, abs(s) / 4))
def compute(k, working):
"""Ordinary logarithmic measure for a finite real coefficient k."""
with mp.workdps(working):
k = abs(mp.mpf(k))
if not mp.isfinite(k):
raise ValueError('A finite real coefficient is required.')
total = mp.mpf(0)
pieces = [(-mp.mpf(4), min(mp.mpf(4), k - 2), 1),
(max(-mp.mpf(4), k + 2), mp.mpf(4), -1)]
for left, right, sign in pieces:
if left >= right:
continue
edges = [left] + ([mp.mpf(0)] if left < 0 < right else []) + [right]
def integrand(s):
t = sign * (k - s) - 2
# acosh(1+t/2)=2asinh(sqrt(t)/2), stable at t=0.
return density(s) * 2 * mp.asinh(mp.sqrt(max(0, t)) / 2)
value, error = mp.quad(integrand, edges, error=True, maxdegree=10)
if not mp.isfinite(value) or error > mp.power(10, -working + 20):
raise ArithmeticError('Quadrature convergence estimate failed.')
total += value
return mp.nstr(total, working)
low = compute(7, 150)
high = compute(7, 210)
with mp.workdps(220):
assert abs(mp.mpf(low)-mp.mpf(high)) < mp.mpf('1e-125')
print(mp.nstr(mp.mpf(high), 100))
# Agreement checks are not certified bounds.
The generator evaluates the ordinary Jensen integral (1) by tanh-sinh quadrature at 150 and 210 working decimal digits, splitting at every logarithmic or square-root endpoint. The elliptic density is evaluated using the arithmetic-geometric mean to avoid subtractive loss near its singularity. All 14 entries agree to at least 149.66 digits relative to the larger of one and the value magnitude; 100 significant digits are retained. Quadrature estimates and precision agreement are numerical evidence, not certified error bounds.
An independent implementation evaluates the eta parametrization and divisor-sum expansion of [2], Theorem 1.1, at 140 working digits. It uses the six exact CM parameters of [1], Section 2.3, and solves the eta equation at the other arguments, recording the parameter residual and an explicit series-tail bound. It agrees with the quadrature to at least 139.58 digits on the same scale at every selected argument. The series-tail bound does not certify the numerical root solving or the full computation.
Independent controls give the density mass $1$ and second moment $4$, Smyth's value from Hurwitz zeta functions, and rejection of a deliberately perturbed value. Exact closed-walk coefficients and an explicit exterior tail bound reproduce every selected $k>6$ to at least 139.42 digits. The endpoint derivative agrees with Watson's gamma product to over 140 digits. The arithmetic relation (4), generator verification, and comparisons with the independent modular values are also checked on the stored decimal intervals. The attached checks and numerical evidence record the methods, software versions and measured errors.