back to table · edit · history · where entries came from · files · download
3024 bytes, as of the version from 2026-11-18 12:06. Recorded here, not run.
"""T751: resistance of the three nearest-neighbour cubic Bravais networks.
Install numberdb in full SageMath or modular passagemath with matrix and Arb
support. Keep derive.py beside this file. Run:
sage -python generate.py # preview, no write
sage -python generate.py --verify # all stored entries, no write
sage -python generate.py --publish # fill the assigned draft only
Set NUMBERDB_API_KEY privately for draft access; supply engine/model/run in the
session environment. No credential or agent attribution is embedded here.
The parameter order is (lattice,l,m,n). All graph-distance <=6 nonzero signed
permutation orbits are selected: 22 SC, 29 BCC, 36 FCC. Exact Fourier identities
and primary-source seed formulas determine rational Green coefficients; see
method.md and derive.py. Arb encloses gamma products and propagates cancellation
at bits(digits,losing=256). The three adjacent resistances are exact rationals.
"""
import os,sys
from functools import lru_cache
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RealBallField
from derive import derive,valid,dist,canon
@lru_cache(None)
def coefficients(L):
return {tuple(map(int,k.split(','))):tuple(map(QQ,v)) for k,v in derive(L).items()}
@lru_cache(None)
def origin(L,digits):
R=RealBallField(numberdb.bits(digits,losing=256));pi=R.pi()
if L=='sc':h=(R(3).sqrt()-1)*R(QQ(1)/24).gamma()**2*R(QQ(11)/24).gamma()**2/(96*pi**3)
elif L=='bcc':h=R(QQ(1)/4).gamma()**4/(4*pi**3)
elif L=='fcc':h=3*R(QQ(1)/3).gamma()**6/(R(2)**(QQ(14)/3)*pi**4)
else:raise ValueError('lattice must be sc, bcc or fcc')
assert h.is_finite() and h>0
return h
class CubicResistance(numberdb.Generator):
table='T751'
files=('generate.py','derive.py','method.md','argument-selection.md')
parameters=('lattice','l','m','n')
type='R'
digits=100
rigour='proven'
def enumerate(self):
rows=[]
for L in ['sc','bcc','fcc']:
for l in range(1,7):
for m in range(l+1):
for n in range(m+1):
t=(l,m,n)
if valid(L,t) and dist(L,t)<=6:rows.append((dist(L,t),['sc','bcc','fcc'].index(L),t,L))
for _,_,(l,m,n),L in sorted(rows):yield dict(lattice=L,l=l,m=m,n=n)
def value(self,params,digits):
L=str(params['lattice']);t=tuple(int(params[k]) for k in ('l','m','n'))
if L not in ('sc','bcc','fcc') or t!=canon(t) or not t[0] or not valid(L,t):raise ValueError('Invalid lattice vertex representative')
a,b,c=coefficients(L)[t];factor={'sc':1,'bcc':4,'fcc':2}[L]
if a==1 and b==0:return -c/factor
h=origin(L,digits);v=((1-a)*h-b/(h.parent().pi()**2*h)-c)/factor
assert v.is_finite() and v>0 and v.rad().exact_rational()<QQ(10)**(-digits-20)
return v
if __name__=='__main__':
if os.environ.get('NUMBERDB_KEY_FROM_STDIN')=='1':numberdb.configure(api_key=sys.stdin.read().strip())
g=CubicResistance()
if '--publish' in sys.argv or os.environ.get('NUMBERDB_PUBLISH')=='1':g.publish()
elif '--verify' in sys.argv:g.verify(sample=None)
else:g.preview()