Sierpinski Gasket

Category: Iterated Function Systems

The 'Sierpinski gasket' is one of the most famous fractals and belongs to the IFS category. It very clearly shows the characteristics of self-similarity which is one of the properties of fractals: Almost every small part of it is identical to the overall appearance. (For example if you zoom in on the Mandelbrot set, you will always find small versions of the original set.) This fractal was originally conceived by Polish mathematician Waclaw Sierpinski (1882-1969) and published in 1916.

To change the accuracy of the plot, change the maxiter parameter (7th argument) of the chaos call. (This routine quickly uses up a significant amount of memory, decrease maxiter in case there are any error messages.)


> chaos:=proc(x1, y1, x2, y2, x3, y3, maxiter, seed1, seed2)
> # original procedure written by Tom Williams and modified by John Oprea
>    local randi, x, y, sx, sy, ir, i, j;
>    randi:=rand(1 .. 3):
>    x:=[x1, x2, x3]:
>    y:=[y1, y2, y3]:
>    sx:=seed1:
>    sy:=seed2:
>    ir:=[sx, sy]:
>    for i from 1 to maxiter do   
>       j:=randi():   
>       sx:=(sx+x[j])/2.:
>       sy:=(sy+y[j])/2.:
>       ir:=[op(ir), sx, sy]  
>    od:  # concatonates sx and sy onto list ir
>    plot(ir, style=point, symbol=POINT, scaling=constrained);
> end:

> chaos(0, 0, .5, 1, 1, 0, 7000, .5, .5);


> chaos(0, 0, -4, 7, 6, 2, 3000, 1, .5);


last back next

MAPLE V FRACTALS Sierpinski gasket #1.00 current as of July 27, 1996
Author: Alexander F. Walz, alexander.f.walz@t-online.de
Original file location: http://www.math.utsa.edu/mirrors/maple/mfrsierp.htm