James Riley

1 minute read

My favourite bookshop reopened, and I found a nice little book on chaos that needed to come home with me.

I’d usually talk about the maths of the logistic map, but Wikipedia did it better.

I’m more interested in this 1991 book saying that home computers are not powerful enough to show this chaos, but a Cray supercomputer can manage it.

I then remembered that plotly can make scatterplots that you can zoom into. I’ve had to tweak this epsilon so that this graph doesn’t take forever to load.

epsilon <- 0.001

population <- list(x = seq(0.1,0.9,length.out=100), lambda = seq(0,4,by=epsilon)) %>% 
  cross_df() %>% 

tick <- function(pop, history=100){
  pop %>% 
    top_n(1,generation) %>% 
    mutate(x=lambda * x * (1-x)) %>% 
    mutate(generation=generation+1) %>% 
    bind_rows(top_n(pop,history,generation)) #Ugly hack
for(i in 1:1e3){
  population <- tick(population)
population %>% 
  mutate(x = round(x/epsilon)*epsilon) %>% 
  distinct() %>% 
  plot_ly(x=~lambda,y=~x, marker=list(size=1) ) %>% 
comments powered by Disqus