Simulates, via Monte Carlo
(limited time), the points in a unit n-cube in 1, 2 or 3 dimensions,
i.e., a (straight) line segment, a square or a cube, in order to find
the distribution of the interdistances, i.e.,
the distances between the two points for every pair of points.
In the Figure, is shown a square (n = 2)
with npoints = 100 random points.
Plots the density function (pdf), f(d), and
the probability function (cdf), F(d),
for the distance, and computes its mean and standard-deviation.
The longest diagonal in the n-cube has size
√n (1, 1.414, 1.732). |
 |