Hutchinson
Hutchinson's delayed logistic equation.
- Class:
HutchinsonSystem - Import:
from skcomplex.systems.biology.ecology import HutchinsonSystem - Field:
biology/ecology - Topics:
population,delay,oscillation - References:
- Hutchinson 1948
- Erneux 2009
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.biology.ecology import HutchinsonSystem
trajectory = HutchinsonSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
n |
50.0 |
r |
1.0 |
K |
100.0 |
tau |
2.0 |
solver |
'auto' |
backend |
'auto' |
Tags
The system with its default parameters has these capability tags, which solvers and analyses check.
| Tag | Values |
|---|---|
| Time | continuous |
| Space | none |
| Laws | rate |
| Randomness | deterministic |
| Domains | real |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class HutchinsonSystem(BaseSystem):
"""Hutchinson's delayed logistic equation.
It oscillates around `K` when `r * tau` exceeds π/2.
The history before the start is the initial size. The system has the population `population`.
Args:
n:
The initial size, also its history.
r:
The per-capita growth rate at low density.
K:
The carrying capacity.
tau:
The delay of the density feedback.
label:
The label of the system, which names it when it is nested in another one.
solver:
The solver of the problem, or `'auto'` for the one the system chooses.
backend:
The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.
Examples:
>>> from skcomplex.systems.biology.ecology import HutchinsonSystem
>>> HutchinsonSystem(tau=1.0).prepare().system_.interactions[0].tau
1.0
"""
field = 'biology/ecology'
topics = ('population', 'delay', 'oscillation')
references = ('Hutchinson 1948', 'Erneux 2009')
until = 100.0
dt = 0.1
def __init__(
self,
n: float = 50.0,
*,
r: float = 1.0,
K: float = 100.0,
tau: float = 2.0,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.n = n
self.r = r
self.K = K
self.tau = tau
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of Hutchinson's delayed logistic equation.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
self.system_ = System(
self.label,
elements=[PopulationElement('population', x=self.n)],
interactions=[LogisticGrowthInteraction('growth', target='population', r=self.r, K=self.K, tau=self.tau)],
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
PopulationElement, fromElement, through the shared recipeNonnegativeElement
Interactions:
LogisticGrowthInteraction, fromInteraction
class PopulationElement(CompartmentElement):
"""Population of one species, a compartment whose state `x` holds its size.
Args:
label:
The label of the population.
x:
The initial size.
Examples:
>>> from skcomplex.systems.biology.common.populations import PopulationElement
>>> PopulationElement('rabbits', x=40).x
40
"""
def __init__(
self,
label: str,
*,
x: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
) -> None:
super().__init__(label, x=x)
class LogisticGrowthInteraction(GrowthInteraction):
"""Verhulst's growth limited by a carrying capacity, without harvest.
The population follows `dx/dt = r x (1 - x(t - tau) / K)`.
A delay `tau` above 0 gives Hutchinson's delayed logistic equation. The generalized logistic of Richards, with an
exponent on the crowding, is `GrowthInteraction(form='logistic', p=...)`.
Args:
label:
The label of the interaction.
target:
The path of the element or group whose population grows.
r:
The per capita growth rate at low density.
K:
The carrying capacity.
tau:
The delay of the limiting factor, 0 for none.
state:
The name of the state of the target that holds the population.
Examples:
>>> from skcomplex.systems.biology.common.kinetics import CompartmentElement
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.biology.common.populations import LogisticGrowthInteraction
>>> system = System(
... elements=[CompartmentElement('rabbits', x=1.0)],
... interactions=[LogisticGrowthInteraction('growth', target='rabbits', r=1.0, K=50.0)],
... )
>>> trajectory = system.prepare().simulate(until=30.0, dt=0.1)
>>> round(float(trajectory.get_values('rabbits.x')[-1]), 3)
50.0
"""
def __init__(
self,
label: str,
*,
target: Role,
r: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
K: Annotated[float, RealSet.open(0, oo)] = 100.0,
tau: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
state: str = 'x',
) -> None:
super().__init__(label, target=target, r=r, K=K, tau=tau, form='logistic', state=state)
def _get_crowding(self, namespace: SimpleNamespace) -> Expression:
"""Return the crowding `x / K` of Verhulst's logistic.
Args:
namespace:
The namespace of the symbols the rate can use, with the namespace of the target.
Returns:
crowding:
The ratio of the population the limiting factor reads to the capacity.
"""
crowding: Expression = self._get_limited(namespace) / self._get_capacity(namespace)
return crowding
def _get_rate(self, namespace: SimpleNamespace) -> Expression:
"""Return the logistic growth, with no harvest.
Args:
namespace:
The namespace of the symbols the rate can use, with the namespace of the target.
Returns:
rate:
The rate of the population.
"""
return self._get_growth(namespace)
Equations
The equations are those that symbolic returns for the system with its default parameters.
population.x: diff(x_population(t), t) == -r_growth*(x_population(t - tau_growth)/K_growth - 1)*x_population(t)