[HOME] MAM2000 (Essays/SciAm) [Prev][Top][Up][Skip][Next]

Displaying the Hypercube

A hypercube has four dimensions but a display screen has only two. It is therefore convenient to stipulate that the first two dimensions, or coordinates, of the hypercube correspond to the screen coordinates. The simplest method for dealing with the third and fourth dimensions of the hypercube is to ignore them. The display technique I shall describe does just that, but it can be enhanced and the resulting object can be projected in nearly demonic complexity-by making both the third and fourth dimensions somewhat more apparent.

To display a skeletal version of the hypercube, the program need only display its edges. Since the hypercube has 32 edges, the display section of HYPERCUBE need only draw the appropriate lines between 32 pairs of vertexes. But in what order? There are almost infinitely many possibilities, and so the answer is perhaps a matter of aesthetic and personal choice. Nevertheless, it is hard to resist drawing the edges as an Euler trail, after the mathematician Leonhard Euler. A pencil can trace such a trail on paper without being lifted from the paper and without tracing any line more than once. Consecutive edges of the hypercube drawn as an Euler trail have a common vertex.

Round, through, up and down races the Euler trail as it is drawn through the vertexes. Here is one that strikes me as quite pretty, given by the numbered vertexes of the hypercube connected in the following sequence: 0, 1, 3, 2, 6, 14, 10, 8, 9, 11, 3, 7, 15, 14, 12, 13, 9, 1, 5, 7, 6, 4, 12, 8, 0, 4, 5, 13, 15, 11, 10, 2, 0. These vertexes are stored in an array called trail with index i — the ith vertex in the sequence of 33 vertexes is designated trail(i). For each value of i there are instructions for looking up the first and second coordinates of both trail(i) and trail(i + 1). The line-drawing command in one's programming language must then be invoked to connect the two points, The lookup and the line drawing are embedded in a single loop with index i, which draws a line from each vertex in the sequence to the next.


Mathematics Awareness Month is sponsored each year by the Joint Policy Board for Mathematics to recognize the importance of mathematics through written materials and an accompanying poster that highlight mathematical developments and applications in a particular area.