- Consider the function

*f*(*x*) = *x*^{5 }− 2*x*^{4 }+ 3*x*^{3 }− 2*x*^{2 }+ *x *− cos(30*x*)*.*

Calculate *f*(0) and *f*(1*.*2) and save their product as A1.dat. Does this tell you if *f *has a zero on the interval [0*,*1*.*2]? Does it tell you how many zeros *f *has on the

interval [0*,*1*.*2]?

Use the bisection method to find a zero of *f *between *x *= 0 and *x *= 1*.*2. Your final answer should be a number *x *such that |*f*(*x*)| *< *10^{−10 }(i.e. use a tolerance of 10^{−10}). Save the resulting *x *in A2.dat. Save the number of steps this process took in A3.dat. (Each time you calculate a midpoint counts as one step.)

- We will now continue to investigate the logistic map that we first encountered in the previous homework:

*,*

where *P*(*t*) represents the population at year *t *as a proportion of the maximum population. Throughout this problem, we will assume that *P*(0) = 0*.*3 (note that this is not the same as in the previous homework).

For *r *= 2*.*5, create a row vector containing the populations for years 0 through

If you plot these populations, you should see that the population approaches a single value and stays there. (If you call the vector **x**, you could use the command plot(x) to visualize the data. Make sure you remove all plots before submitting to Scorelator.) The final value is called an *equilibrium *or *steady state *of the logistic map.

Repeat this process for *r *= 3*.*2 and *r *= 3*.*5. You should see different behavior in your plot. In particular, these densities should not approach an equiibrium.

Make a matrix

P2.5(98)A = P3.2(98)P3.5(98) |
P2.5(99)P3.2(99)P3.5(99) |
P_{2.5}(100)P3.2(100),P_{3.5}(100) |

where *P _{r}*(

*t*) is the population

*P*at time

*t*using the parameter

*r*. For example, the first row of this matrix should be the last three entries of the vector you obtained when

*r*= 2

*.*5. Save this matrix as A4.dat.

We would like to determine which values of *r *lead to an equilibrium. As a somewhat crude method, we can check if the population densities stop changing (or at least do not change very much) after a long enough wait. We will say that *P _{r }*reaches an equilibrium for some value of

*r*if

*P*(501)−

_{r}*P*(500) is sufficiently small. In particular, we will say that

_{r}*P*reaches an equilibrium if |

_{r }*P*(501)−

_{r}*P*(500)|

_{r}*<*10

^{−8 }and we say that the equilibrium value is

*P*(501).

For each value of *r *between 2 and 3*.*4 in steps of 0*.*1 (i.e. for every *r *in r = 2:.01:3.4), decide if the population reaches an equilibrium. If it does, find the equilibrium value. Create a 1×15 vector called is_equilibrium whose entries are either one or zero. The *k*th entry of is_equilibrium should be one if *P _{r }*reaches an equilibrium and zero if it does not for the

*k*th value of

*r*(i.e.

*r*(

*k*) if you defined r = 2:0.1:3.4). Save is_equilibrium in the file A5.dat.

In addition, create a 1 × 15 vector equilibrium_value whose entries are the equilibrium value of *P _{r }*if such a value exists and zero otherwise. Save this vector in the file A6.dat.

As an example, if *r *= 2*.*1 reaches an equilibrium value of 0*.*8, then is_equilibrium(2) should equal 1 and equilibrium_value(2) should equal 0*.*8.

**Things to think about (not required): **For some values of *r*, the population appears to oscillate between two values. Can you test for those values? Can you find oscillations between three values? Four? Can you find a better method to test for equilibria? In particular, do you think there is an equilibrium when *r *= 3?

- Proteins are long chains of amino acids that can fold into different configurations (shapes). The configuration of the protein determines (at least in large part) how the protein works. Suppose that we have a particular protein which can be folded into four different configurations:
*c*_{1},*c*_{2},*c*_{3}, and*c*_{4}, but that it only has a useful function when it is in configuration*c*_{1}. We can select a protein in the correct configuration, but because of random molecular motion we cannot guarantee that it will stay in this configuration forever. This means that we can only find the probability that the protein will be in any given configuration at any given time.

Define the vector

*p*_{1}(*t*)

^{}*p*2(*t*)*,*

**p**(*t*) = _{ }

^{}*p*^{3}(*t*)^{}

*p*_{4}(*t*)

where *p _{i}*(

*t*) is the probability that the protein will be in configuration

*c*after

_{i }*t*hours. If we choose a protein that we know is in configuration

*c*

_{1 }at time

*t*= 0, determine

**p**(0) and save it in the file A7.dat. (Remember that probabilities are between 0 and 1 and the total probability of all four configurations must add up to

1.)

We can summarize the dynamics of this protein with something called a transition matrix *T*. In our case,

0.99^{}0.00T = _{}^{}0.010.00 |
0.000.560.250.19 |
0.100.220.380.30 |
0.000.36^{}0.15^{}0.49 |

The entry *T _{ij }*(i.e. the number in the

*i*th row and

*j*th column) gives the probability that the protein will switch to configuration

*c*in the next hour if it is already in configuration

_{i }*c*. For example, if the protein is already in configuration

_{j}*c*

_{3 }then there is a 22% chance that it will switch to

*c*

_{2 }after one more hour because

*T*

_{23 }= 0

*.*22. This matrix allows us to calculate future probability distributions very easily using

**p**(*t *+ 1) = *T***p**(*t*)*.*

We will say that the protein is ineffective once it has less than an 80% chance of being in configuration *c*_{1}. How many hours will it take until the protein is ineffective? (That is, find the first time that *p*_{1}(*t*) drops below 0*.*80. Remember that we started at time 0.) Save this time in A8.dat and save the corresponding vector **p**(*t*) in A9.dat.

If you calculate **p**(*t*) for sufficiently large times, you should see that it approaches a constant vector. Just as in the previous problem, this vector is called the *equilibrium value *of **p**. Find this equilibrium value and save it in the file A10.dat.

**More to think about (for fun): **Probabilities have to add up to 1. In particular, this means that at any time, *p*_{1}(*t*) + *p*_{2}(*t*) + *p*_{3}(*t*) + *p*_{4}(*t*) = 1. You need to enforce this for *t *= 0, but for all later times we didn’t check this. Does it appear to be true for all *t*? What does this have to do with the matrix *T*? (There is a fairly simple property of *T *that forces this to be true.) Does the equilibrium value depend on your initial condition? That is, can you come up with a different **p**(0) that results in a different equilibrium value? Does the equilibrium value depend on the matrix *T*? Can you come up with a matrix so that the equilibrium value does depend on the initial condition? (Remember to keep whatever condition you found so that the sum of the probabilities is always one.)

## Reviews

There are no reviews yet.