make_logistic_map

kooplearn.datasets.make_logistic_map(X0, n_steps=100, r=4.0, M=10, dt=1.0, random_state=None)[source]

Generate a trajectory from the logistic map with optional trigonometric noise Ostruszka et al. [1].

The logistic map is a discrete-time dynamical system defined by:

\[x_{t+1} = r x_t (1 - x_t) + \xi_t\]

where \(\xi_t\) is drawn from a trigonometric noise distribution when M > 0.

The classic chaotic logistic map uses \(r = 4\). For this system with trigonometric noise, the eigenfunctions of the Koopman operator can be computed analytically using the basis:

\[\phi_i(x) = c_i \sin^{2M-i}(\pi x) \cos^i(\pi x)\]

for \(i = 0, 1, \ldots, 2M\).

Parameters:
  • X0 (float or array-like, shape (1,)) – Initial condition. Must be in [0, 1] for standard logistic map.

  • n_steps (int, default 100) – Number of time steps to simulate.

  • r (float, default 4.0) – Growth rate parameter. The classic chaotic regime is at r = 4.

  • M (int, default 10) – Order of the trigonometric noise distribution. Higher M makes the noise distribution more peaked around zero. If M <= 0, no noise is added.

  • dt (float, default 1.0) – Time step size. For discrete-time systems, this is typically 1.0.

  • random_state (int, RandomState instance or None, default None) – Controls the random number generation for the noise. Pass an int for reproducible output across multiple function calls.

Returns:

df – Trajectory of the logistic map with column ['x'] and n_steps + 1 samples. Has a MultiIndex with levels ['step', 'time']. Metadata stored in df.attrs includes:

  • 'generator': 'make_logistic_map';

  • 'X0': initial condition;

  • 'params': dict of all parameters.

Return type:

pandas.DataFrame

Examples

>>> import numpy as np

Classic chaotic logistic map:

>>> df = make_logistic_map(X0=0.1, n_steps=100, r=4.0)
>>> df.shape
(101, 1)
>>> df.columns.tolist()
['x']

With trigonometric noise:

>>> df_noisy = make_logistic_map(
...     X0=0.1,
...     n_steps=1000,
...     r=4.0,
...     M=10,
...     random_state=42
... )

Different growth rates:

>>> # Period-2 orbit (r ≈ 3.2)
>>> df_period2 = make_logistic_map(X0=0.5, n_steps=100, r=3.2)
>>>
>>> # Chaotic (r = 4.0)
>>> df_chaotic = make_logistic_map(X0=0.5, n_steps=100, r=4.0)

Access metadata:

>>> df.attrs['params']['M']
10

Notes

The trigonometric noise distribution has PDF:

\[p(\xi) = \frac{\pi}{B(M+0.5, 0.5)} \cos^{2M}(\pi \xi)\]

for \(\xi \in [-0.5, 0.5]\), where \(B\) is the beta function.

For the noisy logistic map with \(r = 4\), the Koopman operator has known eigenfunctions that can be computed using the companion function :func:kooplearn.datasets.compute_logistic_map_eig.

[1]

Andrzej Ostruszka, Prot Pakoński, Wojciech Słomczyński, and Karol Życzkowski. Dynamical entropy for systems with stochastic perturbation. Physical Review E, 62(2):2018, 2000.