By completing the following exercises, you will reproduce the behavior of the logistic DDS \[a_{n+1} = r(1-a_n)a_n,~a_0=0.1\] shown in Figure 1.21 of the text.
Define the updating function \(f(r,a)\) so that it takes both a value of \(r\) and one of \(a\) as input.
update = function(r, a) r*(1-a)*a
r = 1.546
solution = function(N) {
A = c()
A[1] = 0.01
for (j in 1:N){
A[j+1] = update(r, A[j])
}
return(A)
}
values_of_a = solution(100)
days = 0:100
plot(days, values_of_a, type='o', echo=FALSE)
In terms of the long-term behavior of the function, the values of a_{n} stabilize to a constant value of approximately 0.35.
Repeat the previous exercise with \(r=2.750\).
r = 2.750
values_of_a = solution(100)
days = 0:100
plot(days, values_of_a, type='o', echo=FALSE)
Repeat the previous exercise with \(r=3.25\).
r = 3.25
values_of_a = solution(100)
days = 0:100
plot(days, values_of_a, type='o', echo=FALSE)
Repeat the previous exercise with \(r=3.525\).
r = 3.525
values_of_a = solution(100)
days = 0:100
plot(days, values_of_a, type='o', echo=FALSE)
Repeat the previous exercise with \(r=3.555\).
r = 3.555
values_of_a = solution(100)
days = 0:100
plot(days, values_of_a, type='o', echo=FALSE)
Repeat the previous exercise with \(r=3.75\).
r = 3.75
values_of_a = solution(100)
days = 0:100
plot(days, values_of_a, type='o', echo=FALSE)
Repeat Exercise 6, this time with \(a_0 = 0.5\). Comment on your results, compared to those of the previous exercise.
r = 3.555
solution = function(N) {
A = c()
A[1] = 0.5
for (j in 1:N){
A[j+1] = update(r, A[j])
}
return(A)
}
values_of_a = solution(100)
days = 0:100
plot(days, values_of_a, type='o', echo=FALSE)
Changing the initial value from 0.01 to 0.5 changes the step size of the function and results in the value that begins the oscillation cycle being larger than the value that begins the oscillation cycle when a=0.01. Changing the value of a also changes the length of the oscillations between two points as well as the starting point, end point, and the a_{n} during each of the days in the 100-day period.
In the previous exercises, you have observed two-cycles, four-cycles, and eight-cycles. Can you find a value of r that gives rise to a sixteen cycle? How can you tell?
r = 3.565
values_of_a = solution(100)
days = 0:100
plot(days, values_of_a, type='o', echo=FALSE)
You can tell that r = 3.565 gives rise to a sixteen-cycle pattern because if you closely observe the graphical representation of the numerical solution for the function, you can see that a pattern forms only after sixteen oscillations when the a_{n} is equal to the value of a_{n} immediately before the first oscillation.