JuliaDynamics / ChaosTools.jl

Tools for the exploration of chaos and nonlinear dynamics
https://juliadynamics.github.io/DynamicalSystemsDocs.jl/chaostools/stable/
MIT License
188 stars 36 forks source link

Collection of the Lyapunov exponents over time #318

Closed rseydam closed 10 months ago

rseydam commented 11 months ago

Is it possible to collect the computed Lyapunovspectra over time to check on the convergence of the exponents?

Datseris commented 10 months ago

Closing in favor of the discussion of #317 , as the answer here is similar:

This option is not available out of the box. It will likely not be available out of the box in the near future either. That is because adding auxilary options for every possibility some user will find useful would obfuscate the code and reduce code clarity, making more than 50% of the lines of code auxilary options rather than computing Lyapunov exponents. To add this option you can trivially create a custom function by

  1. You copy paste this function: https://github.com/JuliaDynamics/ChaosTools.jl/blob/main/src/chaosdetection/lyapunovs/lyapunovspectrum.jl#L67-L99 and rename it to mylyapunovspectrum,
  2. You add the exponents_history = [zeros(k)] at the start of the function.
  3. In the core step loop, right after https://github.com/JuliaDynamics/ChaosTools.jl/blob/main/src/chaosdetection/lyapunovs/lyapunovspectrum.jl#L89 you add the line push!(exponents_history, λ ./ (current_time(tands) - t0)).
  4. You change the return statement to return λ, exponent_history.