A fractal is a geometric figure that is identical or statistically similar to itself at different scales. Although the term fractal was coined by Benoit Mandelbrot in 1975, they go back at least to Georg Cantor in 1883. As an example, we’ll look at the Koch snowflake by the Swedish mathematician Helge von Koch in 1904. In the next few pages we’ll write JavaScript programs to generate some fractals.
To produce the Koch snowflake, start with an equilateral triangle and then recursively replace each line segment as follows:
- Divide the line segment into three segments of equal length; then
- draw an equilateral triangle on the middle segment so that it points outward; then
- delete the segment that is the base of the triangle from the previous step.
This process produces a sequence of drawings, or point sets in the plane. The level 0 set is the original equalilateral triangle, and the level 1 set is a star with six points. Generally, the level n+1 set is produced by applying the three instructions above to each segment of the level n set. The following animated GIF shows the first seven level sets (you may need to click the image to see the animation).1
The length of the curve increases with each iteration, from one level to the next. The actual Koch snowflake, the curve to which the process converges, is of infinite length. More precisely, as we measure using increasingly shorter rulers, the curve’s length increases without converging to some value. Coastlines of countries, which are also fractal, also have this property. In contrast, the size of ‘regular shapes’ such as line segments and squares are independent of the measuring stick. The length of a line segment is the same regardless of the length of ruler used to measure it.
Fractal dimension is a measure of a figure’s capacity to fill the space in which it’s embedded. Whereas a line segment has fractal dimension 1, the fractal dimension of the Koch snowflake is about 1.26: Greater than one since it fills more of the plane than a simple line segment, but less than two since it doesn’t fill the whole plane.
The fractal dimension of regular geometric figures are integers. For example, points, lines, squares, and cubes have fractal dimension 0, 1, 2, and 3 respectively. To determine an object’s dimension, consider how its size changes when we magnify it2:
- Magnify a point (of dimension d=0) by a factor of 3 and its size doesn’t change.
- Magnify a line segment (d=1) by a factor of 3 and its size (length) triples.
- Magnify a square (d=2) by a factor of 3 and its size (area) increases by a factor of 9.
- Magnify a cube (d=3) by a factor of 3 and its size (volume) increases by a factor of 27.
The pattern is that the size S of a magnified set is equal to the magnification factor raised to the set’s dimension. Where the set has dimension and we magnify by a factor of 3, we have . To solve for d, take of left and right sides to obtain . For example, a cube has dimension .
What is the fractal dimension of the Koch snowflake? Each iteration replaces a line segment by four new copies, so magnification by a factor of 3 increases its size by a factor of 4. So its fractal dimension is .
- By António Miguel de Campos – self made based in own JAVA animation, Public Domain, Link. ↩
- We measure a figure by counting the number of measuring units needed to cover it. Magnification is analogous to reducing the size of the measuring unit. ↩