.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/ode_dynamics/poincare/plot_01_duffing_poincare_section.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_ode_dynamics_poincare_plot_01_duffing_poincare_section.py: Poincare sections of the driven Duffing oscillator ======================================================== Sampling the Duffing oscillator's state once per drive period (stroboscopically) collapses its effectively-3D state space (position, velocity, and drive phase) back to a 2D picture: a periodic response shows up as one (or a few) fixed points, while chaotic parameters produce a scattered, fractal-looking set of points. .. GENERATED FROM PYTHON SOURCE LINES 13-18 .. code-block:: Python import matplotlib.pyplot as plt from mathematicskit.ode_dynamics.systems.poincare import DuffingOscillator, stroboscopic_poincare_section from mathematicskit.ode_dynamics.visualizers.plots import plot_poincare_points .. GENERATED FROM PYTHON SOURCE LINES 19-21 A weakly driven system settles onto a single periodic point ------------------------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 21-25 .. code-block:: Python system_periodic = DuffingOscillator([0.1, 0.0], delta=0.5, alpha=1.0, beta=0.0, gamma=0.05, omega=1.0) xs_p, ys_p = stroboscopic_poincare_section(system_periodic, n_periods=40, n_transient_periods=40, dt=1e-2) .. GENERATED FROM PYTHON SOURCE LINES 26-28 A more strongly driven double-well system shows a richer section ----------------------------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 28-40 .. code-block:: Python system_rich = DuffingOscillator([1.0, 0.0], delta=0.3, alpha=-1.0, beta=1.0, gamma=0.37, omega=1.2) xs_r, ys_r = stroboscopic_poincare_section(system_rich, n_periods=400, n_transient_periods=200, dt=1e-2) fig, axes = plt.subplots(1, 2, figsize=(10, 5)) plot_poincare_points(xs_p, ys_p, ax=axes[0]) axes[0].set_title("Weakly driven: converges to a point") plot_poincare_points(xs_r, ys_r, ax=axes[1]) axes[1].set_title("Strongly driven: richer structure") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/ode_dynamics/poincare/images/sphx_glr_plot_01_duffing_poincare_section_001.png :alt: Weakly driven: converges to a point, Strongly driven: richer structure :srcset: /api/gallery/ode_dynamics/poincare/images/sphx_glr_plot_01_duffing_poincare_section_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.605 seconds) .. _sphx_glr_download_api_gallery_ode_dynamics_poincare_plot_01_duffing_poincare_section.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_duffing_poincare_section.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_duffing_poincare_section.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_duffing_poincare_section.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_