import mpmath as mp
mp.mp.dps = 50
def W(n, s):
if n not in (3, 4) or s <= -2:
raise ValueError("Require n=3 or 4 and s>-2")
if n == 3:
factor = mp.power(3, s+mp.mpf(3)/2) / (
mp.pi * mp.power(2, s) * mp.gamma(mp.mpf(s)/2+1)**2)
else:
factor = mp.power(4, s+2) / (
mp.pi**2 * mp.gamma(mp.mpf(s)/2+1)**2)
return factor * mp.quad(
lambda t: t**(s+1)*mp.besseli(0,t)*mp.besselk(0,t)**(n-1),
[0, 1, 4, 16, 64, mp.inf])
print(W(3, 1))The generator evaluates the three-step gamma formulas and the four-step elliptic integrals in Arb ball arithmetic. It writes 100 significant decimal digits only after checking the enclosure widths. The complete computation is repeated at 150 and 200 working decimal digits, each with an additional 48-bit guard.
For the four-step seeds, the integral is split at $k=1/2$. The logarithmic expansion [5] is integrated term by term on $(0,1/2)$, with an explicit bound for the remainder of its square. Arb quadrature encloses the integral on $[1/2,1]$ with its analytic domain checked. The attached numerical-method.md gives the bounds; generate.py implements them. The proved moment recurrences propagate the seed enclosures.
Independent checks integrate the modified-Bessel representations [3] at 50 working digits for every stored pair $(n,s)$. The controls $W_n(0)=1$ and $W_n(2)=n$ are evaluated first. These quadratures provide agreement checks, while the enclosures come from the generator. The three-step elliptic seed identities, the face-centred cubic Watson identity, and all recurrence instances contained in the selected range are checked separately. The attached checks.py also checks the stored values.