sierpinski | R Documentation |
Returns a matrix of 0s and 1s that form a Sierpinski carpet. This is a two dimensional fractal, which is generated using a recursive algorithm that is built on a grid of eight black squares surrounding a white square. Each level of recursion replaces each black square by the same pattern.
sierpinski(n = 5)
n |
an integer value controling the number of recursive levels. |
a square matrix with 0s and 1s.
g <- sierpinski(n=5) image(g,col=c('white','black'),axes=FALSE,asp=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.