Chaos game
One of the most well known mathematical creatures is the Sierpinski triangle. A funny way to create this type of fractal is the chaos game, by choosing initially an arbitrary point P and then randomly choosing one of the vertices of a given triangle, finally compute the midpoint of P and the randomly chosen vertex: this will be the new point P. Now the set of traces of P will look like the Sierpinski triangle.
It is surprisingly easy to create such an applet with GeoGebra:
- Create a slider and start animating it.
- Create the point P and set its trace on.
- Create the triangle ABC.
- Add this piece of code to the Scipting > On Update setting for the slider:
T=If[RandomBetween[1,3]==1,A,If[RandomBetween[1,2]==1,B,C]]
P=Midpoint[T,P]