Closed StefanVaylBX2023 closed 10 months ago
Seems good. Perhaps you can use the example of Issue #35 as an example in the documentation?
You mean docstring above the function or example for compiled documentation?
An example in the documentation. The the docs
folder in the examples markdown file. Just like you did for the minimal fatal shock.
@StefanVaylBX2023 it is actually more useful to use this system here: https://github.com/JuliaDynamics/ChaosTools.jl/issues/258 as an example
Make the grid so that it is finer for x close to 0 and for y close to 0. It makes for the perfect example!
cc @KalelR in case you still use fast slow systems.
@StefanVaylBX2023 it is actually more useful to use this system here: JuliaDynamics/ChaosTools.jl#258 as an example
Make the grid so that it is finer for x close to 0 and for y close to 0. It makes for the perfect example!
cc @KalelR in case you still use fast slow systems.
I've been running this example for different distributions of grid (you can control it with pow
, the higher pow
, the more finer grid you will get closer to 0), different Dt
, different u0
and different total lengths of the grid. But I cannot understand results some of the results, can you help me figure out the behavior, if it is correct or not, here is some code I've been using:
using Attractors
using DynamicalSystems
@inbounds @inline function predator_prey(u, p, t)
α, γ, ϵ, ν, h, K, m = p
N, P = u
du1 = α*N*(1 - N/K) - γ*N*P / (N+h)
du2 = ϵ * ( ν*γ*N*P/(N+h) - m*P )
return SVector{2}(du1, du2)
end
γ = 2.5
h = 1
ν = 0.5
m = 0.4
ϵ = 1.0
α = 0.8
K = 15
u0 = rand(2)
ds = ContinuousDynamicalSystem(predator_prey, u0, [α, γ, ϵ, ν, h, K, m])
pow = 2
xg = yg = collect(range(0, 15^(1/pow), length=1000)).^ pow
mapper = AttractorsViaRecurrences(ds, (xg, yg); Δt=0.1, sparse = false)
basins, attractors = basins_of_attraction(mapper; show_progress = true)
attractors[1]
using CairoMakie
heatmap_basins_attractors((xg,yg),basins, attractors)
and the results I obtained
Also, using scatter doesn't help much:
mapper(u0)
u = mapper.bsn_nfo.attractors[1]
plot(u[:,1], u[:,2], seriestype = :scatter)
what do you not understand?
what do you not understand?
I don't understand how this particular configuration is valid to be added as a final example.
wait , i am confused. when you run this code you do not find a limit cycle as attractors?
wait , i am confused. when you run this code you do not find a limit cycle as attractors?
u0 = rand(2)
ds = ContinuousDynamicalSystem(predator_prey, u0, [α, γ, ϵ, ν, h, K, m])
pow = 4
xg = yg = collect(range(0, 15^(1/pow), length=10000)).^ pow
mapper = AttractorsViaRecurrences(ds, (xg, yg); Δt=0.1, sparse = false)
mapper(u0)
u = mapper.bsn_nfo.attractors[1]
plot(u[:,1], u[:,2], seriestype = :scatter)
with this code i obtained a limit cycle, but it is not much different from results obtained in discussion
working on the comments rn, just one more question regarding example in the docs, what exactly do you expect to see there like plot of mapper.bsn_info.attractors
or the heatmap.
I was thinking that a good example would be using this fast slow system, and solving it once with a regular grid, and showing that it fails. Then solving it with hte irregular grid and showing that it works (i.e., finds the limit cycle).
This would need relatively coarse grid, e.g., 100 cell boxes in each dimension. but for the irregular grid the cell boxes are concentrated near the origin!
You should also turn the parameter store_once_per_cell = false
.
I've addressed all of the issues you mentioned but still problem with example. With basins_of_attraction
for both cases all I can get is two saddle points as attractors (I've tried tons of initial conditions and grid setups). While running mapper(u0)
with u0 = rand(2)
writes down cyclical attractor into bsn_nfo
again in both cases, with only difference that with the same setup irregular grid gives 20-30% more points
okay thanks, I'll have a look then!
Codecov Report
91.22% <94.28%> (+0.98%)
... and 1 file with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more