"Warning: Instability detected. Aborting" while using lyapunovspectrum

Hey, I’m trying to study the lyapunov spectrum for a 4D dynamical system using the lyapunovspectrum function from DynamicalSystem.jl but depending on the parameters I get “Warning: Instability detected. Aborting” and I don’t know how to solve this. I’ve tried to search and found that this could be related to special singularities of the system or the solver. This is the code that I am using:

Blockquote
function mem_system(du, u, p, t)
x, y, z, v = u
a, b, c, d, e, α, β = p
du[1] = -(ay^2 - b)x - (αv + β)z
du[2] = -c
x - d
y + eyx^2
du[3] = x
du[4] = z
return nothing
end
u0 = [-1, -0.5, -0.5, -3] # Initial condition
p1 = [0.1, 0.5, 0.5, 10, 4, 0.1, 1] # a, b, c, d, e, α, β
integrationMethod = (alg = Tsit5(), adaptive = false, dense = false, dt = 0.01, reltol=1e-9, abstol=1e-9)
syst_1 = CoupledODEs(mem_system, u0 , p1, diffeq =integrationMethod)
lya_spec = lyapunovspectrum(syst_1, 10^5; Ttr = 10^3, show_progress = true) # Works fine
set_parameter!(syst_1, 1, 0.41)
set_parameter!(syst_1, 2, 0.91)
lya_spec = lyapunovspectrum(syst_1, 10^5; Ttr = 10^3, show_progress = true) # Instability warning

I get the warning when I change the value of the parameters.

Hi there welcome to the community!

Well this warning means that the ODE solution is unstable. It does not have any direct relation to Lyapunov exponents, you would get the same error if you tried to just evolve the system with trajectory or directly with solve of DifferentialEquations.jl.

There isn’t much help I can provide unfortunately :frowning: Try different solvers, or solvers of higher precision by increasing the tolerances. But in the end of the day, it may well be that for these parameters the system is unstable and/or ill-defined. Sorry!

1 Like

I’d start by changing the integration method around, and then double check so that there is not an error with your model

1 Like

Thank you for your response. I’ve tried to use other methods to see the trajectory and it seems that it diverges for that parameters. The funny thing is that I was trying to reproduce some results from a paper where they don’t specify anything about how did they solve the equations. For these parameters, it was suppose to have chaotic behaviour or something like that but not divergence.

Anyway, when I try to compute the lyapunov spectrum and the warning comes up, it seems that Julia stays infinetly in the process instead of finishing it. Do you know how could I make it stop in case of a warning?

unfortunately this is a downside of Julia… in many situations you can’t stop the process. You can only restart the whole Julia. Solving differential equations appears to be one such case. At least to me it happens all the time and I found no reliable way to just “stop” the process, only to restart Julia.

hahaha Not being able to reproduce people’s work in nonlinear dynamics is the whole “character arc” of DynamicalSystems.jl :smiley: One of the main reasons it exists is to bring reproducibility reliability and accessibility in computational nonlinear dynamics. Happy to see you come on board!

1 Like

Oh, that’s quite a pain. Thank you, I wont waste my time on trying to find a way to do something impossible :joy:

I understand, it is quite a good reason. I’ll try my best to use it wisely.