Today on Class
13 we saw an interesting system that has very different behavior
depending on the *rate* parameter. This system was discovered in
modeling of insect population, in particular when there is
super-population (see Utilda 1957). It is called *“Quadratic
Map”*.

You can see the system drawing in the slide 17 of class 13. We can simulate the system with the following function, which you can use for this homework.

```
<- function(N, A, x_ini) {
quad_map <- rep(NA, N)
x 1] <- x_ini
x[for(i in 2:N) {
<- A * x[i-1] * (1 - x[i-1])
x[i]
}return(x)
}
```

As we discussed in class, the initial condition is not very
important, since the long time behavior is an *attractor*. The
result will be the same as long as `x_ini`

is strictly
between 0 and 1. For this exercise you can use
`x_ini=0.5`

.

The really important part is the effect of the rate `A`

.
It can take values between 0 and 4, but the most interesting behaviors
are observed for `A`

between 2.9 and 3.999999.

Your first mission is to build a vector `a_values`

with
numbers from 2.9 to 4 incrementing by 0.001.

Then you have to draw an “empty” plot with horizontal axis from 2.9
to 4, and vertical axis from 0 to 1. You can plot anything or use the
`xlim=`

and `ylim=`

options, but make sure that
the plot area is clean. For example you can use the option
`type="n"`

.

Now, for each value of `a_values`

you have to simulate
`quad_map()`

for 1500 steps. The first 1000 steps are
transient. You have to draw the last 500 steps in the same plot. Since
there are many points, use `pch="."`

.

The result should look like this:

Notice that in `quad_map()`

, the inputs are numbers, not
vectors. That is, you can say
`quad_map(N=100, A=2, x_ini=0.5)`

but you cannot say
`quad_map(N=50:100, A=a_values, x_ini=c(0.5, 0.6, 0.4)`

. Only
single values.

For extra points you can choose a color that is semi-transparent. For
example you can use “black” with *alpha channel*^{1}
equal to `0.3`

.

## Delivering the Homework

As usual, you must deliver your homework by email to
andres.aravena+cmb@istanbul.edu.tr.
You must write your code in an `.R`

file and send it as an
attachment. The first lines of your file (the metadata) must be like
this:

```
#'---
#'title: "Homework 3 - CMB2"
#'author: "Your Name"
#'number: Your Number
#'date: "when you send it"
#'---
```

**Do not forget to write your name and number.**

# References

Syunro Utida, “Population fluctuation, an experimental and theoretical approach,” Cold Spring Harbor Symposia on Quantitative Biology, 22 (1957) 139-15 1

Li, T Y, and J A Yorke. “Period Three Implies Chaos.” The American Mathematical Monthly 82, no. 10 (1975): 985–92.

## Comments

What we observe here is how the behavior of a system depends on the rates. The rest of the elements, such as the initial values and the organization of the system, remain constant. Nevertheless the system does complete different things.

We start with a single-point attractor when

`A<3`

. Then it becomes a periodic attractor with period 2, then period 4, and it keeps doubling until the period becomesinfinite. In other words, for big values of A the sequence is aperiodic. The technical term ischaos. If you are interested, you can see the original paper from Li and Yorke (1975). These authors work today on systems biology.