Skip to content

Poisson process

Independent Poisson processes.

  • Class: PoissonProcessSystem
  • Import: from skcomplex.systems.mathematics.stochastic_processes import PoissonProcessSystem
  • Field: mathematics/stochastic_processes
  • Topics: counting process, jump process, waiting times
  • References:
    • Thurner et al. 2018

Use this system

The block imports the class and simulates the system with its default parameters and its tuned run settings.

from skcomplex.systems.mathematics.stochastic_processes import PoissonProcessSystem

trajectory = PoissonProcessSystem().prepare().simulate()

Parameters

The model parameters take these defaults, and set_params changes them.

Parameter Default
n_processes 20
rate 1.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 jump
Randomness stochastic
Domains integer
Structure fixed

Class

The source of the class shows how it builds its components from its model parameters.

class PoissonProcessSystem(BaseSystem):
    """Independent Poisson processes.

    The counters grow by one at exponentially distributed waiting times.

    The system has the counts `counters.count`.

    Args:
        n_processes:
            The number of independent counters.

        rate:
            The rate of events of a counter.

        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.mathematics.stochastic_processes import PoissonProcessSystem
        >>> PoissonProcessSystem(5).prepare().system_.elements[0].size
        5
    """

    field = 'mathematics/stochastic_processes'
    topics = ('counting process', 'jump process', 'waiting times')
    references = ('Thurner et al. 2018',)
    until = 50.0
    dt = 1.0

    def __init__(
        self,
        n_processes: int = 20,
        *,
        rate: float = 1.0,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.n_processes = n_processes
        self.rate = rate

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of the counters and their events."""
        super()._prepare(context)
        self.system_ = System(
            self.label,
            elements=[PoissonCounterElement('counters', size=self.n_processes)],
            interactions=[PoissonEventsInteraction('events', target='counters', rate=self.rate)],
        )

Components

The system uses these element and interaction classes, each with its nearest class of the core.

Elements:

  • PoissonCounterElement, from Element

Interactions:

  • PoissonEventsInteraction, from Interaction
class PoissonCounterElement(Element):
    """Counters of the events of Poisson processes, one count per process.

    Args:
        label:
            The label of the counters.

        count:
            The initial number of events, one per counter or shared.

        size:
            The number of counters, or `None` for one.

    Examples:
        >>> from skcomplex.systems.mathematics.stochastic_processes import PoissonCounterElement
        >>> PoissonCounterElement('counter', count=2.0).count
        2.0
    """

    def __init__(self, label: str, *, count: Annotated[float, NN] = 0.0, size: int | None = None) -> None:
        super().__init__(label, size=size)
        self.count = count

class PoissonEventsInteraction(Interaction):
    """The events of a Poisson process, which add one to a count at the rate `rate`.

    Args:
        label:
            The label of the interaction.

        target:
            The counters whose counts the events add to.

        rate:
            The rate of the events.

    Examples:
        >>> from skcomplex.systems.mathematics.stochastic_processes import PoissonEventsInteraction
        >>> PoissonEventsInteraction('events', target='counters', rate=2.0).rate
        2.0
    """

    law_classes = (JumpLaw,)

    def __init__(self, label: str, *, target: Role = 'counters', rate: float = 1.0) -> None:
        super().__init__(label)
        self.target = target
        self.rate = rate

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the event that adds one to the count as the law.

        Args:
            context:
                The namespace of the elements a binding of the roles names.
        """
        super()._prepare(context)
        self.laws_: list[BaseLaw] = [JumpLaw(context.rate, {context.target.count: 1})]