# hypercube_distance

hypercube_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected in the M-dimensional unit hypercube.

### Languages:

hypercube_distance is available in a MATLAB version and a Python version.

### Related Data and Programs:

ball_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected in the unit ball in 3D.

circle_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected on the circumference of the unit circle in 2D.

cube_distance, estimates the expected value of the distance between a pair of points randomly selected in the unit cube.

cube_surface_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected on the surface of the unit cube.

disk_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected in the unit disk in 2D.

ellipse_distance, a Python code which computes the expected value of the distance between a pair of points randomly selected on the circumference of the ellipse (x/a)^2+(y/b)^2=1 in 2D.

hyperball_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected in the unit hyperball in M dimensions.

hypercube_surface_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected on the surface of the unit hypercube in D dimensions.

hypersphere_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected on the unit hypersphere in M dimensions.

line_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected in the unit line segment in 1D.

normal01_multivariate_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected from an isotropic standard normal distribution in M dimensions.

sphere_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected on the surface of the unit sphere in 3D.

square_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected in the unit square in 2D.

triangle_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected in a triangle in 2D.

### Reference:

• Cleve Moler,
How far apart are two random points in a hypercube?,
https://blogs.mathworks.com/cleve/2017/09/27/how-far-apart-are-two-random-points-in-a-hypercube/
• Eric Weisstein,
Hypercube Line Picking,
From MathWorld--A Wolfram Web Resource,
https://mathworld.wolfram.com/HypercubeLinePicking.html

### Source Code:

Last revised on 29 January 2022.