The Peano Curve

Suggested Installation

Copy the file Peano.m in the $TopDirectory/AddOns/ExtraPackages directory, where $TopDirectory stands for your main Mathematica directory. Then you can load the package by evaluating the following cell :

<< Peano`

If you choose to store the file elsewhere, you can still load it with :

\(<< [path]\Peano.m\)

where [path] stands for the path of the directory in which you copied the file.

The 2D Peano Curve

The Peano curve, also sometimes referred to as the Hilbert plane-filling curve, is a continuous mapping of the open interval ]0, 1[ into the open square ]0, \(TraditionalForm\`\(1\([\^2\)\)\) = { (x, y) ϵ (ℝ^2) | 0 ≤ x, y ≤ 1 }. Thus a curve, essentially a 1D mathematical object, can fill completely a 2D surface. This pretty disturbing fact has led mathematicians of the beginning of the century to examine more closely the notions of cardinality and dimension.

As interesting as it may seem, it is however quite difficult to visualize this curve. The Peano.m package nevertheless allows one to construct a sequence of curves in a square (actually the ]-2, \(TraditionalForm\`\(2\([\^2\)\ \)\)square to simplify the code). The Peano curve is defined to be the limit of this sequence of curves. It is thus possible to get a good idea of what this curve "looks like".

Peano[n]			The list of the vertices of the nth step 							toward the Peano curve.

For example, here are the vertices of the curve corresponding to n = 2 :

Peano[2]

To see the corresponding curve, you only have to connect the points :

Show[Graphics[Line[%]], AspectRatio -> 1]

This is the command typically used to show the nth curve :

Show[Graphics[Line[Peano[n]]],
		AspectRatio -> 1]

I deliberately chose not to define in the package a command that shows the curve automatically to let the user experiment a bit. However I have included a Graphic object called Square which represents the square in which the Peano curve is inscribed.

Square			A Graphic object representing a square.

The command typically used to show the nth curve inside this square is :

Show[Graphics[Line[Peano[n]]], Square,
		AspectRatio -> 1]

Show[Graphics[Line[Peano[3]]], Square, AspectRatio -> 1]

Show[Graphics[Line[Peano[4]]], Square, AspectRatio -> 1]

You can see that each step contains four smaller versions of the precedent step. Thus there are (4^n)points in Peano[n].

Now here are the commands that I used to generate the image file Peano.gif :

g[n_]  :=  
      Show[Graphics[Line[Peano[n]]], Square, AspectRatio -> 1, 
        DisplayFunction -> Identity]

Show[
      GraphicsArray[{{g[0], g[1], g[2]}, {g[3], g[4], g[5]}, {g[6], g[7], 
            g[8]}}], DisplayFunction -> $DisplayFunction]

(Output has been suppressed to keep the file small.)

As you can see, even after a relatively small number of steps, the square looks completely filled on our computer screen because of its (finite) resolution.

The 3D Peano Curve

The 3D Peano curve (or Hilbert space-filling curve) is very similar to its 2D counterpart, except that it fills completely a cube. It is constructed in the same way, the 3D Peano curve being the limit of the sequence of curves that we construct here. For the sake of simplicity each curve is inscribed inside the ]-2, \(TraditionalForm\`\(2\([\^3\)\)\)cube. You will notice that each step contains 8 smaller versions of the precedent step, thus there are (8^n) points in Peano3D[n].

Peano3D[n]			The list of the vertices of the nth step
						toward the 3D Peano curve.
	Cube					A Graphic object representing a cube.

Here are the typical commands to show Peano3D[n], without and with the cube, respectively :

Show[Graphics3D[Line[Peano3D[n]]],
		Boxed -> False]

	Show[Graphics3D[Line[Peano3D[n]]], Cube,
		Boxed -> False]

Show[Graphics3D[Line[Peano3D[3]]], Cube, Boxed -> False]

Now here are the commands that I used for the file Peano3D.gif :

g2[n_]  :=  
      Show[Graphics3D[Line[Peano3D[n]]], Cube, Boxed -> False, 
        DisplayFunction -> Identity]

Show[GraphicsArray[{{g2[0], g2[1], g2[2]}, {g2[3], g2[4], g2[5]}}], 
      DisplayFunction -> $DisplayFunction]

(Output has been suppressed in order to keep the file small.)

Gabriel Chênevert
Student at Université de Montréal
Montréal, Québec, Canada
October 1999

Please feel free to e-mail me with any question, comment or suggestion at
cheneveg@jsp.umontreal.ca, or via http://www.jsp.umontreal.ca/~cheneveg.