Evolving a DynamicalSystem until it is close to an attractor

Hello! I’ve been working with DynamicalSystems.jl and Attractors.jl and I’m wondering if there exists the following functionality:

I would like to obtain a trajectory of a given DynamicalSystem and initial condition, which terminates once it has reached a certain proximity to a given attractor of the system.

A slightly different result which I would be equally satisfied with is this:
Say I give a DynamicalSystem and a grid to Attractors.AttractorsViaRecurrences and extract the attractors. Then for each grid cell as an initial condition, a trajectory is evolved until certain recurrence conditions are met. How can I get access to all of these internally generated trajectories on the grid? Or how might I adopt the code most efficiently to generate them myself?

Thanks for any hints!

Hi @andreasmorr , welcome.

To me this sounds like it is most fitting for the AttractorsViaProximity (which also recently got a good update).

I would use the function convergence_time like so:

mapper = AttractorsViaProximity(ds, attractors, ε)
u0 = whatever
id = mapper(u0)
t = convergence_time(mapper)

In this scenario t would be the time until the trajectory “terminates”, which would be when it comes ε close to any of the attractors. So you could also obtain the full trajectory with X, tvec = trajectory(ds, t, u0).


It is not possible to use the same recurrences mapper and reach a different recurrence condition for different initial conditions. You would need a dedicated mapper for each different recurrence threshold.

For the second half of your question, internally in the source code of the recurrences mapper the recurrences are counted and that’s easy to find in the source code. As a user it isn’t easy to access it… However, we do access this information in this example animation script, that uses the internals of the recurrences mapper:

the code in this animation script counts the recurrences explicitly for each initial condition. You can adjust it to your needs I guess?

Hey @Datseris, thanks for your quick response! Running trajectory up to the convergence_time corresponding to the respective initial condition is a very elegant solution. Works perfect for me!