.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/chaos/billiards/plot_bunimovich_stadium.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_chaos_billiards_plot_bunimovich_stadium.py: Bunimovich Stadium (Chaotic) ============================ A billiard particle moves in a straight line at constant speed inside a closed boundary and undergoes specular reflection, :math:`\mathbf{v}' = \mathbf{v} - 2(\mathbf{v}\cdot\mathbf{n})\,\mathbf{n}`, whenever it strikes the boundary. The Bunimovich stadium's boundary is two straight edges, :math:`y = \pm r` for :math:`|x| \le a`, joined by two semicircular caps of radius :math:`r` centered at :math:`(\pm a, 0)`, where :math:`2a` is the straight-edge length. It is chaotic despite having no concave scatterer: the *focusing* semicircular caps defocus nearby trajectories after they refocus and diverge past the caps' centers of curvature (unlike a full circle, whose focusing never gets interrupted by a flat stretch). This example plots a single trajectory and the resulting Poincare section. .. GENERATED FROM PYTHON SOURCE LINES 18-27 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.chaos.systems.billiards import BunimovichStadium from physicskit.chaos.visualizers.phase_space import plot_billiard_trajectory, plot_poincare_section billiard = BunimovichStadium(radius=1.0, straight_length=2.0) .. GENERATED FROM PYTHON SOURCE LINES 28-30 Trajectory ---------- .. GENERATED FROM PYTHON SOURCE LINES 30-32 .. code-block:: Python fig, ax = plot_billiard_trajectory(billiard, pos=billiard.sample_interior_point(), vel=np.array([0.5, 0.9]), n_bounces=100) .. image-sg:: /api/gallery/chaos/billiards/images/sphx_glr_plot_bunimovich_stadium_001.png :alt: BunimovichStadium trajectory :srcset: /api/gallery/chaos/billiards/images/sphx_glr_plot_bunimovich_stadium_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 33-37 Poincare section ---------------- As with the Sinai billiard, the section fills in densely rather than tracing out smooth invariant curves. .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: Python fig, ax = plot_poincare_section(billiard, n_rays=40, n_bounces=200) plt.show() .. image-sg:: /api/gallery/chaos/billiards/images/sphx_glr_plot_bunimovich_stadium_002.png :alt: BunimovichStadium Poincare section :srcset: /api/gallery/chaos/billiards/images/sphx_glr_plot_bunimovich_stadium_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.075 seconds) .. _sphx_glr_download_api_gallery_chaos_billiards_plot_bunimovich_stadium.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_bunimovich_stadium.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_bunimovich_stadium.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_bunimovich_stadium.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_