Ricker map of overcompensating generations
Ricker's map of a population in discrete generations, n' = r n exp(-n).
- Class:
RickerSystem - Import:
from skcomplex.systems.biology.ecology import RickerSystem - Field:
biology/ecology - Topics:
population,discrete map,period doubling,chaos - References:
- Ricker 1954
- Dilão 2023
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 RickerSystem
trajectory = RickerSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
n |
0.5 |
r |
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 | discrete |
| Space | none |
| Laws | update |
| Randomness | deterministic |
| Domains | real |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class RickerSystem(BaseSystem):
"""Ricker's map of a population in discrete generations, `n' = r n exp(-n)`.
It is chaotic for large `r`.
The positive fixed point `n = ln r` is stable while `1 < r < e^2`. Beyond `e^2`, about 7.39, it loses stability to a
two-cycle, and further period doublings lead to chaos near `r = 14.8`. The size stays positive for every `r`. The
system has the population `population.x`.
Args:
n:
The initial size, in units of the density at which the offspring peak.
r:
The growth factor at low density.
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 RickerSystem
>>> RickerSystem(r=12.0).prepare().system_.interactions[0].r
12.0
"""
field = 'biology/ecology'
topics = ('population', 'discrete map', 'period doubling', 'chaos')
references = ('Ricker 1954', 'Dilão 2023')
until = 100
dt = 1
def __init__(
self,
n: float = 0.5,
*,
r: 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
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of Ricker's map of a population in discrete generations.
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=[RickerGrowthInteraction('growth', target='population', r=self.r)],
)
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:
RickerGrowthInteraction, 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 RickerGrowthInteraction(Interaction):
"""Ricker growth of a population in discrete generations, `x' = r x exp(-x)`.
It overcompensates at high density.
The size `x` is in units of the density at which the offspring of a generation peak, so a crowded generation
leaves fewer offspring than a sparser one.
Args:
label:
The label of the interaction.
target:
The path of the population.
r:
The growth factor at low density.
Examples:
>>> from skcomplex.systems.biology.ecology import RickerGrowthInteraction
>>> RickerGrowthInteraction('growth', target='fish', r=12.0).r
12.0
"""
law_classes = (UpdateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
r: Annotated[float, RealSet.closed_open(0, oo)] = 2.0,
) -> None:
super().__init__(label)
self.target = target
self.r = r
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the next generation `r x exp(-x)`.
Args:
context:
The namespace of the bound elements, the time `t`, and the parameters.
"""
super()._prepare(context)
s = context
n = s.target.x
self.laws_ = [UpdateLaw(n, s.r * n * exp(-n))]
Equations
The equations are those that symbolic returns for the system with its default parameters.
population.x: x_population(t + 1) == r_growth*e^(-x_population(t))*x_population(t)