Sierpinski Gasket

Submitted by Kenrick on Thu, 10/25/2007 - 22:28.
Oct 25 2007 - 10:28pm
Etc/GMT-8

A Sierpinski Gasket (or Triangle) is a type of fractal named after the Polish mathematician Waclaw Sierpinski who described some of its interesting properties in 1916. It is a nice example of how an orderly structure can be created as a result of random, chaotic behavior. In fact, the gasket can only be created by random behavior. http://serendip.brynmawr.edu/playground/sierpinski.html is a good site to learn more about Sierpinski Gaskets.

I normally just give the sequence of steps to the student and let them see the gasket "magically" form before their eyes. The student will need to know how to generate random numbers, iterate, and draw pixels on the screen.

The creation of a Sierpinski Gasket is fairly simple. There are three points that form the corners of a triangle. In the figure "TriangleGasket", they are labeled as X,Y, and Z.

TriangleGasketTriangleGasket

To get the Sierpinski Gasket follow these steps:

  1. Randomly pick one of the three corners. Call this the current point. (Alternatively, you could also randomly select any point inside the triangle).
  2. Randomly pick one of the three corners. Call this the target point.
  3. Calculate a point in the middle of the current point and the target point.
  4. Draw a pixel at the middle point.
  5. Set the current point to the middle point.
  6. Go back to step 2

It would seem like you should get a random mess of dots since the procedure randomly picks a target corner each time. Instead, if this process is repeated many times, you will get a picture like the following:

SierpinskiGasketSierpinskiGasket


For a much easier version, I have given students the attached file "Gasket.java" as a template to use for a lab or in-class exercise. It's written in Java but translates easily to any language with a graphics library to set pixels.

AttachmentSize
Gasket.java2.26 KB

feedback

well great mathamatican :)