We already have fuctionality for estimating return times.
We can simplify and re-use the codebase, by creating a new type of dynamical system, that is in discrete time, and it iterates a given dynamical system until it returns to a prescribed set with at least distance e or smaller. Here is some initial draft code:
struct ReturnDynamicalSystem
ds::DynamicalSystem
set::Something # the set to return to
mind::Real # must come at least `mind` close to set
dt::Real
maxt::Real # safety variable. if evolve for more than maxt without coming `mind` close, stop iteration
end
function step!(rds::ReturnDynamicalSystem)
u = current_state(rds.ds)
n = 0
while distace(u, rds.set) > rds.mind
step!(rds.ds)
u = current_state(rds.ds)
n += 1
if n > rds.maxt
error("we didn't return in time")
end
end
rds.dt = n
return rds
end
rds = ReturnDynamicalSystem(ds, ...)
step!(rds) # evolve the internal ds until it comes `mind` close to the set
# and in the field `.dt` it would have recorded how much time this took
u_close = current_state(rds)
n = rds.dt
step!(rds)
We already have fuctionality for estimating return times.
We can simplify and re-use the codebase, by creating a new type of dynamical system, that is in discrete time, and it iterates a given dynamical system until it returns to a prescribed set with at least distance
e
or smaller. Here is some initial draft code: