{
  "Title": "Mean distance between two uniform random points of a region",
  "Definition": "For a region $K$ with the specified uniform probability measure $\\mu_K$, $\\Delta(K)=\\mathbf E\\|X-Y\\|_2$ is the mean Euclidean distance between two independent points $X,Y$ sampled from $\\mu_K$, also called the mean length in line picking CITE{Box} CITE{Planar}.",
  "Parameters": {
    "region": {
      "type": "Symbolic",
      "title": "region",
      "display": "$K$",
      "constraints": "A bounded Euclidean region with positive finite length, area or volume in its dimension, with its size and uniform measure specified.",
      "values": {
        "unit-interval": "interval of length $1$",
        "unit-square": "square of side $1$",
        "rectangle-1x2": "rectangle of sides $1$ and $2$",
        "equilateral-triangle": "equilateral triangle of side $1$",
        "unit-disk": "disk of radius $1$",
        "unit-cube": "cube of side $1$",
        "unit-ball-3": "solid ball in $\\mathbb R^3$ of radius $1$",
        "unit-circle": "circle of radius $1$",
        "unit-sphere-2": "sphere in $\\mathbb R^3$ of radius $1$"
      }
    }
  },
  "Comments": {
    "measure": "On the interval, polygons, disk, cube and solid ball, uniformity means normalized Lebesgue measure in the corresponding dimension. On the circle and sphere, it means normalized arc length and surface area, respectively. Distances on the circle and sphere are straight chord lengths in the ambient Euclidean space.",
    "normalisation": "The labels fix every length normalization. The square and cube have side $1$, the rectangle has sides $1$ and $2$, the equilateral triangle has side $1$, and the disk, solid ball, circle and sphere have radius $1$.",
    "regions": "Areas of regular polygons are tabulated in HREF{Area_of_the_regular_n-gon}; ball volumes and sphere areas are in HREF{Volume_of_the_unit_ball} and HREF{Volume_of_the_unit_sphere}.",
    "rational": "The interval, three-dimensional solid ball and two-dimensional sphere have rational means, which are stored exactly. The remaining entries are certified decimal enclosures of the closed forms in their comments."
  },
  "Keywords": [
    "line picking",
    "mean line segment length",
    "expected Euclidean distance",
    "geometric probability",
    "Robbins constant",
    "square line picking",
    "cube line picking",
    "disk line picking",
    "equilateral triangle",
    "circle chord length",
    "sphere chord length"
  ],
  "Tags": [
    "probability theory",
    "elementary geometry",
    "integral"
  ],
  "Links": {
    "PlanarPaper": {
      "title": "N. G. Aharonyan: Mean distance between two points in a domain",
      "url": "https://journals.ysu.am/proceedings-phys-math/article/view/vol46_no3_2012_pp003-008"
    },
    "BoxPreprint": {
      "title": "Bailey, Borwein and Crandall: Box integrals, author preprint",
      "url": "https://www.davidhbailey.com/dhbpapers/boxintegrals.pdf"
    }
  },
  "References": {
    "Planar": {
      "bib": "N. G. Aharonyan, Mean distance between two points in a domain, Proceedings of the Yerevan State University, Physical and Mathematical Sciences 46(3) (2012), 3–8.",
      "doi": "10.46991/PYSUA.2012.46.3.003"
    },
    "Box": {
      "bib": "D. H. Bailey, J. M. Borwein and R. E. Crandall, Box integrals, Journal of Computational and Applied Mathematics 206 (2007), 196–208.",
      "doi": "10.1016/j.cam.2006.06.010"
    },
    "Spherical": {
      "bib": "S.-J. Tu and E. Fischbach, Random distance distribution for spherical objects: general theory and applications to n-dimensional physics, Journal of Physics A: Mathematical and General 35 (2002), 6557–6570.",
      "arxiv": "math-ph/0201046",
      "doi": "10.1088/0305-4470/35/31/303"
    }
  },
  "Similar tables": [
    {
      "table": "HREF{Area_of_the_regular_n-gon}",
      "relation": "Areas of the regular polygons used as planar regions."
    },
    {
      "table": "HREF{Volume_of_the_unit_ball}",
      "relation": "Volumes used to normalize uniform measure on disks and solid balls."
    },
    {
      "table": "HREF{Volume_of_the_unit_sphere}",
      "relation": "Surface measures used to normalize uniform measure on circles and spheres."
    }
  ],
  "Data properties": {
    "type": "R",
    "digits": 100,
    "rigour": "proven",
    "complete": "no",
    "complete-note": "it holds nine classical low-dimensional line-picking examples: the unit interval, unit square, $1\\times2$ rectangle, unit-side equilateral triangle, unit-radius disk, unit cube, unit-radius solid ball in $\\mathbb R^3$, unit circle and unit sphere in $\\mathbb R^3$; these standard shapes provide closed-form benchmarks for uniform sampling without imposing an aspect-ratio or dimension grid",
    "sources": [
      "CITE{Planar}",
      "CITE{Box}",
      "CITE{Spherical}"
    ],
    "rigour details": "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 CITE{Planar} (publisher copy CITE{PlanarPaper}); the square and cube formulas come from CITE{Box} (author preprint CITE{BoxPreprint}). The solid-ball density is from CITE{Spherical}.\n\nIndependent 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."
  },
  "Display properties": {
    "number-header": "$\\Delta(K)$",
    "group parameters": [
      [
        "region"
      ]
    ]
  },
  "Numbers": [],
  "Programs": {
    "cube": {
      "language": "Sage",
      "code": "# Mean distance inside a cube of side 1, in certified ball arithmetic.\nimport numberdb.sage as numberdb\nfrom sage.rings.real_arb import RealBallField\nR = RealBallField(420)\ns, t = R(2).sqrt(), R(3).sqrt()\nmean = (4 + 17*s - 6*t + 21*(1+s).log()\n        + 42*(2+t).log() - 7*R.pi()) / 105\nprint(mean)\n"
    }
  },
  "Formulas": {
    "scaling": "$\\Delta(aK)=a\\Delta(K)$ for $a>0$, with uniform measure on the scaled region.",
    "circle": "For the circle $C_R$ of radius $R$, $\\Delta(C_R)=\\pi^{-1}\\int_0^\\pi 2R\\sin(\\theta/2)\\,d\\theta=4R/\\pi$, where $\\theta$ is the smaller angle between the two radius vectors.",
    "sphere": "For the sphere $S_R^2\\subset\\mathbb R^3$ of radius $R$, $\\Delta(S_R^2)=\\tfrac12\\int_{-1}^1 R\\sqrt{2-2u}\\,du=4R/3$, where $u$ is the cosine of the central angle."
  }
}
