Skip to content

Gompertz growth

A tumour whose growth slows as the logarithm of the room left.

  • Class: GompertzSystem
  • Import: from skcomplex.systems.biology.oncology import GompertzSystem
  • Field: biology/oncology
  • Topics: tumour growth, ode, sigmoid
  • References:
    • Padmanabhan, Meskin, and Al Moustafa 2021
    • Benzekry et al. 2014
    • Gompertz 1825

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.oncology import GompertzSystem

trajectory = GompertzSystem().prepare().simulate()

Parameters

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

Parameter Default
n 10.0
r 0.0719
K 1964.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 GompertzSystem(BaseSystem):
    """A tumour whose growth slows as the logarithm of the room left.

    The growth is `dn/dt = r n log(K / n)`.

    The volume follows `K exp(log(n0 / K) exp(-r t))` and tends to `K`. The rate is the fitted decay of the
    proliferation of breast cancer, per day, and the capacity is in mm³. The system has the volume `tumour.x`.

    Args:
        n:
            The initial volume.

        r:
            The rate at which the growth slows.

        K:
            The carrying capacity.

        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.oncology import GompertzSystem
        >>> GompertzSystem(K=1000.0).prepare().system_.interactions[0].K
        1000.0
    """

    field = 'biology/oncology'
    topics = ('tumour growth', 'ode', 'sigmoid')
    references = (*GROWTH_REFERENCES, 'Gompertz 1825')
    until = 100.0
    dt = 0.5

    def __init__(
        self,
        n: float = 10.0,
        *,
        r: float = 0.0719,
        K: float = 1964.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

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of a tumour whose growth slows as the room left shrinks.

        The growth slows as the logarithm of the room left.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        self.system_ = System(
            self.label,
            elements=[PopulationElement('tumour', x=self.n)],
            interactions=[GompertzGrowthInteraction('growth', target='tumour', r=self.r, K=self.K)],
        )

Components

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

Elements:

Interactions:

  • GompertzGrowthInteraction, from Interaction
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 GompertzGrowthInteraction(GrowthInteraction):
    """Gompertz growth towards a capacity, without harvest.

    The growth is `dx/dt = r x log(K / x(t - tau))`.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the element or group whose population grows.

        r:
            The growth rate.

        K:
            The 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.oncology import GompertzGrowthInteraction
        >>> system = System(
        ...     elements=[CompartmentElement('tumour', x=1.0)],
        ...     interactions=[GompertzGrowthInteraction('growth', target='tumour', r=1.0, K=20.0)],
        ... )
        >>> trajectory = system.prepare().simulate(until=30.0, dt=0.1)
        >>> round(float(trajectory.get_values('tumour.x')[-1]), 3)
        20.0
    """

    def __init__(
        self,
        label: str,
        *,
        target: Role,
        r: Annotated[float, RealSet.open(0, oo)] = 0.0719,
        K: Annotated[float, RealSet.open(0, oo)] = 1964.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='gompertz', state=state)

    def _get_rate(self, namespace: SimpleNamespace) -> Expression:
        """Return the Gompertz 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.

tumour.x: diff(x_tumour(t), t) == r_growth*log(K_growth/x_tumour(t))*x_tumour(t)