ssapy_toolkit.Compute.lyapunov_exponent

Functions

lyapunov_exponent_from_statevectors(r, v[, ...])

Estimate the (largest) Lyapunov exponent from a single trajectory of state vectors using the Rosenstein et al. nearest-neighbor divergence method.

ssapy_toolkit.Compute.lyapunov_exponent.lyapunov_exponent_from_statevectors(r, v, dt=1.0, theiler_window=10, max_horizon=None, fit_window=(0.1, 0.6), min_initial_separation=1e-12, trim_percentile=None, return_diagnostics=True)[source]

Estimate the (largest) Lyapunov exponent from a single trajectory of state vectors using the Rosenstein et al. nearest-neighbor divergence method.

Parameters:
  • r ((N,3) array) – Positions.

  • v ((N,3) array) – Velocities.

  • dt (float) – Time between samples (in whatever time unit you want the exponent to be 1/unit).

  • theiler_window (int) – Exclude nearest neighbors within +/- this many samples to avoid trivial temporal neighbors.

  • max_horizon (int or None) – Max number of forward steps k to track divergence. If None, uses as much as possible.

  • fit_window (tuple) – Either (t_min_frac, t_max_frac) as fractions of the available time range (0..1), OR (t_min, t_max) in the same time units as dt if values > 1.

  • min_initial_separation (float) – Pairs with initial separation below this are discarded (avoids log(0) and numerical issues).

  • trim_percentile (float or None) – If set (e.g., 90), trims per-k separations above that percentile before averaging (can reduce the impact of outliers).

  • return_diagnostics (bool) – If True, returns (lambda, t, mean_log_div, diagnostics_dict). If False, returns (lambda, t, mean_log_div).

Returns:

  • lle (float) – Estimated largest Lyapunov exponent.

  • t ((K,) array) – Time values for the divergence curve.

  • mean_log_div ((K,) array) – Mean log separation vs time.

  • diagnostics (dict (optional)) – Contains fit indices, intercept, r2, number of pairs used, neighbor indices, etc.