Aggregate-averaging synchronization of logistic and delay-coupled Bernoulli maps
Two chaotic maps coupled by aggregate averaging.
- Class:
AggregateAveragingSynchronizationSystem - Import:
from skcomplex.systems.physics.synchronization import AggregateAveragingSynchronizationSystem - Field:
physics/synchronization - Topics:
synchronization,chaos,map,logistic map,bernoulli map,delay - References:
- Gros 2015
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 AggregateAveragingSynchronizationSystem
trajectory = AggregateAveragingSynchronizationSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
x1 |
0.3 |
x2 |
0.6 |
r |
4.0 |
kappa |
0.4 |
kind |
'logistic' |
delay |
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 AggregateAveragingSynchronizationSystem(BaseSystem):
"""Two chaotic maps coupled by aggregate averaging.
The maps synchronize their chaos for strong coupling.
Each map iterates on the aggregate of its own value and the other's, `x_i(t + 1) = f(a_i)` with `a_1 = (1 - kappa)
x_1(t) + kappa x_2(t - T)` and `a_2 = (1 - kappa) x_2(t) + kappa x_1(t - T)`, for the delay `T`. The logistic map is
`f(a) = r a (1 - a)`. Without delay, its synchronized orbit is stable for `kappa > (r - 1) / (2 r)`, which is `3 /
8` for `r = 4`, and the maps agree in one step for `kappa = 1 / 2`. The Bernoulli shift `f(a) = r a mod 1` has the
constant slope `r`, so a difference `d` of the maps follows `d(t + 1) = r ((1 - kappa) d(t) - kappa d(t - T))`
exactly, and the maps synchronize when every root of `z^(T + 1) - r (1 - kappa) z^T + r kappa` lies in the unit
disk, which for `T = 0` is `|r (1 - 2 kappa)| < 1`. The delay shrinks the window of synchronizing couplings: for `r
= 1.5` it is `0.17 < kappa < 0.83` without delay, `0.17 < kappa < 0.66` for `T = 1`, and `0.17 < kappa < 0.44` for
`T = 2`, and it closes for `T >= 5`. Before the start, the delayed values equal the initial values. An integer slope
such as 2 loses one binary digit of the value per step in floating point and falls onto 0, so a slope that is not an
integer, such as 1.5, keeps the chaos. The system has the values `first.x` and `second.x`, and their past values
`first.x[-<j>]` and `second.x[-<j>]` for a delay.
Args:
x1:
The initial value of the first map.
x2:
The initial value of the second map.
r:
The growth rate of the logistic map.
kappa:
The coupling strength.
kind:
The map, `'logistic'` or `'bernoulli'`.
delay:
The delay `T` of the coupling, in steps.
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 AggregateAveragingSynchronizationSystem
>>> trajectory = AggregateAveragingSynchronizationSystem(kappa=0.5).prepare().simulate(until=2)
>>> bool(trajectory.get_values('first.x')[-1] == trajectory.get_values('second.x')[-1])
True
"""
field = 'physics/synchronization'
topics = ('synchronization', 'chaos', 'map', 'logistic map', 'bernoulli map', 'delay')
references = ('Gros 2015',)
until = 50
dt = 1
def __init__(
self,
x1: float = 0.3,
x2: float = 0.6,
*,
r: float = 4.0,
kappa: float = 0.4,
kind: str = 'logistic',
delay: int = 0,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.x1 = x1
self.x2 = x2
self.r = r
self.kappa = kappa
self.kind = kind
self.delay = delay
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of two chaotic maps coupled by aggregate averaging.
Before the start, the delayed values equal the initial values.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
lags = range(1, self.delay + 1) if isinstance(self.delay, int) else range(0)
units = [
LogisticUnitElement(label, x=value, values={f'x[-{lag}]': value for lag in lags} or None)
for label, value in (('first', self.x1), ('second', self.x2))
]
averaging = [
AggregateAveragingInteraction(
f'averaging_{target}',
source=source,
target=target,
r=self.r,
kappa=self.kappa,
kind=self.kind,
delay=self.delay,
)
for source, target in (('second', 'first'), ('first', 'second'))
]
self.system_ = System(self.label, elements=units, interactions=averaging)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
LogisticUnitElement, fromElement
Interactions:
AggregateAveragingInteraction, fromInteraction
class LogisticUnitElement(Element):
"""Value `x` in `[0, 1]` of a logistic map.
The maps of the coupling iterate the value.
Args:
label:
The label of the unit.
x:
The initial value.
values:
Further values by name, such as the past values `'x[-1]'` that a delayed coupling reads, or `None`.
Examples:
>>> from skcomplex.systems.physics.synchronization import LogisticUnitElement
>>> LogisticUnitElement('unit').x
0.3
"""
def __init__(self, label: str, *, x: float = 0.3, values: Mapping[str, object] | None = None) -> None:
super().__init__(label, values=values)
self.x = x
class AggregateAveragingInteraction(Interaction):
"""Logistic or Bernoulli map of an aggregate of a target value and a source value.
The value of the source is possibly delayed.
The map sets `x_t(t + 1) = f(a)` with the aggregate `a = (1 - kappa) x_t(t) + kappa x_s(t - delay)`, and with the
logistic map `f(a) = r a (1 - a)` or the Bernoulli shift `f(a) = r a mod 1`. A delayed source reads its past values.
Args:
label:
The label of the interaction, unique among the components of its system.
source:
The path of the unit whose value the aggregate reads.
target:
The path of the unit whose value the map sets.
r:
The growth rate of the logistic map.
kappa:
The weight of the source in the aggregate.
kind:
The map, `'logistic'` or `'bernoulli'`.
delay:
The number of steps by which the source is delayed.
Raises:
ValidationError:
The map is unknown, or the delay is not a nonnegative integer.
Examples:
>>> from skcomplex.systems.physics.synchronization import AggregateAveragingInteraction
>>> AggregateAveragingInteraction('averaging', source='a', target='b', kind='bernoulli').kind
'bernoulli'
"""
law_classes = (UpdateLaw,)
def __init__(
self,
label: str,
*,
source: Role,
target: Role,
r: Annotated[float, RealSet.closed_open(0, oo)] = 4.0,
kappa: Annotated[float, RealSet.closed_open(0, oo)] = 0.4,
kind: str = 'logistic',
delay: int = 0,
) -> None:
super().__init__(label)
self.source = source
self.target = target
self.r = r
self.kappa = kappa
self.kind = kind
self.delay = delay
def _check_arguments(self) -> None:
"""Raise an error for an argument the interaction cannot take.
Raises:
ValidationError:
The map is unknown, or the delay is not a nonnegative integer.
"""
super()._check_arguments()
if self.kind not in MAPS:
error_msg = f'Unknown map {self.kind!r}. Use one of {", ".join(MAPS)}.'
raise ValidationError(error_msg)
if isinstance(self.delay, bool) or not isinstance(self.delay, int) or self.delay < 0:
error_msg = f'The delay of {self.label!r} is {self.delay!r}. Give a nonnegative integer.'
raise ValidationError(error_msg)
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the map of the aggregate `a = (1 - kappa) x_t + kappa x_s(t - delay)`.
Args:
context:
The namespace of the source, the target, the time `t`, and the parameters.
"""
super()._prepare(context)
x, t = context.target.x, context.t
source = context.source.x(t=t - self.delay) if self.delay else context.source.x
aggregate = (1 - context.kappa) * x + context.kappa * source
if self.kind == 'bernoulli':
self.laws_ = [UpdateLaw(x, mod(context.r * aggregate, 1))]
return
self.laws_ = [UpdateLaw(x, context.r * aggregate * (1 - aggregate))]
Equations
The equations are those that symbolic returns for the system with its default parameters.
first.x: x_first(t + 1) == -((kappa_averaging_first - 1)*x_first(t) - kappa_averaging_first*x_second(t) + 1)*((kappa_averaging_first - 1)*x_first(t) - kappa_averaging_first*x_second(t))*r_averaging_first
second.x: x_second(t + 1) == -(kappa_averaging_second*x_first(t) - (kappa_averaging_second - 1)*x_second(t))*(kappa_averaging_second*x_first(t) - (kappa_averaging_second - 1)*x_second(t) - 1)*r_averaging_second