Let's consider a hypersphere of radius r
inscribed in a hypercube with sides of length 2r
. Than take the ratio of the volume of the hypersphere of radius r
to the hypercube with side length l = 2r
. We observe the following trends.
In two dimensions we have
and in three dimensions we have
For a general case, as the dimensionality d
increases asymptotically, we get
This means that as the dimensionality increases, the most of the volume of the hypercube is in the corners, whereas the center is essentially empty. In very high dimensions the figure looks like porcupine, as illustrated in the figure below (figure is taken from Zaki, 2013).
Subfigure (a) represents hypersphere inscribed withih hypercube in two dimensions. Subfigures (b) and (c) represent the same concept in three and four dimensions, respectively. In d
dimensions there are 2^d
corners and 2^(d - 1)
diagonals. The radius of the inscribed circle reflects the difference between the volume of the hypercube and the inscribed hypersphere in d
dimensions.
My question: How to start with reproduction of this figure? Should I use Metapost or TiKZ? Thanks in advance for any pointers or suggestions?
Best Answer
Here's an attempt in Metapost.
The picture shows
d=2
,d=3
,d=4
, andd=6
. It was easier to compute and store the ratios than fiddle about doing them in MP each time. Obviously it does not work ford<2
, and ford>8
you basically get a completely black disc.Notes
eps
is defined in plain Metapost to be a small positive number. The value is actually 0.00049. I used it above in order to ensure that the loop stops just before it gets to 8. The smallest possible positive number in Metapost isepsilon
, which is defined to be1/256/256
.