I trye found basins for attractors, but i have some problems.
First problem is out of memmory when i use big length for
xg1 = yg1 = zg1 = xg2 = yg2 = zg2 = range(-6.0, 6.0; length = 10)
If i using for example length = 100
i have error out of memory. Can i fix this or i need using poincare map?
Second problem is projection basins and attractors on 3D. I think I can do a projection of attractors on 3D, but I have a strange result
Image:
For this i using this code:
xg1 = yg1 = zg1 = xg2 = yg2 = zg2 = range(-6.0, 6.0; length = 10)
mapper = AttractorsViaRecurrences(ds_HR, (xg1, yg1, zg1, xg2, yg2, zg2))
basins, attractors = basins_of_attraction(mapper; show_progress = true)
function scatter_attractors!(ax, attractors)
for k ∈ keys(attractors)
x1, y1, z1, x2, y2, z2 = columns(attractors[k])
scatter!(ax, x1, y1, z1;
color = Cycled(k),
strokewidth = 3, strokecolor = :white
)
end
end
fig = Figure()
ax = fig[1,1] = Axis3(fig; title = "found attractors")
scatter_attractors!(ax, attractors)
fig
Also i don’t understand how need modification variable basins
for projection on 3D.
Full code:
function sigma(x)
return @fastmath 1.0 / ( 1.0 + exp( -10.0 * ( x - ( - 0.25 ) ) ) )
end
function HR(u, p, t)
a, b, c, d, s, xr, r, I, vs, k1, k2, el_link = p
x1, y1, z1, x2, y2, z2 = u
du1 = y1 + b * x1 ^ 2 - a * x1 ^3 - z1 + I - k1 * ( x1 - vs ) * sigma(x2) + el_link * ( x2 - x1 )
du2 = c - d * x1 ^2 - y1
du3 = r * ( s * ( x1 - xr ) - z1 )
du4 = y2 + b * x2 ^ 2 - a * x2 ^3 - z2 + I - k2 * ( x2 - vs ) * sigma(x1) + el_link * ( x1 - x2 )
du5 = c - d * x2 ^2 - y2
du6 = r * ( s * ( x2 - xr ) - z2 )
return SVector(du1, du2, du3,
du4, du5, du6)
end
a = 1.; b = 3.; c = 1.; d = 5.;
xr = -1.6; r = 0.01; s = 5.; I = 4.; xv = 2.;
k1= -0.17; k2 = -0.17;
k = 1.0
condition = SA[-1.5, 0.0, 0.0, -2.5, 0.0, 0.0]
# condition = SA[-0.5, -0.5, -0.5, -0.5, 0-0.5, -0.5]
p = SA[a, b, c, d,
s, xr, r, I, xv, k1, k2, k]
p = [a, b, c, d, s, xr, r, I, xv, k1, k2, k]
ds_HR = ContinuousDynamicalSystem(HR, condition, p )
xg1 = yg1 = zg1 = xg2 = yg2 = zg2 = range(-6.0, 6.0; length = 10)
mapper = AttractorsViaRecurrences(ds_HR, (xg1, yg1, zg1, xg2, yg2, zg2))
basins, attractors = basins_of_attraction(mapper; show_progress = true)
function scatter_attractors!(ax, attractors)
for k ∈ keys(attractors)
x1, y1, z1, x2, y2, z2 = columns(attractors[k])
scatter!(ax, x1, y1, z1;
color = Cycled(k),
strokewidth = 3, strokecolor = :white
)
end
end
fig = Figure()
ax = fig[1,1] = Axis3(fig; title = "found attractors")
scatter_attractors!(ax, attractors)
fig