compute_lyapunov - cchandre/HamLorenz GitHub Wiki

compute_lyapunov (function)

Purpose

Estimates the full spectrum of Lyapunov exponents for a Hamiltonian Lorenz model by integrating its variational equations over time with periodic re-orthonormalization.

Parameters

  • tf: Total integration time.
  • x0: Initial condition (state vector).
  • reortho_dt: Time interval between successive QR re-orthonormalizations.
  • tol: Integration tolerance for solve_ivp.
  • method: Integration method (default: 'RK45').
  • plot: Whether to plot the Lyapunov spectrum (default: True).

Algorithm

  1. Initialize the orthonormal matrix Q and zero vector lyap_sum.
  2. At each step:
    • Integrate the combined system and tangent dynamics (z_dot) over reortho_dt.
    • Extract the evolved tangent vectors and apply QR decomposition.
    • Accumulate the logarithms of the absolute values of the diagonal entries of R.
  3. Normalize the accumulated sum by total time to compute the Lyapunov exponents.

Output

  • Returns the sorted array of Lyapunov exponents lyap_sort.

Features

  • Displays runtime and symmetry check error (maximum of $\vert λ_i + λ_{N−i+1}\vert$).
  • Optionally plots the Lyapunov spectrum.

Notes

  • Uses QR decomposition to maintain orthogonality of perturbation vectors.