Where Exponential Breaks
The exponential model says one thing very loudly: the more individuals there are, the faster more arrive. It fits bacteria in their first dozen generations, a viral epidemic in its first weeks, the world's human population from roughly 1700 to 1960. Then it always stops fitting.
Why? Because nothing grows without limit. The petri dish runs out of sugar. The forest runs out of light. The country runs out of farmland. The model that gave the early-time match has no idea any of these things exist. It needs a brake — a mechanism that quietly slows down as the environment fills.
The single question of this section
How can we modify so that growth slows as approaches an upper limit — without abandoning the "rate proportional to population" intuition that worked so well in the early phase?
The fix is one extra factor in the equation. That factor, called the carrying capacity term, is what turns the exponential into the logistic. And the logistic is one of the most consequential equations ever written down in mathematical biology, economics, epidemiology, ecology, and the early theory of neural networks.
The Carrying Capacity Idea
Pierre-François Verhulst noticed it first, in 1838. He proposed that per-capita growth — the rate per individual — is not constant but should decrease as the population approaches some ceiling :
Read it slowly. The left side is the fractional growth rate — how fast changes per current individual. The right side says: this fractional rate starts at when is tiny, decreases linearly as rises, and hits zero when .
Three readings of the same fraction
- Resource fraction. is the fraction of resources already consumed; is the fraction that remains. Growth is proportional to what is left, not what has been taken.
- Crowding. When approaches 1, every birth is cancelled by a competition-induced death. The brake is the crowd itself.
- Logistic line. Plotting per-capita rate vs gives a straight line of slope crossing zero at . Real ecologists confirm this line empirically before fitting the ODE.
Writing the Equation From Intuition
Multiply both sides of the per-capita form by and the famous logistic ODE drops out:
Two terms hide inside one expression. The first, , is pure exponential growth — births winning. The second, , is the crowd-induced drag — competition winning. Their balance is the entire sigmoid:
| Regime | Which term dominates | Behavior |
|---|---|---|
| P much smaller than K | r·P (births) | Nearly exponential rise |
| P near K/2 | Both terms equal in size | Maximum growth, inflection |
| P close to K | -r·P²/K (crowding) | Asymptotic flattening |
| P slightly above K | -r·P²/K dominates | Slow decay back down to K |
The two equilibria fall out for free
Set . Then , which gives or . Two roots, two equilibria. We will see in the next section that is unstable (any tiny perturbation grows away from it) while is stable (perturbations decay back to it).
Phase Line: The Whole Story in One Picture
Plot the right side of the ODE, , as a function of . It is an upside-down parabola: zero at , zero at , maximum at . From this single picture we read off every qualitative feature of the dynamics — without ever solving the ODE.
Drag along the axis and watch the value of . Whenever it is positive the population grows; wherever it is negative it shrinks. The two zeros are the equilibria. The arrows on the P-axis point in the direction moves. Notice both arrows squeeze toward from below and above — that is the geometric meaning of stable.
The peak of the parabola at is the fastest the population ever grows. Its height is . Remember that number — it is the single most useful summary statistic of a logistic curve.
Solving the Logistic ODE
The logistic equation is separable: every can be moved to one side and every to the other. The only trick is a partial-fraction decomposition on the way through.
- Start with .
- Separate variables: .
- Split the left side with partial fractions: .
- Integrate both sides: .
- Multiply through by and exponentiate: , where .
- Apply the initial condition : at the right side is , so .
- Solve for : , i.e. .
Divide top and bottom by and use . The clean form falls out:
Sanity check at the two ends
- At : . ✓
- As : , so . ✓
- Differentiate and you must recover . (Try it on paper — the chain rule does all the work.)
Three Regimes and the Inflection Point
The logistic curve has three distinct chapters in its life. They are decided entirely by the ratio .
Early phase: nearly exponential
When the factor is essentially 1 and the equation degenerates to . On a log-y plot the early logistic looks like a straight line of slope — indistinguishable from pure exponential growth. That is why early epidemics, early markets, and early bacterial cultures are all routinely (mis)fit as exponentials.
Middle phase: the inflection
The growth rate hits its maximum when the parabola peaks — at . That moment is the inflection point: the curve changes from concave-up (still accelerating) to concave-down (now decelerating). The maximum rate is . Solving gives the inflection time:
Late phase: saturation
When approaches the brake takes over. Subtracting from the solution and linearising in the small quantity shows that the gap decays exponentially with rate : for late times. So the early and late phases are both exponentials — same constant , opposite directions — glued together at the inflection.
Interactive Logistic Explorer
Drag , , and . Watch the cyan logistic curve next to the dashed-red "what an exponential would have done" overlay. The green tangent always carries slope ; the purple dot marks the inflection at .
What to play with first
- Set and move the marker to . The curve should pass exactly through the inflection at and the rate readout should read .
- Start above — say . The population does not crash to zero, it gently decays back down to . There is no inflection in this regime.
- Crank up. The logistic just hits its ceiling faster — the shape never changes, only the time scale. That self-similarity is the defining feature of sigmoid curves.
Every Starting Population Lands at K
The strongest claim of the logistic model is its universal destination: no matter where you start (as long as ), the population ends at . The phase-line told us this is true qualitatively. Now we see it as a forest of trajectories all bending toward the same horizontal asymptote.
Six different starting points: tiny (10), small (100), middle (400), right at the inflection (900 ≈ K), and two that begin above carrying capacity (1300, 1800). The lower three trace out classic S-shapes. The upper two trace mirror-image decays. All six lock onto .
Worked Example: , ,
A small lake is being repopulated with trout. Initial release is 50 fish. Long-term monitoring of similar lakes suggests a carrying capacity of 1000 and a growth rate of per year. Predict the population every ten years, find the inflection time, and identify when the population reaches 90% of carrying capacity. Try it on paper first, then expand the panel for the full work.
Show step-by-step solution
Step 1. Write the ODE, identify constants, and assemble the solution.
We have with . The constant . So the closed-form is .
Step 2. Evaluate at landmark times.
| t (yr) | Denominator 1 + 19·e^{-0.1 t} | P(t) | dP/dt = 0.1·P(1−P/1000) |
|---|---|---|---|
| 0 | 1 + 19·1 = 20.00 | 50.00 | 4.75 |
| 10 | 1 + 19·0.3679 = 7.99 | 125.16 | 10.95 |
| 20 | 1 + 19·0.1353 = 3.571 | 280.00 | 20.16 |
| 30 | 1 + 19·0.0498 = 1.946 | 513.89 | 24.98 |
| 40 | 1 + 19·0.01832 = 1.348 | 741.84 | 19.15 |
| 60 | 1 + 19·0.00248 = 1.047 | 955.02 | 4.30 |
| 80 | 1 + 19·0.000336 = 1.0064 | 993.67 | 0.63 |
Two things to notice. (a) The numbers are not a constant multiplicative step — the early jumps look exponential (50 → 125 → 280 is roughly ×2.5 per decade) but the late jumps slow dramatically (742 → 955 is a much smaller proportional move). (b) The growth rate column climbs to its maximum near and then declines. The inflection lives in there.
Step 3. Find the inflection time exactly.
Inflection happens when . Plug into the closed form: , so , hence , hence years.
Step 4. Confirm the maximum growth rate.
At the inflection, fish per year. That matches the closed-form maximum . The two paths agree — always a satisfying cross-check.
Step 5. Time to reach 90% of carrying capacity.
Solve : , so , hence , hence , hence years.
Step 6. Sanity-check on the explorer above. Set , , , move the marker to . The P readout should be ≈513.9, the dP/dt readout should be ≈24.98, and the inflection label should sit at t ≈ 29.44, P = 500.
Reality Check: Yeast in a Flask
Pearl and Reed's 1920 yeast-growth experiment is the canonical textbook fit. Cells were counted every two hours in a closed flask; the population started small, climbed through an inflection, and plateaued near a carrying capacity set by the available sugar. The logistic fits the data so well that the residuals can't even be seen on a normal-scale plot.
The same equation, three more times. Verhulst's logistic also reproduces (i) the spread of a rumor in a closed community (every conversation is between a knower and a non-knower, analogous to a birth meeting an empty niche), (ii) the adoption curve of new technology (the Bass diffusion model is logistic in disguise), and (iii) the firing rate of a biological neuron as input current rises (the famous sigmoid). Same equation, three different fields, every time the brake is some form of saturation.
Where the model still breaks
The logistic assumes is constant. Real ecosystems have seasons, harvests, predators, and climate. If itself depends on time you get a non-autonomous logistic; if it depends on you get the gamut of Allee effects, collapse dynamics, and chaotic discrete maps. The continuous logistic is a one-equation model; the textbook should not pretend otherwise.
Python: Stepping the ODE by Hand
Before we trust the closed form, let's rebuild the curve from the differential equation itself. We'll Euler-step forward and watch the per-step rule converge to the analytic as the step size shrinks.
The takeaway is the same as for the exponential case: solving the ODE on paper buys a calculation that needs no loop. The fine Euler is a sanity check that we set up the equation correctly; the coarse Euler is a sanity check that the analytic solution actually matters. If you ever distrust a differential-equation solver, this is the exact pattern to run: analytic vs fine numeric vs coarse numeric, side by side.
Python: Recovering r from Data via Linearization
Suppose you don't know but you have a few measurements and you do know the carrying capacity . The logistic linearizes beautifully: a single log transform turns the sigmoid into a straight line. Then any method that fits a line works.
PyTorch: Fitting r and K Together
The linearization above assumed was known. In practice you usually have to fit both and from data. PyTorch turns this into one familiar pattern: forward pass, relative-MSE loss, autograd backward, optimizer step, clamp to keep parameters physical.
Why this idea matters beyond ecology
The sigmoid inside every classical neural network is literally the rescaled logistic with . The training loop you just ran with two parameters is the smallest possible version of fitting a neural network with two weights to a sigmoidal target. The calculus that governs trout in a lake is the same calculus that governs the activation function of a perceptron.
Common Pitfalls
- Mistaking early logistic for pure exponential. The early-time behavior is to first order. Fit the first ten years of a logistic and you will get an excellent exponential model — that then predicts an extinction-of-resources catastrophe that never materializes. Always extend the model with a saturation term before extrapolating.
- Forgetting that K is an output of the system. Inexperienced modelers treat as a fixed external constant. In real ecosystems emerges from the resource environment and can move with season, harvest, or climate. If the carrying capacity itself drifts, the logistic still applies pointwise but the asymptote is no longer flat.
- Linearization with the wrong K. The trick requires knowing the correct . If you use you get the log of a negative number — and your fitting code crashes. Use the PyTorch path to fit both parameters together when you are not sure of .
- Reading the inflection time off the data. Inexperienced fitters eyeball from a plot and quote one decimal place. The inflection time is sensitive to both and the ratio ; small errors in either shift it dramatically. Always derive it from the fitted parameters, not from the chart.
- Confusing continuous logistic with discrete logistic map. The continuous always settles monotonically to . The discrete famously period-doubles and becomes chaotic for . They look almost identical on paper. They are not the same equation.
Summary
- Real populations cannot grow forever. The logistic ODE adds one crowding term to the pure exponential, encoding a carrying capacity .
- The right side, plotted vs , is an upside-down parabola: zeros at and (the two equilibria), maximum at (the inflection of the time curve).
- Separation of variables plus partial fractions gives the closed form with .
- Three regimes — exponential start, inflection at with max rate , exponential approach to — together produce the S-shape.
- A single log transform, , linearizes the sigmoid. With known , a five-line least-squares fit recovers exactly.
- When is unknown, PyTorch fits both parameters jointly with autograd in a few hundred steps. The same script generalizes to the sigmoid layers of a neural network.
- The logistic appears in ecology (Verhulst), epidemiology (early epidemic curves), economics (Bass diffusion of technology), neuroscience (sigmoid firing rate) and machine learning. Same equation; the meaning of , , and changes.