- [Justin] We've seen how creatures

that replicate can have their numbers

grow exponentially without limit,

but in the real world, there are limits,

so, a more realistic growth curve

would look something like this.

Sorry, buddy.

(peaceful music)

As we've built up our model in the last few videos,

we've been running simulations

where the computer steps through time,

and at each time step, it decides which creatures live,

die, and reproduce according to certain odds,

and we built an equation to help us predict

what we expect to happen from one instant

to the next in the simulation.

The expected change in the number of creatures is equal

to the creature's replication chance minus its death chance,

all times the current number of creatures,

and we can graph this equation

to help us visualize our prediction.

The most interesting case is when R is greater than D,

for example, with a replication chance

of 10% and a death chance of 5%.

Then, this graph becomes

a straight line with a positive slope.

The more creatures there are,

the more new creatures we expect

to appear from one time to the next.

This leads to exponential growth.

We went over this pretty quickly,

but an earlier video in the series

called How to Grow Exponentially

goes through it in more detail.

Okay, so, that's what the world looks like

when growth is completely unchecked,

but what should it look like

if we want growth to level off at some point?

To figure this out, let's work backward.

We want the population curve to look something like this.

It's like an exponential curve toward the beginning,

but it levels out at a certain point, at 50 creatures.

For the population to level out here,

we need the expected change per time step

to go to zero when there are 50 creatures,

so, this curve is gonna need to bend downward.

How can we change the equation to make that happen?

This function equation already gives us

delta equals zero when N is zero,

but we want delta to also be zero when N is 50.

One way to do this is to make the creatures more likely

to die when there are lots of creatures around.

There's only so much space and food in the environment,

so, when it's crowded, a creature might starve.

To do this, we'll leave the base death chance alone,

but we'll include an extra term to adjust

the overall death chance based on crowding.

What should this term be?

Well, we want the term to be small

when there aren't many creatures,

and we want it to be big when there are a lot of creatures.

A simple way to achieve this is to write it as

the current number of creatures multiplied by a constant.

When N is small, the effect of crowding will be small,

and when N is large, the effect will be large.

Let's call this constant the crowding coefficient,

just to give it a short name.

Its value specifies how much the death chance goes up

for each creature when we add a new creature,

so, if the value is, say, 0.001,

that means adding another creature increases

the death chance of all creatures by 1/10 of a percent.

The new creature is eating food and taking up space,

so, there's less to go around for everyone else,

and when we have a lot of creatures,

this term really adds up, and because I looked ahead

when picking these numbers, a crowding coefficient

of 0.001 does cause delta to be zero when N is 50.

This is because the death chance

when adjusted for crowding becomes equal

to the replication chance per creature,

so, each creature is just as likely

to die as it is to reproduce.

The replication and death chances balance each other out,

and we've found equilibrium again.

To give you some of the usual terminology,

this equilibrium number is called the carrying capacity

because it's the largest number of creatures

that the environment can sustainably support,

and this number over time curve

is called a logistic growth curve,

as opposed to an exponential growth curve.

Now that we've decided how to tweak the equation

and seen how it affects the graph,

let's double-check that this actually does

predict this S-shaped logistic growth curve.

When N is small, the delta curve is pretty similar

to that upward-sloping line from the exponential case,

so, we'll expect the population to look

like it's growing about exponentially, at first.

In this middle region, the delta curve

is near its maximum, and it's mostly horizontal,

so, the overall expected growth rate doesn't change much.

The growth rate is still high,

but it's just not speeding up anymore.

And finally, in this last region,

the growth rate is actually slowing down toward zero,

so, we'll expect the population to level off,

and if N goes above the carrying capacity,

which, again, is an equilibrium number,

the growth rate goes negative, pushing N back down.

All right, let's run a simulation

to see whether this prediction works.

It sort of works,

and remember, this is all based on chance, though,

so, to really see how good this prediction is,

we need to look at many simulations at once.

Next, let's look at what happens if new kinds

of creatures appear through a mutation.

This green creature will come out

of 1% of blue's replications,

and it'll be slightly less good

at replication than the blue creature is,

with a replication chance of 8%,

but its replication chance is still

higher than its death chance,

and this orange creature will also

come out of 1% of blue's replications,

and this one will have a lower death chance.

All three of these creatures will share the same resources,

so, their delta equations would have a crowding term

that includes the total number of all kinds of creatures.

If we start a simulation with a few blue creatures,

how would you expect things to go?

As you might have guessed, orange eventually takes over.

It's not enough anymore for blue

to be good at surviving in isolation.

It now needs to be better

than its competitors to maintain numbers.

One surprising thing in this simulation is

that green is doing better than blue after 500 time steps.

You wouldn't expect that,

since it has the worst stats of all the creatures,

but this is a good example of

how luck is a big part of evolving systems.

The most likely outcome doesn't always happen.

All right, that's it for the fundamentals

of limited growth and competition,

but before we say goodbye in this video,

let's take stock of where we are.

We've seen how replication can lead

to exponentially growing populations.

We've seen how mistakes in replication

can lead to new kinds of creatures,

leading to diversity, and just now,

we saw how a finite pool of resources

puts a cap on populations and causes competition

between different types of creatures.

Replication, mutation, and competition

make up the core of evolution.

Anywhere replicators exist,

even if there's life on other planets,

everything we've said so far would apply.

We're not done yet, though.

So far, we've been making all the decisions ourselves.

You could say that we've been

artificially selecting successful creatures.

In the next video, we'll let go of the reins

and let the selection happen a bit more naturally.

See you then.