Atelier des rouesLab FR
Objects/Documentation

transport.py

Small-period independent checks linking count fluctuations and centred address error.

Download ↓
"""Exact rank displacement vs discrepancy, window moments and checks."""
from fractions import Fraction as F
from math import gcd,prod,sqrt
from motifs import primes
import csv,random
from pathlib import Path
root=Path(__file__).resolve().parents[1]/'resultats'

def stats(R,A):
 T=len(A); assert T>0;rho=F(T,R);c=0;ss=st=0; aset=set(A)
 for x in range(R):
  z=R*c-T*x;ss+=z*z;st+=z;c+=x in aset
 mu=F(st,R**2);var=F(ss,R**3)-mu*mu
 z=[F(a)-F(2*k+1,2)/rho for k,a in enumerate(A)]
 m=sum(z)/T;v=sum((x-m)**2 for x in z)/T
 assert m==-(mu+rho/2)/rho

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.