Skip to content

Coupled Rössler and the master stability function

Chaotic Rössler oscillators on a ring.

  • Class: CoupledRosslerSystem
  • Import: from skcomplex.systems.physics.synchronization import CoupledRosslerSystem
  • Field: physics/synchronization
  • Topics: synchronization, chaos, ode, master stability function, networks
  • References:
    • Rössler 1976
    • Pecora and Carroll 1998
    • Datseris and Parlitz 2022
    • Arenas et al. 2008

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.synchronization import CoupledRosslerSystem

trajectory = CoupledRosslerSystem().prepare().simulate()

Parameters

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

Parameter Default
n_oscillators 2
k 0.04
mismatch 0.02
a 0.2
b 0.2
c 5.7
seed 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 CoupledRosslerSystem(BaseSystem):
    """Chaotic Rössler oscillators on a ring.

    The oscillators are diffusively coupled through their second variable.

    Oscillator `i` follows `x1' = -ω_i x2 - x3`, `x2' = ω_i x1 + a x2 + k sum_j (x2_j - x2_i)`, and `x3' = b + x3 (x1 -
    c)`, summed over its neighbours on the ring. Two oscillators with frequencies `1 ± mismatch` pass from no
    synchronization to chaotic phase synchronization as `k` grows. Identical oscillators, with no mismatch, synchronize
    completely when every nonzero eigenvalue of the ring's Laplacian times `k` falls where the master stability function
    is negative. The system has the states `oscillator_<i>.x1`, `oscillator_<i>.x2`, and `oscillator_<i>.x3`.

    Args:
        n_oscillators:
            The number of oscillators on the ring.

        k:
            The coupling strength.

        mismatch:
            The half width of the interval of natural frequencies around 1.

        a:
            The first Rössler parameter.

        b:
            The second Rössler parameter.

        c:
            The third Rössler parameter.

        seed:
            The seed of the initial states.

        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.synchronization import CoupledRosslerSystem
        >>> trajectory = CoupledRosslerSystem(k=0.5, mismatch=0.0).prepare().simulate(until=80.0)
        >>> first, second = trajectory.get_values('oscillator_0.x1'), trajectory.get_values('oscillator_1.x1')
        >>> bool(abs(first[-1] - second[-1]) < 1e-4)
        True
    """

    field = 'physics/synchronization'
    topics = ('synchronization', 'chaos', 'ode', 'master stability function', 'networks')
    references = ('Rössler 1976', 'Pecora and Carroll 1998', 'Datseris and Parlitz 2022', 'Arenas et al. 2008')
    until = 100.0
    dt = 0.1

    def __init__(
        self,
        n_oscillators: int = 2,
        *,
        k: float = 0.04,
        mismatch: float = 0.02,
        a: float = 0.2,
        b: float = 0.2,
        c: float = 5.7,
        seed: int = 0,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.n_oscillators = n_oscillators
        self.k = k
        self.mismatch = mismatch
        self.a = a
        self.b = b
        self.c = c
        self.seed = seed

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of chaotic Rössler oscillators on a ring.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        omegas = np.linspace(1 - self.mismatch, 1 + self.mismatch, self.n_oscillators)
        starts = np.random.default_rng(self.seed).uniform(-1.0, 1.0, (self.n_oscillators, 2))
        oscillators = [
            RosslerOscillatorElement(f'oscillator_{index}', x1=float(starts[index, 0]), x2=float(starts[index, 1]))
            for index in range(self.n_oscillators)
        ]
        flows: list[Interaction] = [
            RosslerFlowInteraction(
                f'flow_{index}',
                target=f'oscillator_{index}',
                omega=round(float(omegas[index]), 12),
                a=self.a,
                b=self.b,
                c=self.c,
            )
            for index in range(self.n_oscillators)
        ]
        links = [(index, index + 1) for index in range(self.n_oscillators - 1)]
        if self.n_oscillators > PAIR:
            links.append((self.n_oscillators - 1, 0))
        couplings = [
            DiffusiveCouplingInteraction(
                f'coupling_{source}_{target}',
                source=f'oscillator_{source}',
                target=f'oscillator_{target}',
                k=self.k,
            )
            for first, second in links
            for source, target in ((first, second), (second, first))
        ]
        self.system_ = System(self.label, elements=oscillators, interactions=[*flows, *couplings])

Components

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

Elements:

  • RosslerOscillatorElement, from Element

Interactions:

  • RosslerFlowInteraction, from Interaction
  • DiffusiveCouplingInteraction, from Interaction
class RosslerOscillatorElement(Element):
    """Rössler oscillator with the three variables `x1`, `x2`, and `x3`.

    `RosslerFlowInteraction` moves the variables.

    Args:
        label:
            The label of the oscillator.

        x1:
            The initial first variable.

        x2:
            The initial second variable.

        x3:
            The initial third variable.

    Examples:
        >>> from skcomplex.systems.physics.synchronization import RosslerOscillatorElement
        >>> RosslerOscillatorElement('oscillator', x1=2.0).x1
        2.0
    """

    def __init__(self, label: str, *, x1: float = 1.0, x2: float = 0.0, x3: float = 0.0) -> None:
        super().__init__(label)
        self.x1 = x1
        self.x2 = x2
        self.x3 = x3

class RosslerFlowInteraction(Interaction):
    """Rössler flow `x1' = -omega x2 - x3`, `x2' = omega x1 + a x2`, `x3' = b + x3 (x1 - c)`.

    The flow is chaotic for `a = b = 0.2` and `c = 5.7`. The time scale `p` divides every rate, `p x' = f(x)`, so `p <
    1` speeds the oscillator up.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the oscillator whose variables `x1`, `x2`, and `x3` the flow moves.

        omega:
            The natural frequency.

        a:
            The first Rössler parameter.

        b:
            The second Rössler parameter.

        c:
            The third Rössler parameter.

        p:
            The time scale, which divides every rate.

    Examples:
        >>> from skcomplex.systems.physics.synchronization import RosslerFlowInteraction
        >>> RosslerFlowInteraction('flow', target='oscillator').c
        5.7
    """

    law_classes = (RateLaw,)

    def __init__(
        self,
        label: str,
        *,
        target: Role,
        omega: float = 1.0,
        a: float = 0.2,
        b: float = 0.2,
        c: float = 5.7,
        p: Annotated[float, RealSet.open(0, oo)] = 1.0,
    ) -> None:
        super().__init__(label)
        self.target = target
        self.omega = omega
        self.a = a
        self.b = b
        self.c = c
        self.p = p

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the rates of the three variables of the target.

        Args:
            context:
                The namespace of the target, the time `t`, and the parameters.
        """
        super()._prepare(context)
        s, t = context, context.t
        x1, x2, x3 = s.target.x1, s.target.x2, s.target.x3
        self.laws_ = [
            RateLaw(x1.diff(t), (-s.omega * x2 - x3) / s.p),
            RateLaw(x2.diff(t), (s.omega * x1 + s.a * x2) / s.p),
            RateLaw(x3.diff(t), (s.b + x3 * (x1 - s.c)) / s.p),
        ]

class DiffusiveCouplingInteraction(Interaction):
    """Diffusive coupling of a state of one element to the same state of another.

    The coupling is `x_t' += k (x_s - x_t)`.

    Args:
        label:
            The label of the interaction, unique among the components of its system.

        source:
            The path of the element whose state the coupling reads.

        target:
            The path of the element whose state the coupling changes.

        state:
            The name of the coupled state.

        k:
            The coupling strength.

    Examples:
        >>> from skcomplex.systems.physics.synchronization import DiffusiveCouplingInteraction
        >>> DiffusiveCouplingInteraction('coupling', source='a', target='b', k=0.5).k
        0.5
    """

    law_classes = (RateLaw,)

    def __init__(
        self,
        label: str,
        *,
        source: Role,
        target: Role,
        state: str = 'x2',
        k: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
    ) -> None:
        super().__init__(label)
        self.source = source
        self.target = target
        self.state = state
        self.k = k

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the rate `k (x_s - x_t)` of the state of the target.

        Args:
            context:
                The namespace of the source, the target, the time `t`, and the parameters.
        """
        super()._prepare(context)
        x = getattr(context.target, self.state)
        self.laws_ = [RateLaw(x.diff(context.t), context.k * (getattr(context.source, self.state) - x))]

Equations

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

oscillator_0.x1: diff(x1_oscillator_0(t), t) == -(omega_flow_0*x2_oscillator_0(t) + x3_oscillator_0(t))/p_flow_0
oscillator_0.x2: diff(x2_oscillator_0(t), t) == -k_coupling_1_0*(x2_oscillator_0(t) - x2_oscillator_1(t)) + (omega_flow_0*x1_oscillator_0(t) + a_flow_0*x2_oscillator_0(t))/p_flow_0
oscillator_0.x3: diff(x3_oscillator_0(t), t) == -((c_flow_0 - x1_oscillator_0(t))*x3_oscillator_0(t) - b_flow_0)/p_flow_0
oscillator_1.x1: diff(x1_oscillator_1(t), t) == -(omega_flow_1*x2_oscillator_1(t) + x3_oscillator_1(t))/p_flow_1
oscillator_1.x2: diff(x2_oscillator_1(t), t) == k_coupling_0_1*(x2_oscillator_0(t) - x2_oscillator_1(t)) + (omega_flow_1*x1_oscillator_1(t) + a_flow_1*x2_oscillator_1(t))/p_flow_1
oscillator_1.x3: diff(x3_oscillator_1(t), t) == -((c_flow_1 - x1_oscillator_1(t))*x3_oscillator_1(t) - b_flow_1)/p_flow_1