$25
AMATH 301
Homework #8
1. The simplest population model is to assume that the rate of change of the population is proportional to the size of the population. This is a reasonable assumption when the population is small and the resources are plentiful. Let x(t) represent the population at time t. Then x is governed by the following differential equation
x˙ = rx, x(0) = x0,
where r > 0 is a constant called the growth rate. For this problem, use the growth rate r = 0.5 and initial condition x0 = 4.
(a) Use backward Euler to solve the differential equation from t = 0 to t = 5 using a step size of ∆t = 0.25. To find the global error, take your backward Euler approximation at t = 5, subtract it from the exact solution at t = 5, and take the absolute value (you should know the exact solution from class). Save the global error in A1.dat.
(b) Now use backward Euler to solve the differential equation from t = 0 to t = 100. In order to keep the same number of time steps as part (a), use
∆t = 5. Save the value of x(100) obtained from backward Euler in A2.dat.
Note: x(100) here means the backward Euler solution evaluated at t = 100. It does not mean the exact solution evaluated at t = 100 and it does not mean the 100th element of the vector x.
Things to think about: What are some of the limitations of this simple model? Does it do a good job of representing the long term behavior of a population? What was your answer to part (b)? When ∆t = 5, does backward Euler do a good job of representing the solution? Why?
2. A slightly more sophisticated model for population growth is the Logistic equation.
It is given by
x(0) = x0, where r > 0 is the growth rate as in problem 1 and K is called the carrying capacity.
The exact solution is
.
In what follows, use a growth rate of r = 0.5, a carrying capacity of K = 100, and the initial condition x0 = 4.
(a) Use forward Euler to solve the differential equation from t = 0 to t = 20 using a step size of ∆t = 0.1. Calculate the global error using the method described in problem 1(a) but with t = 20 and save the result in A3.dat.
(b) Repeat the process using forward Euler with a step size of ∆t = 0.01. Calculate the global error. Take the global error from part (a) and divide by the global error of part (b). Save the result in A4.dat.
Things to think about: Is this a better model of population growth than the one from problem 1? Why? What are the limitations of this model? What was your answer for A4.dat? How does that relate to the order of the forward Euler method?
3. Now we will start considering models that include the interactions of several populations. Let x(t) be the population of rabbits living in some region and y(t) be the population of sheep. Rabbits and sheep eat the same food so they are in competition for resources. The following is the Lotka-Volterra model of competition.
We will use the values r1 = 3, r2 = 2, K1 = 3, K2 = 2, C1 = 2, and C2 = 1 so that
the equations become x˙ = x(3 − x) − 2xy, y˙ = y(2 − y) − xy.
(a) Use the initial condition x(0) = 1.5 and y(0) = 1. Use ode45 to solve the differential equation from t = 0 to t = 10. Make a 1 × 2 row vector that has the ode45 approximation of x and y at t = 10. That is, the vector should be
.
Save this row vector in A5.dat.
(b) Repeat the same process using ode45 to solve the differential equation from t = 0 to t = 10, but this time use the initial condition x(0) = 1, y(0) = 1.5. Make a 1×2 row vector as instructed in part (a) and save the result in A6.dat.
Things to think about: Does the initial condition affect the final outcome? Does it seem like the model allows for two competing species to coexist? What happens if you use 0 as an initial condition for one of the two species? Does this make sense?
4. Next we consider a model in which one species is a predator and the other is its prey. Let x(t) be the population of rabbits and y(t) be the population of foxes. The
Lotka-Volterra predator-prey model is x˙ = ax − bxy, y˙ = −cy + dxy, for some constant a, b, c, and d.
(a) First use the parameter values a = 4, b = 2, c = 1, and d = 2 and the initial conditions x(0) = 1, y(0) = 1. Solve the differential equation from t = 0 to t = 12 using ode45. As in problem 3, make a 1×2 row vector with the values x(12) and y(12). Save this row vector in A7.dat.
(b) Repeat the same process but with the parameter values a = 2, b = 1, c = 4, and d = 1. Save the resulting row vector in A8.dat.
Things to think about: Can you explain the oscillatory pattern of the populations? What happens if you use 0 as an initial condition for the foxes? Does this make sense? What if the initial condition for rabbits is 0? Is it the same?
5. We now consider a model of three competing species locked in a life-and-death game of rock-paper-scissors (i.e. rock beats scissors, paper beats rock, and scissors beat paper). P(t), R(t), and S(t) are the populations of paper, rock, and scissors, respectively. The sizes of the populations are governed by the following differential equation.
P˙ = P(R − S) R˙ = R(S − P)
S˙ = S(P − R)
(a) Use the initial conditions P(0) = 3, R(0) = 1, and S(0) = 2. Solve the differential equation from t = 0 to t = 8 using ode45. Make a 1×3 row vector with the values P(8), R(8), and S(8) in that order. Save this row vector in A9.dat.
(b) Use the initial conditions P(0) = 2, R(0) = 2, and S(0) = 2. Solve the differential equation from t = 0 to t = 6 using ode45. Make a 1×3 row vector with the values P(6), R(6), and S(6) in that order. Save this row vector in A10.dat.
Things to think about: Graph the solutions (from t = 0 until the final t value) for parts (a) and (b) and compare. Why is the behavior so different?