Hello everyone, I am calculating Lyapunov exponents for my system using lyapunovspectrum from DynamicalSystems. Can I somehow get the state of the system during integration? For another system, I wrote this code:
check = 0
condition(u,t,integrator) = t==4
function affect!(integrator)
global check = integrator.u[1]
end
cb = DiscreteCallback(condition,affect!)
sol = solve(prob,Tsit5(),callback=cb, tstops=[4.0])
Plots.plot(sol)
As a result, in the check variable, I get the state value I need. I tried using the same on my system when calculating lyapunov exponents with diffeq:
qq = 0
condition(u,t,integrator) = t==4
function affect!(integrator)
global qq = integrator.u[1]
end
cb = DiscreteCallback(condition,affect!)
test = lyapunovspectrum(ds,10; Δt = 0.001, diffeq=(callback=cb, tstops=[4.0]))
But nothing is written to the variable qq, can I somehow fix this?
I meant this is not a problem of the global variable, but affect!(integrator) never gets called by lyapunovspectrum in the first place. That could be either not implemented or a problem with your parameterization of lyapunovspectrum.
It turns out such an error and again nothing is written to qq.
┌ Warning: Direct propagation of keyword arguments to DifferentialEquations.jl is deprecated.
│ From now on pass any DiffEq-related keywords as a `NamedTuple` using the
│ explicit keyword `diffeq` instead.
└ @ ChaosTools C:\Users\semenjuta.e\.julia\packages\ChaosTools\Xe6aI\src\chaosdetection\lyapunovs.jl:79