Sierpinski's Triangle


Sierpinski's Triangle Sierpinski's Triangle is a very famous fractal that's been seen by most advanced math students. This fractal consists of one large triangle, which contains an infinite amount of smaller triangles within. The infinite amount of triangles is easily understood if the fractal is zoomed in many levels. Each zoom will show yet more previously unseen triangles embedded in the visible ones.
Creating the fractal requires little computational power. Even simple graphing calculators can easily make this image. The fractal is created pixel by pixel, using random numbers; the fractal will be slightly different each time due to this. Although, if you were to run the program repeatedly, and allow each to use an infinite amount of time, the results would be always identical. No one has an infinite amount of time, but the differences in the finite versions are very small.
To generate this fractal, a few steps are involved. First, initial X and Y values should be chosen, either by the program or the user. The values used have little effect on the fractal. Regardless of what's chosen, the same triangle will be created. Next, the program must create a random number, between 0 and 1. Then, three possible routes can be taken.

Now that X and Y have changed, the point should be plotted on the screen. Finally, loop back to the random number generation and start over again.
Only a few hundred iterations are needed to begin to see the triangles. A few thousand pixels will produce a good image.
The image on this page was created with a QBasic program, which can run on any PC. The source code is available for download.



A Java applet is also available that will create this triangle on your computer.



And finally, here's a Tcl script to draw Sierpinski's triangle.