Fractals and Chaos
Sierpinski.gif (2621 bytes) Sierpinski Triangle   Lab Report
Create a Sierpinkski "Gasket" By Cutting Holes in a Triangle
ScreenSierpinskiTriangle.jpg (51757 bytes)

Purpose
The purpose of this project is to show how to create a Sierpinksi gasket, a "holey" triangle, by recursively cutting holes in a triangle.

Mathematical Background

Polish mathematician Waclaw Sierpinski introduced the "Sierpinski Gasket" in 1915.  Starting with a triangle, recursively cut the triangle formed by the midpoints of each side:

0 Sierpinski0.gif (1609 bytes)

   

1 Sierpinski1.gif (1734 bytes)

The single equilateral triangle in Step 0, is divided into four equal-area equilateral triangles in Step 2.  The "middle" triangle is colored differently to indicate it has been "cut" from the object.  This same "rule" is applied an infinite number of times.

Here are the next two steps:

2 Sierpinski2.gif (1929 bytes)

 

3 Sierpinski3.gif (2137 bytes)

Let's analyze what's happening.    Consider the perimeter of the red triangles:

Step Triangles 3 sides/triangle Length of Side Total Length
0 1 a 3a
1 3 a/2 9a/2
2 9 a/4 27a/4
k 3k a/2k 3k+1a/2k

As k approaches infinity, the perimeter of all the red triangles approaches infinity.

The area of an equilateral triangle with each side length a is EquilateralTriangleA0.gif (372 bytes).  (See the von Koch Curve Lab Report for details.)  For further computations here, we'll make computations as a fraction of A0

Step Area Subtracted Total Area
1 A0/4 A0 [1 - 1/4]
2 3A0/16 A0[1 - 1/4 - 3/16]
3 9A0/64 A0[1 - 1/4 - 3/16 - 9/64]
4 27A0/256 A0[1 - 1/4 - 3/16 - 9/64 - 27/256]
k 3k-1A0/22k A0[1 - 1/4 - 3/16 - 9/64 - ... - 3k-1/22k]

Like the von Koch Snowflake, the area of the triangles in the Sierpinkski gasket is finite but the perimeter of all the triangles is infinite.

A Sierpinski triangle has a self-similarity, Hausdorff dimension D = 1.585.  (A line is 1D and a square is 2D).

Also see Experiments in Computing:  Laboratories for Introductory Computer Science in Turbo Pascal  by Kenneth Abernethy and J. Thomas Allen, Jr., PWS-Kent Publishing, Boston, 1993, Chapter 20, Recursion in Fractal Geometry.  Constructing Sierpinski's Carpet, pp. 351-352.

Materials and Equipment

Software Requirements
Windows 98
Delphi 4/5 (to recompile)
SierpinksiTriangle.EXE

Hardware Requirements
VGA display with 640-by-480 screen in high/true color display mode

Procedure

  1. Double click on the SierpinskiTriangle.EXE icon to start the program.
  2. Select various values in the spinboxes at the left and immediately observe a new Sierpinski Gasket on the screen.  Click on the colored boxes to change colors via a color dialog.
  3. Select the Print button to print the currently displayed Sierpinksi triangle (perhaps in greater detail since many printers have many more dots than a display screen does).
  4. To write a file to disk, select the bitmap size, and the press the Write to File button.  A save dialog will let you write this file anywhere you want.

Discussion
(Outline for now)

ScreenSierpinskiTriangle unit and form:
- DrawSierpinski method
- ButtonPrintSierpinskiClick
- ButtonSierpinksiFileClick
- ShapeTColorMouseDown (to change color of TShape)
- ShellExecute to link to web site

SierpinskiTriangleLibrary unit (separates computations from user interface):
- TSierpinskiTriangle Class with method Draw (draws on any canvas:  screen, printer, or bitmap)
- SierpinskiTriangle (Local routine to Draw, which is called recursively.  Since Sierpinksi works with any triangle, the points making up the triangle are rotated before this routine is ever called.)

MapWorldToPixel unit:
- TRealPoint, RealPoint
- TRealRect, RealRect
- TDigitalPantograph [for mapping real (x,y) to integer (i,j); "corrects" direction of y-dimension]

A Sierpinski Triangle can be formed in a variety of other ways.  In the "Chaos Game," you can start at the vertex of a triangle, and throw dice to choose the corner to move to.  But you only move half way to the selected vertex and draw a point.  After a large number of such random selections, a Sierpinksi triangle is formed.  Eventually this method will be described in a separate Lab Report.   At this time an old DOS version of this technique is available in the "Language of Patterns" program, which was originally written for the Maryland Science Center.

Conclusions
Tell your friends:  the Sierpinski "gasket" has an infinite perimeter with all its triangles, but a finite area!  What does that really mean?


Keywords
Sierpinski triangle, Sierpinski gasket, fractals, self-similarity, Hausdorff dimension, digital pantograph, world-to-pixel mapping, recursion

Download
Delphi 4/5 Source and EXE:   Sierpinksi.ZIP (201 KB)

Related Downloads
Language of Patterns:  See various IFS examples, including fern, spiral, zigzag, pentagon, shrub, word "chaos," tree, Use random numbers from throwing special dice to create a Sierpinski Triangle in the "Chaos Game."   Originally developed for the Maryland Science Center.

Turbo Pascal 7 LangPatt.ZIP   Turbo Pascal 7 Source:  TP7LP.ZIP

Related DOS program:  Triangle.EXE

Note:  If you have a fast machine (233 MHz Pentium II or faster), you'll likely need a patch to run these TP 7 programs.
See this fix for "Runtime Error 200" for Turbo Pascal.


Future

Add FormResize handler.


Links:  (Also see Fractals and Chaos Section of efg's Mathematics Reference page)

SierpinskiStamp.jpg (8475 bytes)
Images of Mathematicians on Postage Stamps
http://jeff560.tripod.com

References: 

[Mandelbrot83] Benoit B. Mandelbrot
The Fractal Geometry of Nature
Sierpinski pyramid, pp. 142-143; Sierpinksi Carpet, Menger Sponge (pp. 144-145)
W. H Freeman and Company, 1983 (updated and augmented)

Thanks to Lauren D'Elia, Mathematics Department, North Carolina State University, for pointing out an error in the Background section.  (28 Nov 2001)


Updated 14 Jun 2009
Since 9 Apr 2000