generate.py

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

2577 bytes, as of the version from 2026-10-29 19:37 (current). Recorded here, not run.

"""Growth rates of Löbell reflection groups -- numberdb.org/T612.

Run with SageMath (or a suitable passagemath installation):
    sage -pip install numberdb
    sage -python generate.py                 # verify every stored entry
    sage -python generate.py --fill          # write entries to the existing draft

For --fill, set NUMBERDB_API_KEY. This writes values, not publication status.
The default selection is every integer n from 5 through 30. n counts sides
of either base of the compact right-angled Löbell polyhedron; the generating
set is all its face reflections. See argument-selection.md for the bounds.

Kellerhals–Kolpakov, equation (4.3), with 2n+2 faces, gives the denominator
(1-t)(1-(2n-2)t+t^2). Its smallest positive zero has reciprocal
n-1+sqrt(n(n-2)). The square root is positive. Arb propagates its enclosure;
64 guard bits give 397 working bits for 100 digits. checks.py measures the
worst relative accuracy and independently brackets the root using rational
arithmetic and the finite-subgroup incidence counts.
"""
import os
import sys
import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.real_arb import RealBallField

WORKING_GUARD = 64


class LobellGrowth(numberdb.Generator):
    table = 'T612'
    parameters = ('n',)
    type = 'R'
    digits = 100
    rigour = 'proven'
    files = ('generate.py', 'checks.py', 'argument-selection.md',
             'numerical-evidence.md', 'skill-evidence.json')

    def enumerate(self, maximum=30):
        for n in range(5, int(maximum) + 1):
            yield {'n': n}

    def value(self, params, digits):
        n = ZZ(params['n'])
        if n < 5:
            raise ValueError('The compact Löbell family requires n >= 5')
        R = RealBallField(numberdb.bits(digits, losing=WORKING_GUARD))
        value = R(n - 1) + R(n * (n - 2)).sqrt()
        assert value.is_finite() and value > 1
        if n == 5:
            return {'number': value, 'comment':
                    r'The regular right-angled hyperbolic dodecahedron has $\tau_5=4+\sqrt{15}$.'}
        return value


if __name__ == '__main__':
    if os.environ.get('NUMBERDB_KEY_FROM_STDIN') == '1':
        numberdb.configure(api_key=sys.stdin.read().strip())
    generator = LobellGrowth()
    if '--fill' in sys.argv or os.environ.get('NUMBERDB_PUBLISH') == '1':
        print(generator.publish(message='Fill 26 Löbell growth rates with certified 100-digit enclosures'))
    else:
        report = generator.verify(sample=None)
        print(report)
        sys.exit(0 if report.ok else 1)