back to table · edit · history · where entries came from · files · download
3605 bytes, as of the version from 2026-11-27 14:56 (current). Recorded here, not run.
"""T829: A-polynomials of knots.
Requirements: SageMath and numberdb (tested with SageMath 10.9, numberdb 0.1.10).
Run: sage -python generate.py # preview, no writes
sage -python generate.py --publish # fill the authorized target draft
Set NUMBERDB_TABLE to the permanent T-number for submission and configure a
NumberDB key and upload provenance in the session, never in this file.
Mathews, Theorem 1.1 AND its published erratum (2014), are evaluated exactly.
The negative-index branch uses (1-M^2)^i, as required by the erratum.
The knot is the Figure 1 diagram J(2,2n), not an unspecified Rolfsen hand.
No floating point arithmetic or precision truncation occurs. The default
selection is the complete signed prefix 1 <= |n| <= 4, distinct mirror hands,
and both invertible abelian-factor conventions. Variables are ordered L,M.
"""
import os
import re
from functools import lru_cache
import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.arith.misc import binomial
R=PolynomialRing(ZZ,names=('L','M'),order='lex')
L,M=R.gens()
F=R.fraction_field()
def normalize(value):
"""Primitive ordinary representative of a nonzero Laurent-unit class."""
f=F(value)
den=f.denominator()
if len(den.dict()) != 1:
raise ValueError('Non-Laurent denominator after exact cancellation')
p=f.numerator()
exps=list(p.dict())
a=min(e[0] for e in exps);b=min(e[1] for e in exps)
p=R({(e[0]-a,e[1]-b):c for e,c in p.dict().items()})
content=ZZ(0)
for c in p.coefficients(): content=content.gcd(c)
p=R(p/content)
return -p if p.leading_coefficient()<0 else p
@lru_cache(None)
def source_polynomial(n):
if not isinstance(n,int) or n==0:
raise ValueError('The supported twist family has nonzero integer n')
bound=2*n-1 if n>0 else -2*n
ratio=F(M**2-1 if n>0 else 1-M**2)/(L+M**2)
total=F(0)
for i in range(bound+1):
top=n+(i-1)//2 if n>0 else -n+i//2
total+=binomial(top,i)*ratio**i*(1-L)**(i//2)*(F(M**2)-L/F(M**2))**((i+1)//2)
return normalize(F(M)**(2*abs(n))*(L+M**2)**bound*total)
def mirrored(p):
return normalize(F(p)(L,F(1)/M))
def knot_index(knot):
match=re.fullmatch(r'J\(2,(-?\d+)\)',knot)
if match is None or int(match[1])%2 or int(match[1])==0:
raise ValueError('Expected J(2,2n), n nonzero')
return int(match[1])//2
class APolynomials(numberdb.Generator):
table=os.environ.get('NUMBERDB_TABLE','T829')
parameters=('knot','hand','form')
type='Z[]'
digits=100
rigour='exact'
def enumerate(self):
for a in range(1,5):
for n in (a,-a):
for hand in (('source',) if n==-1 else ('source','mirror')):
for form in ('nonabelian','with-abelian'):
yield {'knot':f'J(2,{2*n})','hand':hand,'form':form}
def value(self,params,digits):
n=knot_index(params['knot']);p=source_polynomial(n)
if params['hand']=='mirror':p=mirrored(p)
elif params['hand']!='source':raise ValueError('Unknown hand')
if params['form']=='with-abelian':p=normalize((L-1)*p)
elif params['form']!='nonabelian':raise ValueError('Unknown form')
return p
if __name__=='__main__':
import sys
if os.environ.get('NUMBERDB_KEY_FROM_STDIN')=='1':
os.environ['NUMBERDB_API_KEY']=sys.stdin.read().strip()
g=APolynomials()
if '--publish' in sys.argv:g.publish()
else:g.preview()