chaotic_pfc.dynamics.lyapunov¶
lyapunov.py¶
Lyapunov exponent computation for the Hénon map (2-D) and the Hénon map with a pole filter (4-D).
- 4-D system:
x₁[n+1] = α − x₃[n]² + β·x₂[n] x₂[n+1] = x₁[n] x₃[n+1] = b₀·(α − x₃[n]² + β·x₂[n]) + a₁·x₃[n] + a₂·x₄[n] x₄[n+1] = x₃[n]
where b = [b₀, 0, 0] and a = −[1, −2r·cos(w₀), r²] (pole-filter coeffs).
- 2-D system:
x₁[n+1] = α − x₁[n]² + β·x₂[n] x₂[n+1] = x₁[n]
Two flavours of computation are provided:
lyapunov_max/lyapunov_henon2d— single perturbed initial condition, returning one estimate of the spectrum.lyapunov_max_ensemble/lyapunov_henon2d_ensemble— full experimental protocol: sample N_ci initial conditions uniformly around the fixed point (±``perturbation``), compute the spectrum for each, and aggregate statistics. Results can be exported to CSV viaEnsembleResult.to_csv().
Implementation note¶
The 2-D and 4-D variants share the same QR/Gram-Schmidt loop; the only
differences are the iterate function, the Jacobian, and the dimension.
Both single-IC and ensemble entry points delegate to the generic
helpers _lyapunov_spectrum and _run_ensemble.
Functions
|
Quick check: fixed point, eigenvalues, stability (4-D filtered). |
|
Compute Lyapunov exponents for the standard 2-D Hénon map. |
|
Ensemble Lyapunov protocol for the standard 2-D Hénon map. |
|
Compute the maximum Lyapunov exponent of the 4-D pole-filtered Hénon map. |
|
Ensemble Lyapunov protocol for the 4-D pole-filtered Hénon map. |
Classes
|
Outcome of the ensemble Lyapunov protocol. |
Result of |
|
|
Result of a single-IC Lyapunov exponent computation (2-D or 4-D). |
- class chaotic_pfc.dynamics.lyapunov.FixedPointInfo[source]¶
Bases:
TypedDictResult of
fixed_point_stability()— fixed point, eigenvalues, stability.
- class chaotic_pfc.dynamics.lyapunov.LyapunovResult(lyapunov_max, all_exponents, fixed_point=None, eigenvalues=None, stable=None, fixed_point_p=None, fixed_point_n=None, eigenvalues_p=None, eigenvalues_n=None, stable_p=None, stable_n=None)[source]¶
Bases:
objectResult of a single-IC Lyapunov exponent computation (2-D or 4-D).
- Fields populated by
lyapunov_max()(4-D): lyapunov_max, all_exponents, fixed_point, eigenvalues, stable
- Fields populated by
lyapunov_henon2d()(2-D): lyapunov_max, all_exponents, fixed_point_p, fixed_point_n, eigenvalues_p, eigenvalues_n, stable_p, stable_n
- Parameters:
lyapunov_max (float)
fixed_point (ndarray[tuple[Any, ...], dtype[_ScalarT]] | None)
eigenvalues (ndarray[tuple[Any, ...], dtype[_ScalarT]] | None)
stable (bool | None)
fixed_point_p (ndarray[tuple[Any, ...], dtype[_ScalarT]] | None)
fixed_point_n (ndarray[tuple[Any, ...], dtype[_ScalarT]] | None)
eigenvalues_p (ndarray[tuple[Any, ...], dtype[_ScalarT]] | None)
eigenvalues_n (ndarray[tuple[Any, ...], dtype[_ScalarT]] | None)
stable_p (bool | None)
stable_n (bool | None)
- Fields populated by
- chaotic_pfc.dynamics.lyapunov.lyapunov_max(alpha=1.4, beta=0.3, Gz=1.0, pole_radius=0.975, w0=0.0, Nitera=2000, Ndiscard=1000, perturbation=0.1, seed=42)[source]¶
Compute the maximum Lyapunov exponent of the 4-D pole-filtered Hénon map.
- Parameters:
alpha (float) – Hénon \(\alpha\) parameter.
beta (float) – Hénon \(\beta\) parameter.
Gz (float) – Pole-filter input gain. Governs the filter’s DC gain and the fixed-point location.
pole_radius (float) – Radius
rof the pole in thez-domain. Must satisfy0 ≤ r < 1for a stable filter.w0 (float) – Angular frequency
ω₀of the pole in radians/sample.w0 = 0places both poles on the real axis.Nitera (int) – Number of QR iterations (post-transient) over which the log-norm is accumulated.
Ndiscard (int) – Number of burn-in iterations discarded before the QR loop starts.
perturbation (float) – Half-width of the uniform sampling box around the fixed point, used to generate the initial condition.
IC = xf · (1 + p · U)withU ∈ [-1, 1]per component.seed (int) – RNG seed for the initial-condition perturbation.
- Returns:
With fields: lyapunov_max, all_exponents, fixed_point, eigenvalues, stable.
- Return type:
See also
lyapunov_henon2d : Standard 2‑D Hénon (no filter). Lyapunov exponent computation : Algorithm overview and validation.
- chaotic_pfc.dynamics.lyapunov.fixed_point_stability(alpha=1.4, beta=0.3, Gz=1.0, pole_radius=0.975, w0=0.0)[source]¶
Quick check: fixed point, eigenvalues, stability (4-D filtered).
- Parameters:
- Returns:
A dict with keys
"fixed_point","eigenvalues","stable".- Return type:
- chaotic_pfc.dynamics.lyapunov.lyapunov_henon2d(alpha=1.4, beta=0.3, Nitera=2000, Ndiscard=1000, perturbation=0.1, seed=42)[source]¶
Compute Lyapunov exponents for the standard 2-D Hénon map.
- Parameters:
alpha (float) – Hénon \(\alpha\) parameter.
beta (float) – Hénon \(\beta\) parameter.
Nitera (int) – Number of QR iterations (post-transient).
Ndiscard (int) – Number of burn-in iterations discarded before the QR loop.
perturbation (float) – Half-width of the uniform box around the positive fixed point used to generate the initial condition.
seed (int) – RNG seed for the IC perturbation.
- Returns:
With fields: lyapunov_max, all_exponents, fixed_point_p, fixed_point_n, eigenvalues_p, eigenvalues_n, stable_p, stable_n.
- Return type:
See also
lyapunov_henon2d_ensemble : Multi-IC protocol. lyapunov_max : 4‑D pole‑filtered variant. Lyapunov exponent computation : Algorithm overview and validation.
Validated against published values from Wolf et al. [Wolf85] and Sprott [Sprott03] (see Scientific validation).
References
- class chaotic_pfc.dynamics.lyapunov.EnsembleResult(fixed_point, eigenvalues, stable, initial_conditions, exponents_per_ci, lmax_per_ci, mean_exponents, mean_lmax, max_lmax, n_chaotic, n_stable, metadata=<factory>)[source]¶
Bases:
objectOutcome of the ensemble Lyapunov protocol.
- Parameters:
- fixed_point¶
Fixed point used as the sampling centre.
- Type:
ndarray, shape (dim,)
- eigenvalues¶
Eigenvalues of the Jacobian at
fixed_point.- Type:
ndarray, shape (dim,)
- mean_exponents¶
Per-component mean of
exponents_per_ci.- Type:
ndarray, shape (dim,)
- mean_lmax, max_lmax
Aggregates of
lmax_per_ci.- Type:
- n_chaotic, n_stable
Counts of ICs with
λ_max > 0andλ_max ≤ 0.- Type:
- chaotic_pfc.dynamics.lyapunov.lyapunov_max_ensemble(alpha=1.4, beta=0.3, Gz=1.0, pole_radius=0.975, w0=0.0, Nitera=2000, Ndiscard=1000, perturbation=0.1, n_initial=20, seed=42)[source]¶
Ensemble Lyapunov protocol for the 4-D pole-filtered Hénon map.
- Parameters:
alpha (float) – Hénon \(\alpha\) parameter.
beta (float) – Hénon \(\beta\) parameter.
Gz (float) – Pole-filter input gain.
pole_radius (float) – Pole radius
r. Must satisfy0 ≤ r < 1.w0 (float) – Pole angular frequency
ω₀in radians/sample.Nitera (int) – Number of QR iterations per initial condition.
Ndiscard (int) – Number of burn-in iterations discarded per IC.
perturbation (float) – Half-width of the uniform box around the fixed point from which initial conditions are drawn.
n_initial (int) – Number of independent initial conditions to sample.
seed (int | None) – RNG seed for IC sampling.
Noneuses the global unseeded RNG.
- Return type:
- chaotic_pfc.dynamics.lyapunov.lyapunov_henon2d_ensemble(alpha=1.4, beta=0.3, Nitera=2000, Ndiscard=1000, perturbation=0.1, n_initial=20, seed=42)[source]¶
Ensemble Lyapunov protocol for the standard 2-D Hénon map.
- Parameters:
alpha (float) – Hénon \(\alpha\) parameter.
beta (float) – Hénon \(\beta\) parameter.
Nitera (int) – Number of QR iterations per initial condition.
Ndiscard (int) – Number of burn-in iterations discarded per IC.
perturbation (float) – Half-width of the uniform box around the positive fixed point from which initial conditions are drawn.
n_initial (int) – Number of independent initial conditions to sample.
seed (int | None) – RNG seed for IC sampling.
Noneuses the global unseeded RNG.
- Return type:
See also
lyapunov_henon2d : Single‑IC version. Lyapunov exponent computation : Algorithm overview and ensemble motivation.