back to table · edit · history · where entries came from · files · download
3840 bytes, as of the version from 2026-11-18 08:37 (current). Recorded here, not run.
"""Generator for T748: logarithmic Mahler measure of the BCC Laurent pencil.
Dependencies: SageMath (tested 10.9) and numberdb (tested 0.1.10).
sage -pip install numberdb
sage -python generate.py # verify all stored entries
sage -python generate.py --publish # explicitly submit entries to own draft
Only k is free, real k>=8; default enumeration is exact integers 8,...,32.
All logarithms are natural and Haar measure has total mass one.
For k>8, angular moments give a positive central-binomial series, with a
geometric tail. At k=8 a rapidly convergent Taylor series in the elliptic
parameter alpha=(1-sqrt(1-64/k^2))/2 is used instead. Both branches use Arb
balls with explicit omitted-tail bounds. No empirical quadrature error is
used for certification. See numerical-evidence.md for the tail proof and
independent check program; argument-selection.md explains the finite range.
The working field has ceil(digits*log2(10))+96 bits. Tail targets are 2^(-p+24).
The code checks finite balls and retained accuracy before returning them.
"""
import os
import sys
from functools import lru_cache
from math import comb
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RealBallField
@lru_cache(maxsize=None)
def elliptic_coefficients(count):
"""Coefficients d_n of (2K(u)/pi)^2, exactly as dyadic rationals."""
b = [comb(2*j, j)**2 for j in range(count+1)]
return tuple(QQ(sum(b[j]*b[n-j] for j in range(n+1))) / (16**n)
for n in range(count+1))
def endpoint_value(digits):
p = numberdb.bits(digits, losing=96)
R = RealBallField(p)
# At alpha=1/2, bound <= (N+3)*2^(-N) for the integrated tail.
N = p + 32
ds = elliptic_coefficients(N)
cumulative = QQ(0)
integral = R(0)
power = R(1)
for n in range(1, N+1):
power *= R(QQ(1)/2)
integral += R((ds[n]-cumulative)/(2*n))*power
cumulative += ds[n]
tail = R(N+3) * R(2)**(-N)
result = (R(8).log()-integral).add_error(tail)
assert result.is_finite() and result.accuracy() >= numberdb.bits(digits)+16
return result
def exterior_value(k, digits):
p = numberdb.bits(digits, losing=96)
R = RealBallField(p)
k = QQ(k)
if k <= 8:
raise ValueError('The exterior series requires k>8.')
x = R(QQ(64)/(k*k))
term = R(1)
total = R(0)
power = R(1)
target = R(2)**(-p+24)
n = 0
while True:
n += 1
term *= x * R(QQ(2*n-1)/(2*n))**3
total += term/(2*n)
power *= x
tail = power*x / (2*(n+1)*(1-x))
if tail < target:
break
if n > 1000000:
raise ArithmeticError('Choose the elliptic method closer to k=8.')
result = (R(k).log()-total).add_error(tail)
assert result.is_finite() and result.accuracy() >= numberdb.bits(digits)+16
return result
class BCCMahler(numberdb.Generator):
table = os.environ.get('NUMBERDB_TABLE', 'T748')
parameters = ('k',)
type = 'R'
digits = 100
rigour = 'proven'
def enumerate(self, maximum=32):
for k in range(8, maximum+1):
yield {'k': k}
def value(self, params, digits):
k = QQ(params['k'])
if k < 8:
raise ValueError('This table has real domain k>=8.')
return endpoint_value(digits) if k == 8 else exterior_value(k, digits)
if __name__ == '__main__':
if os.environ.get('NUMBERDB_KEY_FROM_STDIN') == '1':
key = sys.stdin.read().strip()
if '=' in key:
key = key.split('=',1)[1].strip().strip('\"\'')
numberdb.configure(api_key=key)
g = BCCMahler()
if '--publish' in sys.argv or os.environ.get('NUMBERDB_PUBLISH') == '1':
print(g.publish(removing=False))
else:
print(g.verify(sample=None))