.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/chaos/quantum_chaos/plot_quantum_billiard_eigenstates.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_quantum_chaos_plot_quantum_billiard_eigenstates.py: Quantum Billiard Eigenstates ================================= A quantum particle confined to a 2D billiard -- "particle in a box" with a chaotic (or not) box shape -- is the other classic playground of quantum chaos, alongside quantized maps like the :doc:`quantum kicked rotor `. In units where :math:`\hbar^2/2m=1`, its stationary states solve the Dirichlet Helmholtz eigenproblem .. math:: -\nabla^2 \psi = k^2 \psi \quad \text{inside the billiard}, \qquad \psi = 0 \quad \text{on the boundary}, with energy eigenvalues :math:`E_n = k_n^2`. :class:`~physicskit.chaos.quantum.billiards.QuantumBilliard` solves for these eigenstates for *any* billiard shape physicskit.chaos ships, using a simple five-point finite-difference discretization of the Laplacian -- no shape-specific code needed. .. GENERATED FROM PYTHON SOURCE LINES 23-30 .. code-block:: Python import matplotlib.pyplot as plt from physicskit.chaos.quantum import QuantumBilliard from physicskit.chaos.systems.billiards import BunimovichStadium, CircleBilliard from physicskit.chaos.visualizers import plot_billiard_eigenstate, plot_weyl_law .. GENERATED FROM PYTHON SOURCE LINES 31-36 The integrable case: a circular billiard --------------------------------------------- The circle is integrable, so its eigenstates come in near-degenerate pairs (except a few of the lowest) reflecting angular momentum, and each one's nodal lines form a simple, regular grid of radial and angular lines. .. GENERATED FROM PYTHON SOURCE LINES 36-48 .. code-block:: Python circle = QuantumBilliard(CircleBilliard(radius=1.0), resolution=140) eigenvalues, eigenfunctions = circle.eigenstates(n_states=6) fig, axes = plt.subplots(2, 3, figsize=(13, 9)) for i, ax in enumerate(axes.flat): plot_billiard_eigenstate(circle, eigenfunctions[i], ax=ax, density=False) ax.set_title(f"n={i + 1}, k²={eigenvalues[i]:.2f}") fig.suptitle("Circle billiard: regular eigenstates (signed wavefunction)") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/chaos/quantum_chaos/images/sphx_glr_plot_quantum_billiard_eigenstates_001.png :alt: Circle billiard: regular eigenstates (signed wavefunction), n=1, k²=5.73, n=2, k²=14.55, n=3, k²=14.56, n=4, k²=26.13, n=5, k²=26.15, n=6, k²=30.20 :srcset: /api/gallery/chaos/quantum_chaos/images/sphx_glr_plot_quantum_billiard_eigenstates_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 49-61 The chaotic case: a Bunimovich stadium -------------------------------------------- The stadium is a textbook chaotic billiard (see :doc:`/api/gallery/chaos/billiards/plot_bunimovich_stadium`): its eigenstates have no simple regular nodal pattern, and some show "scarring" -- amplitude anomalously enhanced along an unstable classical periodic orbit, most famously the straight bouncing-ball path along the stadium's long axis. Plotted the same way as the circle above (signed wavefunction, not just probability density) so the two are directly comparable: the finite- difference solver's eigenvectors are real-valued either way, so a signed plot is always available and shows strictly more -- both the nodal lines and the amplitude pattern -- than density alone would. .. GENERATED FROM PYTHON SOURCE LINES 61-73 .. code-block:: Python stadium = QuantumBilliard(BunimovichStadium(radius=1.0, straight_length=2.0), resolution=140) eigenvalues_s, eigenfunctions_s = stadium.eigenstates(n_states=6) fig2, axes2 = plt.subplots(2, 3, figsize=(13, 6.5)) for i, ax in enumerate(axes2.flat): plot_billiard_eigenstate(stadium, eigenfunctions_s[i], ax=ax, density=False) ax.set_title(f"n={i + 1}, k²={eigenvalues_s[i]:.2f}") fig2.suptitle("Bunimovich stadium: chaotic eigenstates (signed wavefunction)") fig2.tight_layout() plt.show() .. image-sg:: /api/gallery/chaos/quantum_chaos/images/sphx_glr_plot_quantum_billiard_eigenstates_002.png :alt: Bunimovich stadium: chaotic eigenstates (signed wavefunction), n=1, k²=3.12, n=2, k²=5.24, n=3, k²=8.66, n=4, k²=10.45, n=5, k²=12.97, n=6, k²=13.30 :srcset: /api/gallery/chaos/quantum_chaos/images/sphx_glr_plot_quantum_billiard_eigenstates_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 74-82 Weyl's law -------------- However irregular the individual eigenvalues, their *counting function* ``N(k)`` (the number of eigenvalues below ``k``) always tracks Weyl's law on average -- a purely geometric prediction from the billiard's area and perimeter alone, with no reference to whether the classical dynamics is regular or chaotic. This is a good sanity check on the eigensolver itself, independent of any known analytic spectrum. .. GENERATED FROM PYTHON SOURCE LINES 82-85 .. code-block:: Python fig3, ax3 = plot_weyl_law(stadium, n_states=25) plt.show() .. image-sg:: /api/gallery/chaos/quantum_chaos/images/sphx_glr_plot_quantum_billiard_eigenstates_003.png :alt: BunimovichStadium: eigenvalue counting function :srcset: /api/gallery/chaos/quantum_chaos/images/sphx_glr_plot_quantum_billiard_eigenstates_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.674 seconds) .. _sphx_glr_download_api_gallery_chaos_quantum_chaos_plot_quantum_billiard_eigenstates.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_quantum_billiard_eigenstates.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_quantum_billiard_eigenstates.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_quantum_billiard_eigenstates.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_