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

Time crossing poincaresos ? #235

Closed gacarita closed 2 years ago

gacarita commented 2 years ago

Hi,

As I understand the poincaresos function does not return timecrossings events. Could this be a new feature ?

Datseris commented 2 years ago

Hi,

this is trivial to do, as the necessary information is already accessible in the source code. In fact, the function first calculates the crossing times and then simply returns the integrator state at these times.

https://github.com/JuliaDynamics/ChaosTools.jl/blob/master/src/orbitdiagrams/poincare.jl#L168-L169

But one has to be very careful for directly supporting this in DynamicalSystems.jl. poincaremap! is a deeply rooted function. It is used in several places of the entire library. Changing its return signature would be really breaking. So your options are: either just copy/paste the code and do the necessary 3 lines of code modification so that the code returns what you need, or, open a pr that creates a new function. Return the crossing times in the existing functions is not possible for compatibility reasons.

awage commented 2 years ago

Hello,

here is another solution, you can define a pmap object to track the orbit step by step:

ds = Systems.rikitake([0.,0.,0.], μ = 0.47, α = 1.0)
pmap = poincaremap(ds, (3,0.), Tmax=200.)
next_state_on_psos = step!(pmap)
tcross = pmap.integ.t  # here is your crossing time
Datseris commented 2 years ago

Great, so we only need to document this in poincaremap function! No reason to add extra functions or so.

gacarita commented 2 years ago

sounds good thanks ! :)

Datseris commented 2 years ago

Issue stays open until this is documented.

gacarita commented 2 years ago

Ok. I'm sorry for closing the topic, I didn't know that. I appreciate the help.

Datseris commented 2 years ago

Actually, this is not correct:

tcross = pmap.integ.t  # here is your crossing time

this is not the time crossing the section unfoirtunately, but after the cross. To get the time crossing the section you'd need to call tcross = current_time(pmap). This is implemented, and will be released after #237 is merged.