Mean line segment length

From testwiki
Jump to navigation Jump to search

In geometry, the mean line segment length is the average length of a line segment connecting two points chosen uniformly at random in a given shape. In other words, it is the expected Euclidean distance between two random points, where each point in the shape is equally likely to be chosen.

Even for simple shapes such as a square or a triangle, solving for the exact value of their mean line segment lengths can be difficult because their closed-form expressions can get quite complicated. As an example, consider the following question:

What is the average distance between two randomly chosen points inside a square with side length 1?

While the question may seem simple, it has a fairly complicated answer; the exact value for this is 2+2+5ln(1+2)15.

Formal definition

The mean line segment length for an n-dimensional shape S may formally be defined as the expected Euclidean distance ||⋅|| between two random points x and y,[1]

𝔼[xy]=1λ(S)2SSxydλ(x)dλ(y)

where λ is the n-dimensional Lebesgue measure.

For the two-dimensional case, this is defined using the distance formula for two points (x1, y1) and (x2, y2)

1λ(S)2SS(x1x2)2+(y1y2)2dx1dy1dx2dy2.

Approximation methods

100,000 line segments are randomly generated inside a unit square, giving an approximate mean length of 0.5212.
Monte Carlo method to approximate the mean line segment length of a unit square.

Since computing the mean line segment length involves calculating multidimensional integrals, various methods for numerical integration can be used to approximate this value for any shape.

One such method is the Monte Carlo method. To approximate the mean line segment length of a given shape, two points are randomly chosen in its interior and the distance is measured. After several repetitions of these steps, the average of these distances will eventually converge to the true value.

These methods can only give an approximation; they cannot be used to determine its exact value.

Formulas

Line segment

For a line segment of length Template:Math, the average distance between two points is Template:Math.[1]

Triangle

For a triangle with side lengths Template:Math, Template:Math, and Template:Math, the average distance between two points in its interior is given by the formula[2]

4ssasbsc15[1a3ln(ssa)+1b3ln(ssb)+1c3ln(ssc)]+a+b+c15+(b+c)(bc)230a2+(a+c)(ac)230b2+(a+b)(ab)230c2,

where s=(a+b+c)/2 is the semiperimeter, and si denotes si.

For an equilateral triangle with side length a, this is equal to

(4+3ln320)a0.364791843a.

Square and rectangles

The average distance between two points inside a square with side length s is[3]

(2+2+5ln(1+2)15)s0.521405433s.

More generally, the mean line segment length of a rectangle with side lengths l and w is[1]

115[l3w2+w3l2+d(3l2w2w2l2)+52(w2lln(l+dw)+l2wln(w+dl))]

where d=l2+w2 is the length of the rectangle's diagonal.

If the two points are instead chosen to be on different sides of the square, the average distance is given by[3][4]

(2+2+5ln(1+2)9)s0.869009s.

Cube and hypercubes

The average distance between points inside an n-dimensional unit hypercube is denoted as Template:Math, and is given as[5]

Δ(n)=01012n(x1y1)2+(x2y2)2++(xnyn)2dx1dxndy1dyn

The first two values, Template:Math and Template:Math, refer to the unit line segment and unit square respectively.

For the three-dimensional case, the mean line segment length of a unit cube is also known as Robbins constant, named after David P. Robbins. This constant has a closed form,[6]

Δ(3)=4+172637π105+ln(1+2)5+2ln(2+3)5.

Its numerical value is approximately Template:Math Template:OEIS

Andersson et. al. (1976) showed that Template:Math satisfies the bounds[7]

13n1/2Δ(n)(16n)1/213[1+2(135n)1/2].

Choosing points from two different faces of the unit cube also gives a result with a closed form, given by,[4]

4+172637π75+7ln(1+2)25+14ln(2+3)25.

Circle and sphere

The average chord length between points on the circumference of a circle of radius r is[8]

4πr1.273239544r

And picking points on the surface of a sphere with radius r is [9]

43r

Disks

The average distance between points inside a disk of radius r is[10]

12845πr0.905414787r.

The values for a half disk and quarter disk are also known.[11]

For a half disk of radius 1:

6413512π23π20.706053409

For a quarter disk of radius 1:

32135π2(6ln(222)942+48π+3)0.473877262

Balls

For a three-dimensional ball, this is

3635r1.028571428r.

More generally, the mean line segment length of an n-ball is[1]

2n2n+1βnr

where Template:Math depends on the parity of Template:Math,

βn={23n+1(n/2)!2n!(n+1)(2n)!π(for even n)2n+1n!3(n+1)((n1)/2)!2(2n)!(for odd n)

General bounds

Burgstaller and Pillichshammer (2008) showed that for a compact subset of the n-dimensional Euclidean space with diameter 1, its mean line segment length L satisfies[1]

L2nn+12n2Γ(n/2)2Γ(n1/2)π

where Template:Math denotes the gamma function. For n = 2, a stronger bound exists.

L229800+447523+194805=0.678442

References