Using GAIO with DynamicalSystems.jl
BoxMaps can also be generated via the DynamicalSystems.jl package:
julia> using GAIOjulia> c, r = (0.5, 0.5), (0.5, 0.5)((0.5, 0.5), (0.5, 0.5))julia> Q = Box(c, r)Box{2, Float64}: center: [0.5, 0.5] radius: [0.5, 0.5]julia> f((x,y)) = (1-1.4*x^2+y, 0.3*x) # the Hénon mapf (generic function with 1 method)
julia> using DynamicalSystems: DiscreteDynamicalSystemjulia> using StaticArraysjulia> dynamic_rule(u::Vec, p, t) where Vec = Vec( f(u) ) # DynamicalSystems.jl syntaxdynamic_rule (generic function with 1 method)julia> u0 = SA_F64[0, 0] # this is dummy data2-element SVector{2, Float64} with indices SOneTo(2): 0.0 0.0julia> p0 = SA_F64[0, 0] # parameters, in case they are needed2-element SVector{2, Float64} with indices SOneTo(2): 0.0 0.0julia> system = DiscreteDynamicalSystem(dynamic_rule, u0, p0)2-dimensional DeterministicIteratedMap deterministic: true discrete time: true in-place: false dynamic rule: dynamic_rule parameters: [0.0, 0.0] time: 0 state: [0.0, 0.0]julia> F̃ = BoxMap(system, Q)BoxMap over [0.0, 1.0) × [0.0, 1.0)
The same works for a continuous dynamical system.
Currently, you must hard-code your systems, and cannot rely on DifferentialEquations or DynamicalSystems for GPU-acceleration.
GAIO.jl ALWAYS performs integration over one time unit for ContinuousDynamicalSystems! To perform smaller steps, rescale your dynamical system accordingly!
julia> using DynamicalSystems: ContinuousDynamicalSystemjulia> using OrdinaryDiffEqjulia> function lorenz_dudx(u::Vec, p, t, Δt) where Vec x,y,z = u σ,ρ,β = p dudx = Vec(( σ*(y-x), ρ*x-y-x*z, x*y-β*z )) return Δt * dudx endlorenz_dudx (generic function with 1 method)julia> Δt = 0.20.2julia> lorenz(u, p=p0, t=0) = lorenz_dudx(u, p, t, Δt)lorenz (generic function with 3 methods)julia> u0 = SA_F64[0, 0, 0]3-element SVector{3, Float64} with indices SOneTo(3): 0.0 0.0 0.0julia> p0 = SA_F64[10, 28, 0.4]3-element SVector{3, Float64} with indices SOneTo(3): 10.0 28.0 0.4julia> diffeq = (alg = RK4(), dt = 1/20, adaptive = false)(alg = OrdinaryDiffEqLowOrderRK.RK4{typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!), Static.False}(OrdinaryDiffEqCore.trivial_limiter!, OrdinaryDiffEqCore.trivial_limiter!, static(false)), dt = 0.05, adaptive = false)julia> lorenz_system = ContinuousDynamicalSystem(lorenz, u0, p0; diffeq)3-dimensional CoupledODEs deterministic: true discrete time: false in-place: false dynamic rule: lorenz ODE solver: RK4 ODE kwargs: (dt = 0.05, adaptive = false) parameters: [10.0, 28.0, 0.4] time: 0.0 state: [0.0, 0.0, 0.0]julia> Q̄ = Box((0,0,25), (30,30,30))Box{3, Float64}: center: [0.0, 0.0, 25.0] radius: [30.0, 30.0, 30.0]julia> F̄ = BoxMap(lorenz_system, Q̄)BoxMap over [-30.0, 30.0) × [-30.0, 30.0) × [-5.0, 55.0)