Fractals in R

August 27, 2010
By

(This article was first published on R-Chart, and kindly contributed to R-bloggers)



Atte Tenkanen had a blog on fractals using R for a time. Much of his source code is still available online.  To produce his version of the Mandelbrot set:

source('http://users.utu.fi/attenka/mandelbrot_set.R')


Fractals (such as the Mandelbrot Set pictured above)  are objects that display self-similarity on all scales.  Fractal are mathematical concepts with practical applications. For example, fractal dimensions provide a solution to measuring a coastline - where you come up with different lengths depending upon the length of the ruler you use. (the Coastline Paradox).

There also pretty and fun to look at....

Back in the 80's my little brother and I would type in fractal equations into a Radio Shack Color Computer.  We would spend half a day typing in a program and debugging it and the other half a day waiting for the image to render.  He later improved the process by using a Commodore Amiga and more than two fingers for typing.
You can also do this type of plot using ggplot2 - and most of the effort is related to turning off axes and legends.  The source is on github and can be run from there.

source('http://github.com/ezgraphs/R-Programs/raw/master/mandelbrot.R')

So now I can download source code from somewhere out on the interweb thingy and use open source software to render these images in a matter of seconds.  


Just like we used to do when we were kids....

To leave a comment for the author, please follow the link and comment on his blog: R-Chart.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.