# Mean distance inside a cube of side 1, in certified ball arithmetic.
import numberdb.sage as numberdb
from sage.rings.real_arb import RealBallField
R = RealBallField(420)
s, t = R(2).sqrt(), R(3).sqrt()
mean = (4 + 17*s - 6*t + 21*(1+s).log()
+ 42*(2+t).log() - 7*R.pi()) / 105
print(mean)
The six decimal entries are obtained by evaluating closed forms throughout in Arb ball arithmetic with 80 guard bits beyond the 100 significant digits stored. The largest measured ball radius at this precision is less than $3\times10^{-124}$. The interval, solid-ball and sphere values are returned as exact rationals. The planar closed forms come from [1] (publisher copy [4]); the square and cube formulas come from [2] (author preprint [5]). The solid-ball density is from [3].
Independent computations integrate coordinate-difference densities for the boxes, the triangle covariogram for the equilateral triangle, overlap densities for the disk and solid ball, and uniform angular or surface-coordinate densities for the circle and sphere. Their normalization controls, known moments and scaling checks are run before the means are compared. Numerical quadratures at 130 and 170 decimal digits agree to an absolute tolerance of $10^{-120}$ and lie inside every stored 100-digit interval. These quadratures provide an independent check, not the proof of their error bounds; the certified enclosures come from Arb applied to the closed forms. The solid-ball density is also integrated with exact rational arithmetic. The attached checks reproduce these comparisons and can check the values read from the database.