Tip:
Highlight text to annotate it
X
Looking at the two model equations we gave you,
you can figure out which one belongs to prey population
and which one to the predator population by considering
the signs of the various constants in the information that we gave you.
We told you that the prey grows at constant rate of 0.5 per year.
So since population growth is, of course, positive it depends on the population already present,
we can see that this term Ax(t) should be part of the equation dealing with the prey.
Similarly, we told you that the predators die out.
Similarly, we told you that the predators have a fixed lifespan of five years.
This means that the rate of change of the predator population
while the negative component that is also directly proportional to the total population at a given time.
This matches this term right here, -Cy(t).
Now that we know that x represents predator and y represents prey,
Let's talk about these terms that includes an xy factor.
This factor of xy represents predator times prey
and this proportional to basically how often individuals of the two species meet.
We know that whenever a predator meets its prey, the situation, as it has been,
pretty advantageous for the predator but not so great for the prey.
This was shown in our equations by the fact that this interaction turn
in the equation for the rate of change of the predator population has a positive sign in front of it.
Whenever the predator meets its prey, this population can grow,
and opposite is true for the prey population since this interaction will lead to members of the prey dying.
Determining these constants A, B, C, and D should actually remind you of it
of dealing with our SIR model problems in Unit 3.
Our coefficients dealing with lifespan and growth rate
corresponds to the different time constants that we use from moving people
and mosquitoes to the infected, recovered, and susceptible populations.
Since we've already matched with the growth rate of the prey population, we can write down A=0.5/year
In the same way, since C corresponds to loss in the predator population,
we can set its value equal to 1 over the predator lifespan or 1/5 years.
In order to calculate B and D, the other two constants,
we need to make use of the last piece of information that I gave you.
That our ocean populations reach an equilibrium situation
then there are 5.010⁶ tons of prey and 1.010⁶ tons of predator.
We do some simple algebraic manipulations of the equations that I showed you above
and also plug in 0 with the rates of change divided by population showing equilibrium situation.
We can solve for B and D by simply inputting the values for A and C that we just decided upon.
This results in B=5.010⁻⁷, 1/yearton. D=4.010⁻⁸, 1/yearton.
We plugged all four of these values into base values.
We can move on to the next part of the problem.
In the function food chain, we implement the forward Euler method
using the rates of change that we just figured out using our differential equations.
Of course, you've plugged in prey in the place of x and predator in the place of y.
And finally, we move on to our sensitivity analysis.
To account for the lower limit values, we make a copy of the base values dictionary
and multiply each value corresponding to each key by 0.9
and we do the same thing for the upper limit by multiplying each value by 1.1.
These lines down here select the most critical parameter based on which parameter
has the greatest difference between its high results and its low results.
However, we can also figure out the most critical parameter
by just looking at the plots that we get when we run the program.
Our first plot shows the amount of prey in tons versus time
and the second shows the amount of predator in tons versus time.
The colors dictionary which you may have seen throughout the top of the code
paired each of the code parameter that we're looking at with a different color.
Remember, we're interested in seeing which of these parameters
has the greatest impact on the maximum value of the prey?
So in order to pick out the most critical parameter, we need to compare the maximum amount of prey
graphed by the upper and lower curves of either series in this top graph.
You can see for example that if we look at the yellow curves,
their maximum values here and here are not really that far apart.
If we look at every pair of curves that are the same color,
we can see that this one that is cyan or the light blue has the greatest distance between its peaks.
Looking back at our colors dictionary, we see that cyan or C is paired with D.
Let's look at our final graph again for just a little bit more analysis.
We can see that both graphs exhibit periodic behavior.
It looks almost like we have a Cos and Sin function.
Initially, our prey population increases which leads to an increase
in the predator population shortly afterward.
This however leads to a decrease in the prey population and so on and so forth back and forth.
Upon closer inspection, you can see that these are actually not perfect Sin and Cos functions.
In fact, the Euler method leads to a blow-up of periodic functions overtime.
We see a very clear example of this explosion of amplitude if we increase the end time and step size.
Let's see what our plot looks like now. This is a very interesting-looking plot.
We can see that the in the predator population,
we start with a peak-to-peak height of approximately 60,000 tons
and after 200 years have passed, we have a peak-to-peak height of approximately 150,000 tons.
That's a pretty dramatic increase.
If we use this implicit Euler method instead of the forward Euler method here,
we could prevent this expansion and amplitude just as we talked about
in our earlier problems involving mechanics.
You can see that many methods prove useful in different situations
whether they're dealing with diseases or fish populations or pendulum.
Great job on Unit 4 and get excited for Unit 5. We're going to look at something totally different.
How anti-lock brake systems work.