# Predators and Prey in Seasons
[[MATH310F26(Day 27) - One step at a time, no dice|Day 27]] ended with two populations that breed in seasons, prey $x_n$ and predators $y_n$,
$x_{n+1} = r\,x_n - \alpha\,x_n y_n, \qquad y_{n+1} = s\,y_n + \beta\,x_n y_n,$
with $r > 1$ (prey alone grow), $0 < s < 1$ (predators alone die off), $\alpha > 0$ (meeting a predator is bad for the prey) and $\beta > 0$ (meeting prey is good for the predators). The values from class are $r = 1.3$, $s = 0.8$, $\alpha = 0.02$, $\beta = 0.01$. The sliders let $r$ and $s$ run from $0.05$ to $2$, on either side of 1, so you can also see what happens when those assumptions fail.
<div class="applet" data-applet="lv-map"></div>
## Reading the applet
- The top plot is the **phase plane**. Each season is a dot at $(x_n, y_n)$, joined to the next by a line. Click or drag in it to choose the starting point. The applet opens at $(20, 10)$, the run checked after class.
- The bottom plot shows the same run as two curves against time, prey in green and predators in red.
- The dashed green line is where the prey do not change from one season to the next, and the dashed red line is where the predators do not change. Setting $x_{n+1} = x_n$ gives $r - \alpha y = 1$, so $y = (r-1)/\alpha$. Setting $y_{n+1} = y_n$ gives $s + \beta x = 1$, so $x = (1-s)/\beta$. They cross at the **fixed point**
$x^* = \frac{1-s}{\beta}, \qquad y^* = \frac{r-1}{\alpha},$
which is $(20, 15)$ for the class values. (The axes $x = 0$ and $y = 0$ also leave one population unchanged, since $0$ stays $0$.)
- **Δt (season length)** is explained in the next section. At $\Delta t = 1$ the applet runs exactly the map above.
- **continuous orbit** draws the continuous-time model from the next section as a faint dotted curve. When it runs off the picture it is cut off at the edge rather than rescaling the plot.
- The bottom panel shows the **eigenvalues of the Jacobian** at the two fixed points as points in the complex plane, with the unit circle $|\lambda| = 1$ dashed. Blue dots are for $(x^*, y^*)$ and black squares are for $(0, 0)$. Beside it are the values, their sizes and what kind of fixed point they make. The readout also prints the Jacobian matrix itself.
- **The eigenvalues can be dragged.** A black square slides along the real axis and sets $r$ or $s$. A blue dot slides only along its track, shaded in the panel: up and down the line $\operatorname{Re}\lambda = 1$, or apart along the real axis. That sets the product $(r-1)(s-1)$. The toggle under the figure says which of $r$ and $s$ changes while the other is held. Everything above redraws as you drag.
- When a population goes negative, the applet either **stops there** and marks the step with a red ✕, or **sets it to zero** and keeps going.
- **run the seasons** plays the run at four seasons per second, **one season** steps through it, and **reset to class values** (in the run row and again under the figure) puts everything back to the class setting: $r = 1.3$, $s = 0.8$, $\alpha = 0.02$, $\beta = 0.01$, start $(20, 10)$, $\Delta t = 1$, 60 seasons.
## Shorter seasons, and the continuous model
Write the map as a change per season,
$x_{n+1} - x_n = (r-1)\,x_n - \alpha\,x_n y_n, \qquad y_{n+1} - y_n = -(1-s)\,y_n + \beta\,x_n y_n.$
Now let the season last $\Delta t$ and let each change scale with it,
$x_{n+1} = x_n + \Delta t\,\big[(r-1)x_n - \alpha x_n y_n\big], \qquad y_{n+1} = y_n + \Delta t\,\big[-(1-s)y_n + \beta x_n y_n\big].$
At $\Delta t = 1$ this is the map from class. As $\Delta t \to 0$ it becomes the predator–prey system from Diffy Q,
$x' = (r-1)\,x - \alpha\,xy, \qquad y' = -(1-s)\,y + \beta\,xy.$
Read the other way, the seasonal map is one Euler step of size 1 for this system. The continuous system has a conserved quantity,
$H(x, y) = \beta x - (1-s)\ln x + \alpha y - (r-1)\ln y,$
since $\frac{d}{dt}H = \big(\beta - \tfrac{1-s}{x}\big)x' + \big(\alpha - \tfrac{r-1}{y}\big)y' = 0$. So its orbits are closed curves, level curves of $H$, and the populations repeat forever. The faint orbit in the applet is that closed curve through the starting point. The readout tracks $H$ along the seasonal run.
## The eigenvalues at the fixed points
The map has two fixed points, $(0, 0)$ and $(x^*, y^*)$. The Jacobian of one season is
$J(x, y) = \begin{pmatrix} r - \alpha y & -\alpha x \\ \beta y & s + \beta x \end{pmatrix}.$
At $(0, 0)$ it is diagonal, so the eigenvalues are $r$ and $s$. At $(x^*, y^*)$ the diagonal entries are both $1$ and
$J(x^*, y^*) = \begin{pmatrix} 1 & -\alpha x^* \\ \beta y^* & 1 \end{pmatrix}, \qquad \lambda = 1 \pm \sqrt{(r-1)(s-1)}.$
A fixed point attracts nearby states when every eigenvalue has $|\lambda| < 1$, and pushes them away along any direction with $|\lambda| > 1$. With seasons of length $\Delta t$ the eigenvalues become $1 + \Delta t(r-1)$, $1 + \Delta t(s-1)$ and $1 \pm \Delta t\sqrt{(r-1)(s-1)}$.
| $r$, $s$ | $(x^*, y^*)$ | eigenvalues at $(x^*, y^*)$ | at $(0, 0)$ | from $(20, 10)$ |
|---|---|---|---|---|
| $1.3$, $0.8$ (class) | $(20, 15)$ | $1 \pm 0.2449i$, spiral out | $1.3$, $0.8$, saddle | spirals out, prey negative at season 74 |
| $0.9$, $0.8$ | $(20, -5)$ | $1.1414$, $0.8586$, saddle | $0.9$, $0.8$, sink | both die out |
| $1.3$, $1.1$ | $(-10, 15)$ | $1.1732$, $0.8268$, saddle | $1.3$, $1.1$, source | prey negative at season 10 |
| $0.9$, $1.1$ | $(-10, -5)$ | $1 \pm 0.1i$, spiral out | $0.9$, $1.1$, saddle | prey negative at season 13 |
## Worked example, the class values from $(20, 10)$
- **The first season.** $x_1 = 1.3(20) - 0.02(20)(10) = 22$ and $y_1 = 0.8(10) + 0.01(20)(10) = 10$.
- **Sixty seasons.** The prey range over $[1.05, 55.11]$ and the predators over $[1.12, 42.28]$. The continuous orbit through the same start only ranges over $x \in [12.08, 30.80]$.
- **$H$ is not kept.** It starts at $-0.8899$ and is $-0.3905$ after 60 seasons. Along the continuous orbit (computed with a fourth-order Runge–Kutta method, step $0.01$) $H$ stays put to within $2 \times 10^{-14}$.
- **Season 74.** The predators reach $y_{73} \approx 86.49$, so $x_{74} = x_{73}(1.3 - 0.02 \cdot 86.49) \approx -29.29$. The prey population is negative.
| $\Delta t$ | $x$ over 60 time units | $y$ over 60 time units | $H$ at $t = 60$ |
|---|---|---|---|
| $1$ | $[1.05,\ 55.11]$ | $[1.12,\ 42.28]$ | $-0.3905$ |
| $0.5$ | $[6.64,\ 48.36]$ | $[5.74,\ 27.77]$ | $-0.7930$ |
| $0.1$ | $[11.14,\ 33.22]$ | $[9.29,\ 22.35]$ | $-0.8805$ |
| $0.01$ | $[11.99,\ 31.02]$ | $[9.93,\ 21.53]$ | $-0.8891$ |
| continuous | $[12.08,\ 30.80]$ | $[10.00,\ 21.44]$ | $-0.8899$ |
## Try these
> [!question] 1. Does it ever settle?
> With the class values, start right next to the fixed point, say at $(21, 15)$, and run 200 seasons. Does the run settle at $(20, 15)$, circle it forever, or do something else?
> [!success]- Answer
> It spirals outward. The eigenvalue panel shows why, with the two blue dots just outside the unit circle. Near the fixed point each season multiplies the distance from $(20, 15)$ by about $\sqrt{1 + (r-1)(1-s)} = \sqrt{1.06} \approx 1.0296$ and turns it by about $0.240$ radians, so a loop takes about 26 seasons and the spiral roughly doubles in size each loop (a factor $2.143$). From $(21, 15)$ the distance to the fixed point is $1$, then $2.16$, $4.71$ and $10.19$ at seasons $26$, $52$ and $78$, and at season $144$ the prey go negative. The Jacobian of the map at the fixed point is $\begin{pmatrix} 1 & -\alpha x^* \\ \beta y^* & 1 \end{pmatrix}$, with eigenvalues $1 \pm i\sqrt{(r-1)(1-s)}$. Their size is above 1 for every $r > 1$ and $0 < s < 1$, so this map never settles, whatever the parameters.
> [!question] 2. Why does it spiral when the continuous model does not?
> Turn on the continuous orbit and compare. Then drop $\Delta t$ to $0.5$, $0.1$ and $0.01$. What happens to the spiral, and to the change in $H$?
> [!success]- Answer
> Each Euler step heads off along the tangent to the closed curve it is on, and because $H$ is convex (bowl-shaped) the tangent always leads outside the curve. So $H$ goes up at every single step, for every $\Delta t$ in the table, and the orbit spirals out. Shorter seasons take smaller steps and the spiral tightens onto the closed orbit (see the table). Per loop the spiral grows by a factor $2.143$ at $\Delta t = 1$, $1.468$ at $0.5$, $1.080$ at $0.1$ and $1.008$ at $0.01$, while a loop takes about $26.2$, $25.8$, $25.7$ and $25.7$ time units, approaching the continuous model's $2\pi/\sqrt{(r-1)(1-s)} \approx 25.65$. Breeding in seasons is not a small correction here. It changes the long-run behavior from "repeats forever" to "swings get wider until something breaks."
> [!question] 3. Which population can go negative?
> Run 200 seasons with "stop there." Which population goes negative first? Could the other one ever go negative?
> [!success]- Answer
> The prey, at season 74. In one season the prey are multiplied by $r - \alpha y_n$, which is negative once $y_n > r/\alpha = 65$, and $y_{73} \approx 86.49$. The predators are multiplied by $s + \beta x_n$, which is at least $s > 0$ whenever $x_n \ge 0$, so the predators can never go negative. With shorter seasons the prey multiplier is $1 + \Delta t(r - 1 - \alpha y_n)$ and the threshold rises to $y > \big(1 + \Delta t(r-1)\big)/(\alpha\Delta t)$.
> [!question] 4. Stop, or set to zero?
> Switch to "set it to zero." What happens after season 74? Which choice do you think is the better model, and why?
> [!success]- Answer
> The prey are set to zero at season 74 and stay there, since $0$ times anything is $0$. With no prey the predators are multiplied by $s = 0.8$ each season and die out too, reaching about $8 \times 10^{-11}$ by season 200. Either choice is defensible. Stopping says the formula was never meant for a population that overshoots this badly. Setting to zero says a population that would have gone negative has been wiped out. Both are a statement about where the model stops being trustworthy, which is worth saying out loud in your own modeling.
> [!question] 5. Can they ever live together quietly?
> Use the sliders and the eigenvalue panel. Is there any choice of $r$ and $s$ for which $(x^*, y^*)$ is in the positive quadrant and attracts nearby states?
> [!success]- Answer
> No. $(x^*, y^*)$ is in the positive quadrant only when $r > 1$ and $s < 1$, the case from class. Then $(r-1)(s-1) < 0$, the eigenvalues are complex, $1 \pm i\sqrt{(r-1)(1-s)}$, and their size is $\sqrt{1 + (r-1)(1-s)} > 1$. So the blue dots always sit just outside the unit circle and the fixed point always pushes states away in a spiral. When $r$ and $s$ are on the same side of 1 the eigenvalues are real, one bigger than 1 and one smaller (a saddle), and $(x^*, y^*)$ has a negative coordinate anyway. The only fixed point that ever attracts is $(0, 0)$, when $r < 1$ and $s < 1$, and that is both species dying out.
> [!question] 6. Pull them inside
> Try to drag the blue dots inside the unit circle. Where can they go, and why can't they go anywhere else?
> [!success]- Answer
> They stay on the line $\operatorname{Re}\lambda = 1$ or on the real axis, spread evenly about $1$, because $\lambda = 1 \pm \sqrt{(r-1)(s-1)}$. On the line, every point except $\lambda = 1$ itself is outside the circle. On the real axis one of the two is always at least $1$. So no choice of $r$ and $s$ puts both inside, and $\alpha$ and $\beta$ do not move them at all. The model's structure, not the numbers, keeps $(x^*, y^*)$ from ever attracting.
> [!question] 7. Moving the fixed point
> Change $r$ from $1.3$ to $1.5$ and watch the dashed lines. Which one moved, and why that one?
> [!success]- Answer
> The green line moved, to $y^* = (r-1)/\alpha = 25$. The prey hold steady only when the predators eat exactly the prey's surplus, $\alpha y = r - 1$, so faster-growing prey can support more predators. The red line $x^* = (1-s)/\beta = 20$ does not depend on $r$ at all. It is set by the predators' needs, not the prey's growth. The same split holds in the continuous model.
## Credits
Built for MATH310 Fall 2026 from the predator–prey map at the end of Day 27.