<!-- Source: https://docs.biosimulant.com/examples/ecology-lotka-volterra -->

# Ecology: Lotka–Volterra

The classic predator–prey oscillator. **Prey grow on their own, predators decline without food, and chance encounters couple the two populations** into the canonical boom-bust cycle.

## What it simulates

- Prey reproduce when predators are scarce.
- Predator–prey encounters reduce prey and feed predator reproduction.
- Predators decline without prey.
- The system circles a non-zero equilibrium at `N* = gamma/delta`, `P* = alpha/beta`.
- An invariant-drift audit checks that the numerical integrator is faithful to the conserved quantity.

![Lotka-Volterra population trajectories and phase portrait](/images/examples/ecology-lotka-volterra/lotka-volterra-canvas-results.png)

## Run it on the Hub

1. Open the [Lotka–Volterra System Lab](https://hub.biosimulant.com/labs/52e99dd4-17c7-47a5-b8bc-e59319d71b25) on the public Hub.
2. Click **Run**. The default scenario runs for 250 days.

## Inputs you can tune

| Input | Meaning |
|---|---|
| `prey_initial_population` | Starting prey count. |
| `predator_initial_population` | Starting predator count. |
| `prey_growth_rate` | Prey growth in the absence of predators. |
| `predation_rate` | How strongly predator–prey encounters reduce prey. |
| `predator_mortality_rate` | Predator decline without prey. |
| `predator_reproduction_rate` | How prey encounters add to predators. |

## What results to expect

- **Population trajectory**: lagged predator–prey oscillations.
- **Phase portrait**: a closed loop around the non-zero equilibrium, with start/end markers and the `dN/dt = 0` and `dP/dt = 0` nullclines.
- **Summary table**: parameters, equilibrium, final populations, min/max ranges, and an estimated cycle period.
- **Invariant-drift audit**: a numerical-quality check; large drift means the integration step is too coarse.

![Lotka-Volterra summary table and invariant drift diagnostics](/images/examples/ecology-lotka-volterra/lotka-volterra-summary-diagnostics.png)

**Info:**

  Source on GitHub: [models-ecology — lotka-volterra-system](https://github.com/Biosimulant/models-ecology/tree/main/labs/ecology-lotka-volterra-system). For carrying capacity, seasons, disease, or migration, use the Rosenzweig–MacArthur lab instead.
