**Revolutions**, and kindly contributed to R-bloggers)

I finally got the new version of Twitter yesterday, and it looks great. And that's no accident: according to the designer, the layout of the new Twitter interface is based on the Golden Spiral:

You can describe the Golden Spiral by laying consecutive squares in a spiral fashion, each square being smaller than the last by a factor of the Golden Ratio, (1+sqrt(5))/2 or approximately 1.618. As a ratio of a length to a width, the Golden Ratio has been known by artists for millenia as an aesthetically pleasing aspect ratio for rectangular features in works of art (such as the dimensions of a painting). It's also known to mathematicians and statisticians as the number to which ratios of successive members of the Fibonacci sequence converge.

In a classic case of using a sledgehammer to crack a walnut, I created a custom iterator in R to represent the Fibonacci sequence (code after the fold) and verified the ratio converges to the Golden Ratio at the R command line:

> fib1 <- iFib(); nextElem(fib1) [1] 1 > fib2 <- iFib() > nextElem(fib1)/nextElem(fib2) [1] 1 > nextElem(fib1)/nextElem(fib2) [1] 2 > nextElem(fib1)/nextElem(fib2) [1] 1.5 > nextElem(fib1)/nextElem(fib2) [1] 1.666667 > nextElem(fib1)/nextElem(fib2) [1] 1.6 > nextElem(fib1)/nextElem(fib2) [1] 1.625 > nextElem(fib1)/nextElem(fib2) [1] 1.615385 > nextElem(fib1)/nextElem(fib2) [1] 1.619048 > nextElem(fib1)/nextElem(fib2) [1] 1.617647 > nextElem(fib1)/nextElem(fib2) [1] 1.618182 > nextElem(fib1)/nextElem(fib2) [1] 1.617978 > nextElem(fib1)/nextElem(fib2) [1] 1.618056 > nextElem(fib1)/nextElem(fib2) [1] 1.618026

See? Golden ratio.

Twitter: @stop

require(iterators) ## Generator for Fibonacci sequence iFib <- function() { lastFib <- 0 nextFib <- 1 nextEl <- function() { newLast <<- nextFib nextFib <<- lastFib + nextFib lastFib <<- newLast lastFib } it <- list(nextElem = nextEl) class(it) <- c('abstractiter','iter') it }

**leave a comment**for the author, please follow the link and comment on his blog:

**Revolutions**.

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...