"""Constants of the trial function used by fcore.py (Arb ball arithmetic): c = theta/log k, T = beta/log k, b = k-1 (theta = gamma in the paper), g(t) = 1/(c+bt) on [0,T], m2 = int_0^T g^2, mu = E X for X with density f = g^2/m2 on [0,T], F(a) = (1/(m2 b)) (1/c - 1/(c+ba)) (= P(X < a) for 0 <= a <= T; for a > T it exceeds 1, which keeps the second-mean-value bound of fcore.py valid there), f(a) = 1/(m2 (c+ba)^2), G(w) = log(1+bw/c)/b = int_0^w g. (Earlier versions of this file also contained a certifier for the plain product trial; it is not used.)""" from flint import arb def setup(k, theta, beta): kk = arb(k); L = kk.log(); c = arb(theta) / L; T = arb(beta) / L; b = kk - 1 m2 = (1 / b) * (1 / c - 1 / (c + b * T)) I1 = (1 / b ** 2) * (((c + b * T) / c).log() + c / (c + b * T) - 1) mu = I1 / m2 F = lambda a: (1 / (m2 * b)) * (1 / c - 1 / (c + b * a)) # P(X < a), 0 <= a <= T f = lambda a: 1 / (m2 * (c + b * a) ** 2) # density G = lambda w: (1 + b * w / c).log() / b # G(w) for 0 <= w <= T return dict(k=k, c=c, T=T, b=b, m2=m2, mu=mu, F=F, f=f, G=G)