# Logistic map: Feigenbaum diagram

March 17, 2012
By

[This article was first published on mages' blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The other day I found some old basic code I had written about 15 years ago on a Mac Classic II to plot the Feigenbaum diagram for the logistic map. I remember, it took the little computer the whole night to produce the chart.

With today’s computers even a for-loop in a scripting language like R takes only a few seconds.

``` logistic.map <- function(r, x, N, M){ ## r: bifurcation parameter ## x: initial value ## N: Number of iteration ## M: Number of iteration points to be returned z <- 1:N z[1] <- x for(i in c(1:(N-1))){ z[i+1] <- r *z[i] * (1 - z[i]) } ## Return the last M iterations z[c((N-M):N)]}## Set scanning range for bifurcation parameter rmy.r <- seq(2.5, 4, by=0.005)system.time(Orbit <- sapply(my.r, logistic.map, x=0.001, N=1000, M=300))## user system elapsed (on a 2.4GHz Core2Duo)## 1.834 0.011 1.840 Orbit <- as.vector(Orbit)r <- sort(rep(my.r, (M+1)))plot(Orbit ~ r, pch=".") ```

Let’s not forget when Mitchell Feigenbaum started this work in 1975 he did this on his little calculator!

To leave a comment for the author, please follow the link and comment on their blog: mages' blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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

Tags: , , ,

Comments are closed.

# Never miss an update! Subscribe to R-bloggers to receive e-mails with the latest R posts.(You will not see this message again.)

Click here to close (This popup will not appear again)