Poincaré Sections

Compute Poincaré sections using NDSolve with WhenEvent.

For a periodically driven planar example, the Poincaré section can be obtained by sampling at regular time intervals. Sampling can be done using WhenEvent, with an action having Sow with an enclosing Reap around the call to NDSolve.
Solve the Duffing equation and save samples at every period of the driving force, :
The strange attractor for these parameter values can be visualized using ListPlot:
For higher-dimensional systems, the Poincaré section in effect samples on a slice across the phase space. This typically requires an event that depends on the solution. An example of this is the ArnoldBeltramiChildress (ABC) flow that is used to model chaos in laminar flows of the three-dimensional Euler equations:
The Poincaré section will be computed by taking samples as the solution crosses the plane. To get a full picture of the space, it will be necessary to use several different initial conditions:
Apply the function to several initial conditions: