What is Chaos Theory?

That equation was the following:

\[x_{t+1}= kx_t(1-x_t)\]

Where k = growth rate, \(x_t\) = a population percentage at time \(t\). Let us graph this base function to better understand what It looks like.
x <- 0.7
r <- 3.4
curve(r*x*(1-x))

Here we have a simple inverted parabola.
Now lets generate a set of potential growth rates from 0.5% to 4.0% (0.001 increments) and plug into this equation and also write a function that will then iterate however many times we specify, for a given population starting point, what the end population would be at time \(t\) in the future.
Now we are going to start combining our work and pass the vector of growth rates (list of rates) into our newly dubbed “Chaos Function”. The output is a little messy so we will have to transform the matrix a few times to clean it up for graphing.
This first plot will show three differnet cases for our 1000 iterations of our chaos function. The first window will display the outputs for a growth rate of 1.2%, the second window shows a growth rate of 3.0%, and the third window shows a growth rate of 3.8%.
ggplot(data = chaos_complete, aes(y = chaos_complete$`1.2`, x = c(1:R))) + 
  geom_point() +  labs(title = 'Chaos Theory Visual') +
  ggplot(data = chaos_complete, aes(y = chaos_complete$`3`, x = c(1:R))) + geom_point() +
  ggplot(data = chaos_complete, aes(y = chaos_complete$`3.8`, x = c(1:R))) + geom_point() 
## Warning: Use of `chaos_complete$`1.2`` is discouraged. Use `1.2` instead.
## Warning: Use of `chaos_complete$`3`` is discouraged. Use `3` instead.
## Warning: Use of `chaos_complete$`3.8`` is discouraged. Use `3.8` instead.

If you are wondering why these outputs look so different, it is because they are. In our first case we can see something that we would expect. As the growth rate increases our ending population also increases. In the second case we can see that the population seems to bifrucate and we have two hypothetical equilibrium points. The third case appears at first glance to be complete randomness.
ggplot(rate_equilibrium, aes(x = Growth_Rate, y = Equilibrium_Pop)) + geom_point()

visualize(
  rate_equilibrium, 
  xvar = "Growth_Rate", 
  yvar = c("X1", "X2", "X3", "X4", "X5","X6","X7","X8","X9","X10","X11","X12","X13","X14","X15","X16"), 
  comby = TRUE, 
  type = "line", 
  nrobs = -1, 
  theme = "theme_dark", 
  base_size = 10, 
  base_family = "sans", 
  labs = list(
    title = "Chaos Theory Visualized", 
    subtitle = "The Full Visual", 
    caption = "", x = "Growth Rate", 
    y = "Equilibrium Point/Pop"
  ), 
  custom = FALSE
)

Feigenbaum’s constant is another common interest when studying this bifurcation graph. We won’t go into details here,but essentially We want to look at the ratio between each bifurcation in the diagram and check to see if that ratio is the same across each distance. I have one approximation for the ratio below.

Verification of Feigenbaum’s Constant:

#### LET US SEE IF WE CAN  VERIFY FEIGENBAUM'S CONSTANT#####
### Keep in mind the plot above and look into the data for the bifurcations
view(rate_equilibrium)

### Notice the first three bifurcations occur at 
r1 = 2.986
r2 = 3.444
r3 = 3.542

# So our first approximation of FEIGENBAUM'S CONSTANT IS:
FEIGENBAUM = (r2 - r1)/(r3-r2)

print(FEIGENBAUM)
## [1] 4.673469