# g0 = int_{T^3} (6 - 2 sum_j cos k_j)^{-1} dk/(2 pi)^3, computed two independent ways. import math from scipy import integrate, special # (1) Watson's closed form: W3 = int dk/(2pi)^3 (1 - (cos k1+cos k2+cos k3)/3)^{-1} # = sqrt(6)/(32 pi^3) Gamma(1/24)Gamma(5/24)Gamma(7/24)Gamma(11/24); then g0 = W3/6. W3 = math.sqrt(6)/(32*math.pi**3)*math.gamma(1/24)*math.gamma(5/24)*math.gamma(7/24)*math.gamma(11/24) print("Watson W3 (closed form) =", repr(W3)) print("g0 = W3/6 =", repr(W3/6)) # (2) heat-kernel formula: 1/l = int_0^inf e^{-t l} dt and int e^{2t cos k} dk/2pi = I_0(2t): # g0 = int_0^inf (e^{-2t} I_0(2t))^3 dt ; use the exponentially scaled Bessel function i0e. f = lambda t: special.i0e(2*t)**3 val, err = integrate.quad(f, 0, math.inf, limit=500) print("g0 (heat-kernel quadrature) =", repr(val), " quad error estimate", err)