#!/usr/bin/env python3 """Exact arithmetic and real-phase certificates for beta(4) through beta(32). The mathematical denominator improvement and asymptotic passage are proved in the accompanying manuscript. This script certifies the finite inputs. """ from fractions import Fraction as Q from itertools import combinations import hashlib import json import math from pathlib import Path import time HERE=Path(__file__).resolve().parent DS=[Q(j,96) for j in range(31)] R=Q(3,4);G=Q(221,16);X=400;COMMON=96;BITS=64 def events(): offsets=set([(d,Q(0)) for d in DS]+[(1-d,Q(0)) for d in DS] +[(-R,Q(-1,2)),(1+R,Q(-1,2))]) out={Q(k) for k in range(1,X+1)} for (s,t),(ss,tt) in combinations(sorted(offsets),2): ds,dt=ss-s,t-tt if not ds:continue for k in range(math.floor(ds-dt)-1,math.ceil(X*ds-dt)+2): z=(dt+k)/ds if 1cap:break current+=jump;maximum=max(maximum,current) return Q(max(0,maximum+2))-G*(a//b) def log_bounds(x,terms=40): x=Q(x);assert x>0;k=0 while x<1:x*=2;k-=1 while x>2:x/=2;k+=1 def basic(y): z=(y-1)/(y+1) lo=2*sum((z**(2*j+1)/Q(2*j+1) for j in range(terms)),Q(0)) return lo,lo+2*z**(2*terms+1)/(Q(2*terms+1)*(1-z*z)) lo,hi=basic(x);ll,hh=basic(Q(2)) return (lo+k*ll,hi+k*hh) if k>=0 else (lo+k*hh,hi+k*ll) def linear_logs(terms): low=high=Q(0) for c,x in terms: a,b=log_bounds(x) low+=c*(a if c>=0 else b);high+=c*(b if c>=0 else a) return low,high def outward(a,b): scale=10**20 return [str(Q((a*scale).numerator//(a*scale).denominator,scale)), str(Q(-((-b*scale).numerator//(-b*scale).denominator),scale))] def phase_certificate(): cut=[R,Q(31,40),Q(4,5),Q(17,20)];curvature=[] for a,b in zip(cut,cut[1:]): bound=3/(a+1+R)-3/(b-R)-sum(1/(b+1-d)-1/(a+d) for d in DS) assert bound<0;curvature.append(str(bound)) x=Q(7573,10000) value=[(3*(x+1+R),x+1+R),(-3*(x-R),x-R)] slope=[(Q(3),x+1+R),(Q(-3),x-R)] for d in DS: value.extend([(-(x+1-d),x+1-d),(x+d,x+d)]) slope.extend([(Q(-1),x+1-d),(Q(1),x+d)]) vl,vh=linear_logs(value);sl,sh=linear_logs(slope) assert vhQ(-1,50) and sh=0. Thus g has no # interior minimum there; g(17/20)>0 and g(infinity)=0 imply g>0. assert 6*(1+2*R)-gamma<0 a=Q(17,20) gl,gh=linear_logs([(Q(-3),(a+1+R)/(a-R))]);gl+=gamma/(a+1);gh+=gamma/(a+1) assert gl>0 tail_slope=3*(1+2*R)*3/(3-R)-gamma*3/4 assert tail_slope<-3 ql,qh=linear_logs([(Q(15),Q(2))]);ql+=V+Q(41,5);qh+=V+Q(41,5) assert qh