back to table · edit · history · where entries came from · files · download
2518 bytes, as of the version from 2026-10-25 10:54 (current). Recorded here, not run.
"""Check the size-conversion repair for numberdb.org/T483.
Run with SageMath and the downloaded generate.py alongside this file:
sage -pip install numberdb
sage -python repair_checks.py
For the private draft, set NUMBERDB_API_KEY, or pipe its key on stdin with
NUMBERDB_KEY_FROM_STDIN=1. This script performs no writes. The polynomial
identities prove the conversions from Euler's formula V-E+F=2 and the face
incidence equation dF=2E, including repeated edge incidences. The respective
linear systems have nonzero determinant, so these solutions are unique.
"""
import json
import os
import sys
import importlib.metadata
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.real_arb import RealBallField
from generate import PlanarMapGrowth
if os.environ.get('NUMBERDB_KEY_FROM_STDIN') == '1':
numberdb.configure(api_key=sys.stdin.read().strip())
R=PolynomialRing(QQ,'v,f'); v,f=R.gens()
Et,Ft=3*v-6,2*v-4
Eq,Vq=2*f,f+2
assert v-Et+Ft == 2 and 3*Ft == 2*Et
assert Vq-Eq+f == 2 and 4*f == 2*Eq
assert (-1)*3-1*(-2) == -1
assert 1*(-2)-(-1)*0 == -2
# Known controls: tetrahedron and cube.
assert (int(Et(4,0)),int(Ft(4,0))) == (6,4)
assert (int(Eq(0,6)),int(Vq(0,6))) == (12,8)
doc=numberdb.table('T483')
assert len(doc['Numbers']) == 11
assert all(len(by_size)==1 for by_size in doc['Numbers'].values())
assert doc['Display properties']['number-header'] == r'$\gamma$'
# Independent exact enclosure check, rather than testing a rounded midpoint.
s=doc['Numbers']['triangulations-I']['vertices']['unlabelled']['number']
whole,frac=s.split('.')
scale=QQ(10)**len(frac)
center=QQ(whole+frac)/scale
ulp=1/scale
assert center-ulp>0
assert (center-ulp)**2 < 432 < (center+ulp)**2
B=RealBallField(numberdb.bits(100,losing=64))
value=12*B(3).sqrt()
assert value.is_finite()
assert B(value.rad()) < B(QQ(1)/10**115)
assert value > B(center-ulp) and value < B(center+ulp)
report=PlanarMapGrowth().verify(sample=None)
assert report.ok, str(report)
print(json.dumps({
'table':'T483',
'symbolic_size_identities':'Euler and face-incidence equations hold identically; unique solutions',
'controls':['tetrahedron: V=4,E=6,F=4','cube: V=8,E=12,F=6'],
'each_class_has_one_size':True,
'type_I_stored_interval_brackets_positive_sqrt_432':True,
'type_I_arb_radius':str(value.rad()),
'generator_verification':str(report),
'python':sys.version.split()[0],
'numberdb':numberdb.__version__,
},indent=2))