Skip to content

Commit

Permalink
add example for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
awage committed Sep 1, 2024
1 parent 48720c3 commit b1e88b2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/boundaries/example_stagger.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Attractors
using CairoMakie

# Coupled Hénon maps
function F!(du, u ,p, n)
x,y,u,v = u
A = 3; B = 0.3; C = 5.; D = 0.3; k = 0.4;
du[1] = A - x^2 + B*y + k*(x-u)
du[2] = x
du[3] = C - u^2 + D*v + k*(u-x)
du[4] = u
return
end

# The region should not contain any attractors.
R_min = [-4; -4.; -4.; -4.]
R_max = [4.; 4.; 4.; 4.]


# Initial box and initial condition.
sampler, isinside = statespace_sampler(HRectangle(R_min,R_max))
x0 = sampler()
df = DeterministicIteratedMap(F!, x0)
xi = stagger_trajectory!(df, x0, 30, isinside; δ₀= 2.)
@show Tp = Attractors.escape_time!(df, xi, isinside)

v = stagger_and_step!(df, x0, 10000, isinside; stagger_mode = :adaptive, δ = 1e-4, Tm = 10, max_steps = Int(1e5), δ₀ = 2.)
v = hcat(v...)'
scatter(v[:,1], v[:,3]; markersize = 3)

0 comments on commit b1e88b2

Please sign in to comment.