Hi,
so I am calculating Lyapunov exponents for a lot of initial values, parameters for specific systems. I want to make heavy use of the reinit!
function for integrator objects, especially the tangent_integrator from the DynamicalSystems
package. A thing I noticed is, that the reinit!
function does not seem to reinit every property of the integrator object. See the following example
function lorenz_iip(du,u,p,t)
sigma = p[1]
rho = p[2]
beta = p[3]
# f
du[1] = sigma*(u[2]-u[1])
du[2] = u[1]*(rho-u[3])-u[2]
du[3] = u[1]*u[2]-beta*u[3]
end
function lorenz_jac_iip(J,u,p,t)
sigma = p[1]
rho = p[2]
beta = p[3]
J[1,1] = -sigma
J[1,2] = sigma
J[1,3] = 0
J[2,1] = rho-u[3]
J[2,2] = -1
J[2,3] = -u[1]
J[3,1] = u[2]
J[3,2] = u[1]
J[3,3] = -beta
end
Random.seed!(42)
N=10000
tol = 1e-12
w0 = Matrix(LinearAlgebra.qr(Random.rand(3,3)).Q)
param = [16.,45.92,4.]
x_start = [19.,20.,50.]
cds = ContinuousDynamicalSystem(lorenz_iip,x_start,param,lorenz_jac_iip)
integ = tangent_integrator(cds; abstol=tol, reltol=tol)
lyapunovs(integ, N, 1.0,1000.0)
3-element Array{Float64,1}:
1.499473772711736
0.0001330755279767297
-22.499144329887265
reinit!(integ, x_start, w0)
lyapunovs(integ, N, 1.0,1000.0)
3-element Array{Float64,1}:
1.5036130016404863
2.5060873222979467e-5
-22.50343335858572
integ = tangent_integrator(cds; abstol=tol, reltol=tol)
lyapunovs(integ, N, 1.0,1000.0)
3-element Array{Float64,1}:
1.499473772711736
0.0001330755279767297
-22.499144329887265
For more chaotic systems the difference can of course be much bigger. What is the reason here?