4

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

enter image description here

and in three dimensions we have

enter image description here

For a general case, as the dimensionality d increases asymptotically, we get

enter image description here

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).

enter image description here

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?

  • Because the same segment is repeated multiple times, I'd aim for a \foreach command inside a tikzpicture.. – 1010011010 Oct 18 '14 at 8:33
  • 1
    You can illustrate the same geometric paradox by inscribing 2^n hyperspheres in the corners of an n dimensional hypercube. Then inscribe the largest hypersphere possible in the center. For n > 10 its diameter is >1! – Ethan Bolker Oct 18 '14 at 13:51
7

Here's an attempt in Metapost.

enter image description here

The picture shows d=2, d=3, d=4, and d=6. It was easier to compute and store the ratios than fiddle about doing them in MP each time. Obviously it does not work for d<2, and for d>8 you basically get a completely black disc.

prologues := 3;
outputtemplate := "%j%c.eps";

ratio2  = 0.78540 ; 
ratio3  = 0.52360 ; 
ratio4  = 0.30843 ; 
ratio5  = 0.16449 ; 
ratio6  = 0.08075 ; 
ratio7  = 0.03691 ; 
ratio8  = 0.01585 ; 
ratio9  = 0.00644 ; 

vardef hs_in_hc(expr d, r) = % d = dimensions, r = outer radius 
   save s, inner_circle, outer_circle;
   s = 8/(2**d); % there are 8 points on a fullcircle path
   path outer_circle, inner_circle;
   outer_circle = fullcircle scaled 2r;
   inner_circle = outer_circle rotated 22.5s scaled (0.9*ratio[d]);
   image(
     fill inner_circle withcolor .8 white;
     draw inner_circle;
     draw point 0 of outer_circle -- point 0 of inner_circle
        for i=s step s until 8-eps: 
          -- point i of outer_circle 
          -- point i of inner_circle 
        endfor
        -- cycle;
     for i=0 step s until 8-eps: 
       draw origin -- point i of outer_circle dashed withdots scaled .5;
     endfor
    ) enddef;

beginfig(1);

  draw hs_in_hc(2,50);
  draw hs_in_hc(3,50) shifted 100 right;
  draw hs_in_hc(4,50) shifted 200 right;
  draw hs_in_hc(6,50) shifted 300 right;

endfig;
end.

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 is epsilon, which is defined to be 1/256/256.

  • What means eps? – Jorge Oct 24 '14 at 14:22
  • @Jorge I'll update the answer to explain – Thruston Oct 24 '14 at 15:01
3

It is not difficult to change the radius of the inner circle to be a function of \N. I left it constant as I am so lazy to search for such a function right now.

Static version

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{multido}

\begin{document}
\makeatletter
\def\N{12}\degrees[\N]
\begin{pspicture}[dimen=m,linejoin=1](-5,-5)(5,5)
    \pscustom
    {
        \moveto(!5 0)
        \multido{\i=0+1}{\numexpr\N-1}{\lineto(!3 \i\space .5 add \pst@angleunit PtoC)\lineto(!5 \i\space 1 add \pst@angleunit PtoC)}
        \lineto(!3 \N\space 0.5 sub \pst@angleunit PtoC)
        \closepath
    }
    \pscircle{3}
\end{pspicture}
\end{document}

enter image description here

Animated version

It is given just for fun.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{multido}

\begin{document}
\makeatletter
\multido{\ic=4+1}{10}{%
\def\N{\ic}\degrees[\N]
\begin{pspicture}[dimen=m,linejoin=1](-5,-5)(5,5)
    \pscustom
    {
        \moveto(!5 0)
        \multido{\i=0+1}{\numexpr\N-1}{\lineto(!3 \i\space .5 add \pst@angleunit PtoC)\lineto(!5 \i\space 1 add \pst@angleunit PtoC)}
        \lineto(!3 \N\space 0.5 sub \pst@angleunit PtoC)
        \closepath
    }
    \pscircle{3}
    \rput(0,0){$N=\N$}
\end{pspicture}}
\end{document}

enter image description here

  • I think we need a new postscript operator for \pst@angleunit so we don't need to invoke \makeatletter. – kiss my armpit Oct 18 '14 at 10:20
  • The radius of the inner circle is supposed to shrink as the dimensions increase according to the OP. – Thruston Oct 18 '14 at 12:28
  • @Thruston: Yes. But I am too lazy (read unable) to find the radius as a function of the dimension. – kiss my armpit Oct 18 '14 at 12:37
3

Here's a pure TikZ/pgf solution. I'm making use of my own question about gamma functions and double factorials here.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{math}
\usetikzlibrary{calc} 

\tikzmath{
  function doublefactorial(\x) {
    if (\x > 1) then {
      return \x * doublefactorial(\x-2);
    } else {
      return 1;
    };
  };
  % this definition only works for positive integers and half integers
  function gamma(\x) {
    if isodd(int(2*\x)) then {
      return doublefactorial(int(2*\x-2))* sqrt(pi) / 2^(\x-0.5);
    } else {
      return factorial(int(\x-1));
    };
  };
}

\newcommand\hyperintersection[3][(0,0)]{
  \pgfmathparse{360/2^#2}
  \let\stepsize\pgfmathresult
  \pgfmathparse{2^(#2)/pi *#3* pi^(0.5*#2) / (2^(#2) * gamma(#2/2+1))  * sin(180 / 2^#2)}
  \let\radfrac\pgfmathresult
  \begin{scope}[shift={#1}]
    \draw[fill=lightgray] (0,0) circle (\radfrac*#3);
    \foreach \x in {0,\stepsize,...,360} {
      \draw (\x:#3) -- (\x+.5*\stepsize:\radfrac*#3) -- (\x+\stepsize:#3);
      \draw[very thin,densely dashed] (\x:#3) -- (0,0);
    }
  \end{scope}
}

\begin{document}
\begin{tikzpicture}[x=1cm,y=1cm]
  \hyperintersection[(0,0)]{2}{1}
  \hyperintersection[(2.5,0)]{3}{1}
  \hyperintersection[(5,0)]{4}{1}
  \hyperintersection[(7.5,0)]{5}{1}
  \hyperintersection[(10,0)]{6}{1}
\end{tikzpicture}
\end{document}

The output looks like this:

output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.