"""Enclose the largest-jump Cauchy weights and isolated interior support gaps.""" import argparse from fractions import Fraction as F from math import factorial from pathlib import Path from mpmath import iv import spatial23_verify as sp import separate_groups21 as previous from window_ballot21 import exact from goldbach_spline23 import rational_spectrum I=iv.mpf lam=exact(sp.LAM) CUTS=[F(12,100),F(25,100),F(45,100),F(65,100),F(82,100),F(1)] def extra_gap(rho,q,cells=80): if rho>=F(1,2): return I(0) dv=(F(1,2)-rho)/cells total=I(0) for j in range(cells): lo=rho+j*dv hi=lo+dv vl,vh=exact(lo).a,exact(hi).b left=(1-exact(rho)/vl).a if left<=0 or hi==F(1,2):continue positional=2*(vh-exact(rho))**2/((lam+2)*(lam+3)) dw=(1-2*hi)/cells subtotal=I(0) for k in range(cells): wl=exact(hi+k*dw).a;wh=exact(hi+(k+1)*dw).b al,ah=vl+wl,vh+wh if ah.b>=1:continue survival=1-ah**lam # (1-a)/(1-a^lambda) <= 1, since lambda >= 1. second=lam*max(I(0),((1+ah)/2+lam*(1-al)-2*wl).b)+wh**2 weight=1/sp.cosh(q*iv.sqrt(positional+second)) subtotal+=((vl/ah)**lam*survival*weight/wh).a total+=(exact(dw)*left**(1+lam)*subtotal).a norm=2*lam*iv.exp(-lam*I('.577216'))/((1+lam)*iv.gamma(lam)) return (norm*exact(dv)*total).a def geometric(rho,q,ib,H,weights,interior): previous.density_checks() d1=max(F(1),(F(1,2)-H/2)*ib);d2=max(F(1),ib/2) p0=(previous.omega(d1)*previous.omega(d2)+previous.signed(d1)*previous.signed(d2))/2 result=I(0) for j,(a,t) in enumerate(zip(CUTS,weights)): coeff=1/t-(1/weights[j+1] if j0 result+=(exact(coeff)*ca).b print('max<=',a,'geometric square upper',ca,'additional gap',g2,flush=True) return result.b def spectral_weight(q,B,weights): pieces=[] for a,t0,t1 in zip(CUTS,weights,weights[1:]): diff=t1-t0 if not diff:continue ar=exact(a) log=iv.log(1/ar) jq=log+sum(q**(2*n)*(1-ar**(2*n))/(2*n*factorial(2*n)) for n in range(1,24)) jq+=2*q**48/factorial(48) assert 00 for t in weights) assert all(i<=j for i,j in zip(weights,weights[1:])) rad,_=rational_spectrum(table) ep=F(2,den);H=2*rad*ep;rho=H*ib assert max(r for r,_ in previous.SCALES)*ep*ib < min(rho,*CUTS) and rho<1 a=geometric(rho,exact(q),ib,H,weights,interior) f=spectral_weight(exact(q),exact(1/(ep*ib)),weights) spectrum,ab=sp.spectra(table,den,ib,exact(q),mesh,f) e,B=exact(ep),exact(ib) reg=(iv.exp((lam/2+1/lam)*I('.577216'))*(e*B)**(I('1.5')-lam/2-1/lam)* iv.sqrt(a)*spectrum/(4*iv.sqrt(iv.pi))).b q1,q2=I('2.4'),I('3.3') empty=(e*ab/(4*iv.pi)*(2*B*iv.exp(2*previous.eu(q1)-q1*(I('.5')-exact(H)/2)*B)+ 2*iv.exp(2*previous.eu(q2)-q2*(B-1)))).b switched=(I('3.440568')*(reg+empty)/2).b classical=(2*(reg+empty)).b print('denominator',den,'inverse small cutoff',ib,'q',q,'weights',*[str(t) for t in weights],flush=True) print('regular',reg,'empty',empty,'classical relative upper',classical,'switched relative upper',switched,flush=True) print('switched conditional positive count' if switched<1 else 'no switched positive count certified',flush=True) return classical,switched if __name__=='__main__': parser=argparse.ArgumentParser(description=__doc__) parser.add_argument('table',type=Path);parser.add_argument('denominator',type=int) parser.add_argument('inverse_b',type=F);parser.add_argument('q',type=F) parser.add_argument('weights',help='six increasing positive rational values separated by commas') parser.add_argument('--mesh',type=int,default=10) parser.add_argument('--outer-only',action='store_true') a=parser.parse_args() certify(a.table,a.denominator,a.inverse_b,a.q,[F(t) for t in a.weights.split(',')],a.mesh,not a.outer_only)