back to table · edit · history · where entries came from · files · download
4433 bytes, as of the version from 2026-11-18 04:29 (current). Recorded here, not run.
"""Independent checks for T742; run with entries.json and generate.py beside it.
sage -python independent_check.py
Prints RESULTS JSON. The elliptic derivative is integrated from p(0)=0;
no primary Jensen numerator or stored sibling table produces these values.
The source's positive-root Jensen formulation differentiates to
p'(k)=1/(4*pi)*int_a^min(b,1) dc/sqrt((c-a)(b-c)(1-c)).
A sine-squared substitution evaluates the inner integral as K(m). Carlson
RF implements K through the complementary parameter, avoiding cancellation
near k=3. The outer logarithmic singularity is split at k=3. This is an
independent integral representation, sharing mpmath and source normalization;
it is a numerical check and not a certified quadrature bound.
"""
import numberdb.sage as numberdb
from sage.arith.misc import kronecker_symbol
from mpmath import mp
import json,math,time
from pathlib import Path
def deriv(k,distance=None,side=None):
a=((mp.sqrt(k*k+16)-k)/8)**2
gap=k*mp.sqrt(k*k+16)/16
if k<3 or side=='below':
d=3-k if distance is None else distance
comp=d*(6-d)/(16*(1-a)**2)
return mp.elliprf(0,comp,1)/(2*mp.pi*mp.sqrt(1-a))
d=k-3 if distance is None else distance
comp=d*(6+d)/(16*(1-a)*gap)
return mp.elliprf(0,comp,1)/(2*mp.pi*mp.sqrt(gap))
def p3_integral():
return mp.quad(lambda u:deriv(3-u,u,'below'),[0,1,2,3])
def alternate(n,p3):
k=mp.sqrt(n)
if n==0:return mp.mpf(0)
if n<9:return mp.quad(deriv,[0,k/2,k])
if n==9:return p3
return p3+mp.quad(lambda u:deriv(3+u,u,'above'),[0,(k-3)/2,k-3])
def interval_contains(record,value):
text=str(record['number'])
if '.' not in text and 'e' not in text.lower():
return value==mp.mpf(text)
center=mp.mpf(text)
mantissa,*exponent=text.lower().split('e')
exp=int(exponent[0]) if exponent else 0
places=len(mantissa.split('.')[1]) if '.' in mantissa else 0
radius=mp.power(10,exp-places)
return mp.isfinite(value) and abs(value-center)<=radius
def run(entries):
with mp.workdps(135):
t=time.time();p3=p3_integral()
chars=[int(kronecker_symbol(-15,a)) for a in range(1,16)]
L2=sum(chars[a-1]*mp.zeta(2,mp.mpf(a)/15) for a in range(1,16))/225
known=5*mp.sqrt(15)*L2/(8*mp.pi)
known_ok=abs(p3-known)<mp.mpf('1e-120')
failures=[];details=[]
for record in entries:
text=str(record['params']['k']);n=int(text[5:-1]) if text.startswith('sqrt(') else int(text)**2
value=alternate(n,p3)
ok=interval_contains(record,value)
if not ok:failures.append({'k':text,'reason':'elliptic derivative integral outside claimed interval'})
details.append({'k':text,'independent':mp.nstr(value,125),'inside_stored':bool(ok),'absolute_error':mp.nstr(abs(value-mp.mpf(record['number'])),8)})
wrong=dict(entries[1]);wrong['number']=mp.nstr(mp.mpf(wrong['number'])+mp.mpf('1e-90'),100)
negative=not interval_contains(wrong,alternate(1,p3))
# Symbolic coefficient checks are independent of numerical quadrature.
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.rational_field import QQ
ring=PolynomialRing(QQ,names=('x','y','k'));x,y,k=ring.gens()
A=x*x+x+1
P=A*y*y+k*x*(x+1)*y+x*A
parity=P(x,y,-k)==P(x,-y,k)
zero=P(x,y,0)==A*(y*y+x)
elliptic_disc=16*(-16*(k*k-9))**2*((k*k-24)**2+64*(k*k-9))
disc_fact=elliptic_disc.factor()
if not (parity and zero):failures.append({'reason':'polynomial identity'})
return {'table':'T742','checked_entries':len(entries),'total_entries':37,'failures':failures,
'known_answer_control':bool(known_ok),'negative_control_rejected':bool(negative),
'zero_control':bool(interval_contains(entries[0],mp.mpf(0))),
'p3_L2_control':{'integral':mp.nstr(p3,125),'character_formula':mp.nstr(known,125),'difference':mp.nstr(abs(p3-known),8),'character':chars},
'polynomial_checks':{'parity':bool(parity),'zero_factorization':bool(zero),'elliptic_discriminant':str(disc_fact)},
'working_decimal_digits':135,'seconds':time.time()-t,'comparisons':details}
if __name__=='__main__':
entries=json.loads(Path(__file__).with_name('entries.json').read_text())
print('RESULTS '+json.dumps(run(entries)),flush=True)