.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/fields/quantum_fields/plot_casimir_effect.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_fields_quantum_fields_plot_casimir_effect.py: The Casimir energy grows weaker as plates separate ======================================================== Hendrik Casimir showed in 1948 that two uncharged, perfectly conducting parallel plates in vacuum should attract each other: only electromagnetic vacuum modes that fit an integer number of wavelengths between the plates are allowed there, so the confined zero-point energy is slightly lower than in the unbounded vacuum outside, producing a net inward force. This is a simplified, standard textbook treatment -- a 1D scalar field confined between two "plates" a distance :math:`d` apart, not a full 3D electromagnetic calculation. :func:`~physicskit.fields.quantum_fields.casimir_mode_frequencies` builds the resulting discrete standing-wave spectrum, .. math:: \omega_n = \frac{n\pi c}{d}, \qquad n = 1, 2, 3, \dots, in place of the continuum of frequencies allowed in unbounded vacuum. The bare zero-point sum :math:`\tfrac12\sum_n \omega_n` diverges, so :func:`~physicskit.fields.quantum_fields.casimir_energy_1d` regularizes it with an exponential (Abel-summation) cutoff, subtracts the same divergent piece a plate-free continuum calculation would produce under the same regulator, and takes the cutoff to zero, leaving the finite, physical remainder .. math:: E(d) \to -\frac{\pi c}{24 d}, the standard 1D massless-field Casimir energy -- reproducing the qualitative Casimir signature (an attractive, separation-dependent zero-point energy) directly. .. GENERATED FROM PYTHON SOURCE LINES 36-42 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.fields import animate_casimir_modes, casimir_energy_1d, casimir_mode_frequencies .. GENERATED FROM PYTHON SOURCE LINES 43-45 Sweep the plate separation and animate the mode spectrum and energy -------------------------------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 45-51 .. code-block:: Python d_values = np.linspace(1.0, 6.0, 40) anim = animate_casimir_modes(d_values) plt.show() .. container:: sphx-glr-animation .. raw:: html .. GENERATED FROM PYTHON SOURCE LINES 52-56 To save the animation to a file instead of (or in addition to) displaying it interactively, use e.g.:: anim.save("casimir_effect.gif", writer="pillow", fps=12) .. GENERATED FROM PYTHON SOURCE LINES 58-62 The discrete spectrum grows denser (approaching the continuum) as the plates separate, and the regularized zero-point energy is negative (attractive) everywhere, growing less negative -- weaker confinement of vacuum energy -- as the separation grows. .. GENERATED FROM PYTHON SOURCE LINES 62-71 .. code-block:: Python energies = np.array([casimir_energy_1d(d) for d in d_values]) modes_at_small_d = casimir_mode_frequencies(d_values[0], n_max=5) modes_at_large_d = casimir_mode_frequencies(d_values[-1], n_max=5) print(f"first 5 mode frequencies at d={d_values[0]:.2f}: {np.round(modes_at_small_d, 3)}") print(f"first 5 mode frequencies at d={d_values[-1]:.2f}: {np.round(modes_at_large_d, 3)} (denser -> continuum)") print(f"Casimir energy: E(d={d_values[0]:.2f})={energies[0]:.4f}, E(d={d_values[-1]:.2f})={energies[-1]:.4f}") print(f"force is attractive everywhere (energy increases monotonically with d): {bool(np.all(np.diff(energies) > 0))}") .. rst-class:: sphx-glr-script-out .. code-block:: none first 5 mode frequencies at d=1.00: [ 3.142 6.283 9.425 12.566 15.708] first 5 mode frequencies at d=6.00: [0.524 1.047 1.571 2.094 2.618] (denser -> continuum) Casimir energy: E(d=1.00)=-0.1309, E(d=6.00)=-0.0218 force is attractive everywhere (energy increases monotonically with d): True .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.746 seconds) .. _sphx_glr_download_api_gallery_fields_quantum_fields_plot_casimir_effect.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_casimir_effect.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_casimir_effect.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_casimir_effect.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_