Welcome to week five of modeling complex systems.
Today we'll start in my living room.
As usual, we'll revisit the Lotka-Volterra model
of species interactions that we looked at
in discussion groups.
We're gonna look at different mechanisms for reproduction,
different ways to write down interaction terms
between species, and we'll look at how we can use
some of the tools we learned to analyze, with simply our pen
and paper, the properties of these models.
Then I'll move up to my office,
where I'll show you in practice how do I use
numerical integrators to solve for the time series
and to look at the behavior
of these models in greater detail.
So first, let me just share my notes.
Okay, so in discussion rooms, we focused
on this question of sharks in Italian waters
during World War I, and we used F dot and S dot to follow
the density of sharks and fish in the sea.
Here, I'd like to make it a little more general,
and simply use N1 dot for the time derivative.
Remember, that's what the dot means,
and N2 dot for the time derivative respectively
of species one and two,
so the number of species one and the number of species two.
In the discussion groups, I think
almost all groups came up with something that looks like,
so you have a linear reproduction term.
I call it a linear term,
because it's the rate times the quantity,
but really what this is, a growth rate
that is linearly proportional to the population,
that's exponential growth, right?
So the bigger N is, the faster it's gonna grow,
and the growth is gonna keep getting faster,
so we have exponential growth,
and we'll focus on N1 for now, so let me erase that.
We had something like minus D times N1,
that was death rate,
and then we had some interaction term,
and depending on whether that was a prey or a predator,
this could be positive or negative.
Here, let me just write it as some interaction term.
I'm just gonna use A N1 N2,
and that was species interaction.
And there's a lot of flavors of the Lotka-Volterra model.
So if you're looking at a predation model,
often you'll have one positive term for one species,
and one negative term for the other,
so what's good for me is bad for you
if I'm the predator and you are the prey.
You can also have Lotka-Volterra systems of competition,
where both interaction terms will be negative.
We're sort of competing for the same resources,
and we would both be happier if the other wasn't there.
Okay, so it's good to write it
with this general notation plus A, and just acknowledge
that this constant A can be either positive or negative.
Now, often, one big thing, and it did came up
in one discussion group, is the idea
that exponential growth is not a realistic mechanism
for animal reproduction.
The ecosystem itself only has a certain capacity.
It can't contain infinitely many fish.
The sea is just not big enough, there's not enough food
for them, and we're not modeling food explicitly,
so often, you'll see a Lotka-Volterra system written as,
so now my reproduction right now has two parameters,
this R, which is the reproduction rate,
but the reproduction term also has this K1.
And I'm getting a little ahead of myself here,
so let's say that I mark everything that has to do
with species one with a one, and I'm marking A as A one two,
because it's the interaction of one with two.
Okay, so what did I do with this reproduction term?
This term is what we call logistic growth,
and it did come up, and it came up under that name
during the discussions.
The novelty here is this K term,
which we will call the carrying capacity
of the environment for species one.
So the same environment could have
different carrying capacity for species one and two,
so we could have a K1 and a K2 in both of our equations.
Really what this means is that
the environment can only take so many fish
or so many rabbits, so in time,
if I look at the log of N1,
I still get an exponential growth at early time,
because if K is very large or N is very small,
essentially, you can ignore this K1 minus N1 over K1.
It's gonna be, if K1 is very large, this is gonna be one.
So the system is gonna behave as a normal exponential growth
because of this R1 N1 term in front of it.
But as K1 minus N1, as N1 approaches the carrying capacity,
this is gonna be the factor in parent is gonna be
smaller than one, and what we're gonna get is a regime
where it slows, growth slows, and this sort of saturates
until it reaches the carrying capacity asymptotically,
and you can't go over that, right?
Because if N1 reaches K1, then we get this zero term,
and it just kills reproduction.
Essentially, there's no more food.
And depending on the system,
sometimes you can overshoot, really.
You would need like, other dimensions,
but here, it's a simple logistic growth.
This is what it looks like,
exponential growth then saturation.
Sometimes we won't even have death rates,
because especially if deaths are due to predation,
like when we were looking at the fish,
I would often put the natural death rate of fish to zero,
because essentially, no fish gets to die of old age.
And so let me add a new page here to this notebook,
and so we can propose a slightly more general,
and when I say general, it's that it's really the one
you're likely to see in practice,
a slightly more general model of species interaction
with logistic growth.
So we would've N1 equal to R1 N1.
I'm just gonna introduce here, this,
so A one two was kind of nice, right?
It was the interaction of of species one with species two,
I'm gonna write this as alpha two.
I just don't want too many labels here.
And essentially, I've also factorized the reproduction rate
and the carrying capacity in here.
I'm just trying to write it in sort of a simpler form,
where I have, what these species really want to do is this,
the exponential growth,
so this is what species wants,
and then this, all of this is actually sort of a factor
that says no, you're actually gonna get this, right?
Because yeah, you want your exponential growth,
but the environment can't take it.
Carrying capacity kills you, or the other species
with this alpha two equal N2 term kills you.
Okay, and then the more of N2 I have,
the more of this interaction I get.
This is, with the exception of the little factorization
I did up here, this is the same as what we discussed
in class where we still get a N1 times N2 term
for the interaction.
And then I could write N2 dot,
and just replace my labels, really,
different carrying capacity, because if I'm thinking
about fish and sharks, the sea can sustain a lot more fish
than it can sustain sharks.
It's just a question of size,
resource consumption, and so on.
Okay, so I have two symmetric equation, and here,
I've written them explicitly as negative in both cases,
minus alpha two N2, minus alpha one N1,
'cause what I want to look at is
a Lotka-Volterra competition model.
So nobody likes being close to the other species.
Okay, so I have a competition.
These are my system, my system of equations,
and I want to know what's gonna happen in the long term,
where if you remember our discussions and the readings,
I wanna know where are the fixed points, if any?
What are the nullclines and isoclines?
You'll see both terms, they mean the same thing, right?
Null, because at least one derivative is zero,
so null along these lines, or iso,
because when a derivative is null, that means
that the associated quantity doesn't change,
and therefore, that quantity remains the same, so iso
among that line, so either nullclines and isoclines.
And to get both fixed points in all those lines,
the first step is in solving
N1 dot equals zero and N2 dot equals zero.
I'll let you do some of the math.
We'll see like, very quickly that we have,
thinking about how to write this, but we have if N1,
let me put it like this.
I don't like it.
Let's call it N1 star for the first equilibrium.
If I have N1 equals zero, N1 dot is equal to zero.
If there are no fish in the sea, nothing can happen to fish.
They're not gonna reproduce,
and they're not gonna die, right?
Similarly, N2 star is equal to zero,
but we also have N1 star star.
Let's just call it that for the the second solution,
which is K1 minus alpha two N2,
and similarly, since our system is so symmetric, really,
we know we don't even have to do the math,
that K2 minus alpha one N1 is also gonna be the solution
for the N2 dots equation.
And here really, what we want to do is some more algebra,
because we have, and I should highlight it,
N1 is a function of N2, and N2 is a function of N1, right?
And here, the tricks will always be the same.
I mean, you've solved system of equations before in algebra,
but it might have been a long time ago.
So the key trick to remember, essentially, you want to take
either the solution for N1 or N2
and inject it into the other.
So I can take this whole expression here, and replace N1
by the right hand side of the equation for N1,
and then solve for N2, that's gonna give me N2,
and I can do the same with N2 and solve for N1,
and that's gonna give me sort of the solutions,
not as a function of each other,
but as a function of my parameters only.
So I can do a very quick example.
So we have N1 star star equal to K1 minus alpha two N2,
and then if I go and replace my expression for N2,
I get minus alpha two K2, two minuses,
so I get plus alpha one or alpha two alpha one N2.
I'm confused.
I had alpha two times alpha one N1, okay.
So now you see I have an N1 on the left hand side
and N1 on the rightmost hand side,
so I can put them together,
N1 one minus alpha two alpha one equal
to K1 minus alpha two K2, and that gives me
N1 star star equals K1 minus alpha two K2
over one minus alpha two alpha one.
All right, then the key part here,
and what I'm circling is that we now have the solution
for N1 an equilibrium point,
or N1 star star as a function of only the parameters.
Now, what's a little tricky with this solution is that
it doesn't have to be physical,
it doesn't have to be real, in a way,
because there's nothing stopping these parameters
from being negative, for example.
Alpha two times K2 can be bigger than K1.
So this equilibrium point can be outside
of the physical reality of my model.
N1 star star could be minus 20,
and that doesn't make any sense,
because I can't have minus 20 fish in the sea.
So that's why, you know,
equilibrium point alone really don't tell us
the whole story.
We have to look at what their value is,
and we also have to look at the flows around them,
and we did do a little bit of that
in the case of discrete system, right?
Looking at flow diagrams,
and I'd like to do the same thing here.
So I'll draw three things that can happen here, right?
So the space in which our model happens is,
this is gonna get messy, so I'm gonna use two colors
for the two dimensions of my space.
So I'm gonna have N2 and N1,
so they both have to be greater than zero, right?
And I also know that N1 will never be greater than K1,
and N2 shouldn't be greater than K2,
but really, at least they should be positive,
so I can draw my space in this way.
Then what my solutions are giving me,
especially if you go back, so the N1 star star N2 star star,
what they're giving you are the fixed points.
The previous solution, these equation here,
what they're giving you are lines, right?
So for each of these equation, if you know the value of N1,
then you know the value of N2
such that the derivative of N2 is zero.
So these really are your nullclines or isoclines,
and then these here are our fixed points,
'cause we also have, remember we also have
N1 equal to zero, N2 equal to zero as a fixed point.
Okay, so we can go ahead and draw some of these lines.
So I wish I had them all on the same page,
so let me just copy that, and while I'll do that,
I'll just highlight if you are getting
a little confused here, hopefully it's because of me.
This is nothing magical, right?
Like, the two lines I just copied pasted here are
really just, you know, Y equal or X equal, or no,
Y equal A times X plus B, like, equations for lines,
and that's what we want to draw in this space.
So here, I'm just gonna highlight for myself
this is the form of my fixed point,
and then this is my nullclines.
Okay, so when N1 is equal to zero, I'm looking at here,
let's say N2 is gonna be equal to K2,
so my nullcline is gonna start here at K2.
And then when N1 is equal to K2 over alpha one,
if I replace that here, the alpha one cancel out,
I get K2 minus K2, that's gonna give me zero as well,
so here, I'm gonna go down to K2 over alpha one.
And I know I have a line,
because it's a simple A times X plus B sort of equation,
so I get this line.
Then you can look at your derivative.
What happens if N2 is just below this value,
and here, I'll plug it in, we get positive value.
So we're not at zero if we're below this line,
'cause this line is where we're at zero, and then we can ask
if I'm below it, was my derivative positive or negative?
And it's positive if we're below,
and it's negative if we're above.
So this is just a matter of like,
putting the values back in the differential equation
and looking at whether it's positive or negative.
Then we can do the same thing for N1,
we're gonna get a K1 here.
If N2 is equal to zero, we're gonna get a K1 over alpha two,
and then we get a line like this.
And again, we can look at our derivative, and we'll see N1,
so we're now gonna look at horizontal derivative,
'cause as one is our horizontal dimension,
and it's gonna be positive if we're to the left,
and negative if we're to the right, right?
So I'm drawing my arrows, when I'm drawing arrows
for the N2 in that equations,
I know I'm looking at up down,
because that's my vertical dimension.
That's the choice I've made.
And when I'm looking at N1 dot, whether it's positive
or negative, I'm drawing an arrow that's gonna be
to the right or to the left, and that's my flow, right?
So often what I like to do is just draw
the resulting general flow like this.
And so if I start, the question then is like,
if I start anywhere in this flow map, right?
I could start here, I could start here,
I could start here, and so on, I sort of then have an idea
that if I start in the top right regions,
I'll start by going to the left and down,
so both species are overpopulated, and they both decrease.
If I'm in this middle region, species N2 is overpopulated,
and it's gonna decrease, but species N1 is underpopulated
and it's gonna increase, and if I start
in the bottom left corner, they both increase.
But overall, I'm just gonna get trajectories,
and let me try to do dotted lines that are gonna go
through this middle region, or want to.
That's actually not quite right in this case, whoops.
Oops, having a hard time here.
And then where I'm actually gonna end up in this case is
something, is really that
the red arrow is only gonna decrease in size
and get closer to zero as you get closer to the red line.
So even if I start here, let's say,
and both of my species decrease, and I go in this direction,
the blue arrow, and I might be tempted to say like,
"Can I get in a situation where N2 wins?"
And I'm not gonna draw a circle,
because I actually won't get there.
Can I get to a situation where N2 wins and N1 goes to zero?
Well, the red line is so far below, so as I get closer here,
my blue arrow is gonna start slowing down,
so the decrease in N1 is gonna get slower and slower,
so eventually, I know that the red arrow is gonna dominate,
and I'm gonna start going down
in this regime where now I end up here.
So you can play these games.
Here, the key point is really that the blue line is on top,
which, you know, tells us that K1 is greater than K2,
for example, or that K1 over alpha two,
which is the key thing, is greater than K2.
So if the blue line is on top in this case,
we will end up in our fixed point over here where N1 wins.
So this is, I've made my flow chart messy now,
but this is a winner take call situation
where N1 is gonna win
But that's not like a property of the system.
That's a property of how I drew my lines.
I chose a K2 when I drew this here, and I chose a K1
and an alpha two when I put this point here.
You can switch your parameters
such that those lines are not the same, right?
And that's the key point is that you look at your solution
for your fixed points, for example, and you see that this,
I'm gonna circle it in red, or highlight it actually,
you see that this combination of parameter is important.
Is K1 greater than alpha two times K2,
or is it smaller, right?
Or you look at some solutions for the nullclines,
and eventually, you get an intuition
for what are the important parameters,
'cause when I drew those line, I had to decide, right?
As soon as I put my second line in,
I had to decide is K1 greater than K2 over alpha one?
And I made a decision, so I can make the different decision.
So my first line is still gonna be the same.
When nothing else is in the full diagram, it doesn't matter.
My first line, which still there,
but I could have made a different decision,
and I could have said actually,
I'm gonna put my K1 smaller than K2 over alpha one,
then my K1 over alpha two is gonna end up somewhere here,
and then I can look at my derivatives again.
I still have a regime where everyone is underpopulated,
and everything goes up.
So here, like, the flows are the same.
If I'm below the red line, I go up.
If I'm to the left of the blue line, I go right.
If I'm to the right of the blue line, I go left.
That's the definition of the line, right?
It's like, where the derivative is zero,
so that's where it switches sign.
So here, I'm just redrawing the same thing I did before,
but the flow is combined in a different way now,
where I can like, imagine what my trajectories would be,
and now I'm gonna end up here,
so my fixed point is gonna be over here.
So I'm still in a winner takes all,
but now species two is winning.
I'll do a last case.
So there are fourth ways to draw this diagram,
one of them is that for you in assignment.
So the other decision that I made,
and you might have noticed it,
so when I have N2 here, and I have N1 here,
so I still have my first line,
which was from K2 to K2 over alpha one,
so I'm drawing something similar to the last case, right?
And I have a K1 that's here,
and then I have a K1 over alpha two.
Because K1 was small, I sort of decided earlier,
well, K1 over alpha two is gonna be like, somewhere here.
It doesn't have to be.
Alpha one, or alpha two, keep getting confused,
can itself be small,
so my K1 over alpha two might actually be higher than K2,
and all my lines cross.
Now, I still have the same thing.
If I'm below the red line, I go up.
If I'm to the left of the blue line, I go right.
So I get a total flow here, that's good.
Here, I go down still, right?
So I go here.
Here, I go down, oops, terrible arrow, and left,
so I go here, and here, I go up, oops,
up and right, so I go here.
This one is kind of an easy one.
All my flows here, my black arrows, all roads lead to Rome,
(speaking foreign language), as we say in French. (chuckles)
And we get this fixed point in the middle,
where now we can get coexistence of those species,
and our general fixed point is gonna work now,
and give us this value here.
And there's a fourth case that I'm not gonna draw,
but that you can draw, which is a little more interesting.
So I'm sorry to leave
the more interesting one to assignment,
but it's good to to go through these flow charts and.