Skip to content

Stochastic fold with a ramped control parameter

A stochastic fold whose control is ramped through a tipping point.

  • Class: RampedStochasticFoldSystem
  • Import: from skcomplex.systems.physics.climate import RampedStochasticFoldSystem
  • Field: physics/climate
  • Topics: tipping points, fold, ramp, sde, early warning signals, critical slowing down
  • References:
    • Fang, Wang, Kurths, and Fan 2025
    • Scheffer et al. 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.physics.climate import RampedStochasticFoldSystem

trajectory = RampedStochasticFoldSystem().prepare().simulate()

Parameters

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

Parameter Default
rate 0.004
sigma 0.02
a -1.0
b 1.0
phi0 -1.0
phi1 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 noise, rate
Randomness stochastic
Domains real
Structure fixed

Class

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

class RampedStochasticFoldSystem(BaseSystem):
    """A stochastic fold whose control is ramped through a tipping point.

    The tipping point is that of its lower branch.

    The state follows `dx = (a x^3 + b x + phi(t)) dt + sigma dW` with `phi = phi0 + rate t` until it reaches `phi1`,
    Eq. 4 of Fang et al. with `phi = -1 + 0.004 t`. It starts on the lower branch, which vanishes at the static fold
    `phi_c = sqrt(-4 b^3 / (27 a))`, `2 / (3 sqrt(3))` for `a = -1` and `b = 1`. Near the fold, recovery slows down, so
    the variance and the lag-1 autocorrelation of the state rise. A ramp faster than the relaxation carries the control
    past `phi_c` before the state tips, by a lag that grows with the rate. The system has the state `system.x`, starting
    on the lower branch at `phi0`.

    Args:
        rate:
            The rate at which the control rises.

        sigma:
            The amplitude of the noise.

        a:
            The cubic coefficient, negative.

        b:
            The linear coefficient, positive.

        phi0:
            The initial control.

        phi1:
            The final control.

        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.physics.climate import RampedStochasticFoldSystem
        >>> RampedStochasticFoldSystem(rate=0.01).prepare().system_.interactions[0].rate
        0.01
    """

    field = 'physics/climate'
    topics = ('tipping points', 'fold', 'ramp', 'sde', 'early warning signals', 'critical slowing down')
    references = ('Fang, Wang, Kurths, and Fan 2025', 'Scheffer et al. 2009')
    until = 500.0
    dt = 0.5

    @staticmethod
    def _lower_branch(a: float, b: float, phi: float) -> float:
        """Return the lowest real root of `a x^3 + b x + phi`.

        The root is the lower branch of the fold.
        """
        roots = np.roots([a, 0.0, b, phi])
        return float(min(root.real for root in roots if abs(root.imag) < REAL_TOLERANCE))

    def __init__(
        self,
        *,
        rate: float = 0.004,
        sigma: float = 0.02,
        a: float = -1.0,
        b: float = 1.0,
        phi0: float = -1.0,
        phi1: float = 1.0,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.rate = rate
        self.sigma = sigma
        self.a = a
        self.b = b
        self.phi0 = phi0
        self.phi1 = phi1

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of a stochastic fold ramped through the tipping point of its lower branch.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        fold = RampedFoldElement('system', x=RampedStochasticFoldSystem._lower_branch(self.a, self.b, self.phi0))
        ramped = RampedFoldInteraction(
            'fold',
            target='system',
            a=self.a,
            b=self.b,
            sigma=self.sigma,
            phi0=self.phi0,
            phi1=self.phi1,
            rate=self.rate,
        )
        self.system_ = System(self.label, elements=[fold], interactions=[ramped], solver=EulerMaruyamaSolver(dt=0.01))

Components

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

Elements:

Interactions:

  • RampedFoldInteraction, from Interaction
class RampedFoldElement(Element):
    """Element in the normal form of a fold whose control is ramped, its state `x`.

    Args:
        label:
            The label of the element.

        x:
            The initial state.

    Examples:
        >>> from skcomplex.systems.physics.climate import RampedFoldElement
        >>> RampedFoldElement('system').x
        -1.3247
    """

    def __init__(self, label: str, *, x: float = -1.3247) -> None:
        super().__init__(label)
        self.x = x

class RampedFoldInteraction(Interaction):
    """Stochastic fold `dx = (a x^3 + b x + phi(t)) dt + sigma dW` whose control rises from `phi0` to `phi1`.

    For `a < 0 < b` the fold has two stable branches for `|phi| < phi_c = sqrt(-4 b^3 / (27 a))`, and the lower
    branch vanishes at `phi = phi_c`. The control rises at the rate `rate` and stays at `phi1` once it reaches it.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the element.

        a:
            The cubic coefficient, negative.

        b:
            The linear coefficient, positive.

        sigma:
            The amplitude of the noise.

        phi0:
            The initial control.

        phi1:
            The final control.

        rate:
            The rate at which the control rises.

    Examples:
        >>> from skcomplex.systems.physics.climate import RampedFoldInteraction
        >>> RampedFoldInteraction('fold', target='system').rate
        0.004
    """

    law_classes = (NoiseLaw, RateLaw)

    def __init__(
        self,
        label: str,
        *,
        target: Role,
        a: float = -1.0,
        b: float = 1.0,
        sigma: Annotated[float, NONNEGATIVE] = 0.02,
        phi0: float = -1.0,
        phi1: float = 1.0,
        rate: float = 0.004,
    ) -> None:
        super().__init__(label)
        self.target = target
        self.a = a
        self.b = b
        self.sigma = sigma
        self.phi0 = phi0
        self.phi1 = phi1
        self.rate = rate

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the fold with its ramped control and its noise.

        Args:
            context:
                The namespace of the element, the time `t`, and the parameters.
        """
        super()._prepare(context)
        x, t = context.target.x, context.t
        control = self.phi0 + ramp(t, 0.0, (self.phi1 - self.phi0) / self.rate, self.phi1 - self.phi0)
        self.laws_ = [RateLaw(x.diff(t), context.a * x**3 + context.b * x + control), NoiseLaw(x, context.sigma)]

Equations

The equations are those that symbolic returns for the system with its default parameters.

system.x: diff(x_system(t), t) == a_fold*x_system(t)^3 + b_fold*x_system(t) + where(t < 0.0, 0, where(t < 500.0, 0.004*t, 2.0)) - 1.0