JuliaDynamics / ChaosTools.jl

Tools for the exploration of chaos and nonlinear dynamics
https://juliadynamics.github.io/DynamicalSystemsDocs.jl/chaostools/stable/
MIT License
187 stars 35 forks source link

StroboscopicMap and ProjectedSystem #249

Closed awage closed 2 years ago

awage commented 2 years ago

I open a PR for two new interfaces definition. The first one is pretty straightforward, it is a wrapper for stroboscopic maps. The other interface defines three methods for projected systems: step!, reinit! and get_state similar to PoincareMap.

I am not sure that it is what you had in mind. An example of use:

using Revise
using DynamicalSystems
using OrdinaryDiffEq: Vern9

F = 0.27; ω = 0.1;  # smooth boundary
ds = Systems.duffing(zeros(2), ω = ω, f = F, d = 0.15, β = -1)
smap = stroboscopicmap(ds, 2*pi/ω; diffeq = (;reltol = 1e-8, alg = Vern9()))
reinit!(smap,[1., 1.])
for j in 1:1000
  step!(smap)
end
u = get_state(smap)
@assert sum(u - [1.11, 0]) < 0.01

ds = Systems.lorenz_iip()
psys = projectedsystem(ds, 0.1; idxs = 1:2, complete_state=[0.0], diffeq = (;reltol = 1e-8, alg = Vern9()))
reinit!(psys,[1., 1.])
for j in 1:1000
  step!(psys)
end
u = get_state(psys)
Datseris commented 2 years ago

awesome!!! but first see https://github.com/JuliaDynamics/ChaosTools.jl/issues/248#issuecomment-1039090103 (this should be in DynamicalSystemsBase.jl)