.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/quantum/angular_momentum/plot_hydrogen_21cm_line.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_quantum_angular_momentum_plot_hydrogen_21cm_line.py: The 21 cm line: hyperfine splitting of hydrogen =============================================== The electron and proton spins in the hydrogen ground state couple, through Fermi's contact interaction, to a triplet :math:`F = 1` and a singlet :math:`F = 0`. :func:`~physicskit.quantum.chapters.angular_momentum.hyperfine_splitting_hydrogen` gives the splitting, :math:`5.88\times10^{-6}` eV, a photon of 1420 MHz and 21.1 cm. Van de Hulst predicted in 1944 that interstellar hydrogen should glow at this wavelength; Ewen and Purcell detected it in 1951. Below, the same spin Hamiltonian is diagonalized with the coupled basis of :func:`~physicskit.quantum.chapters.angular_momentum.couple_spins` in a magnetic field, which separates the triplet (the Breit-Rabi diagram). .. GENERATED FROM PYTHON SOURCE LINES 15-28 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import scipy.constants as sc from physicskit.quantum.chapters.angular_momentum import couple_spins, hyperfine_splitting_hydrogen from physicskit.quantum.core.operators import spin_operator hf = hyperfine_splitting_hydrogen() hf_corr = hyperfine_splitting_hydrogen(corrected=True) print(f"Fermi formula: {hf.energy_ev:.4e} eV, {hf.frequency_hz / 1e6:.2f} MHz, {hf.wavelength_m * 100:.2f} cm") print(f"with g_e and m_red: {hf_corr.frequency_hz / 1e6:.2f} MHz (measured 1420.41 MHz)") .. rst-class:: sphx-glr-script-out .. code-block:: none Fermi formula: 5.8774e-06 eV, 1421.16 MHz, 21.09 cm with g_e and m_red: 1420.49 MHz (measured 1420.41 MHz) .. GENERATED FROM PYTHON SOURCE LINES 29-35 Triplet and singlet in a magnetic field --------------------------------------- :math:`H = A\,\mathbf S_e\cdot\mathbf S_p + 2\mu_B B\,S_{e,z}` (the proton's Zeeman term is 660 times smaller and left out). At :math:`B = 0` the levels are :math:`A/4` (three-fold) and :math:`-3A/4`. .. GENERATED FROM PYTHON SOURCE LINES 35-57 .. code-block:: Python A = hf.energy_ev basis = couple_spins(0.5, 0.5) Sez = np.kron(spin_operator("z"), np.eye(2)) muB = sc.physical_constants["Bohr magneton in eV/T"][0] B = np.linspace(0, 0.15, 300) # tesla levels = np.array([np.linalg.eigvalsh(A * basis.s1_dot_s2_operator() + 2 * muB * b * Sez) for b in B]) x = 2 * muB * B / A breit_rabi_pm = -A / 4 + np.outer(np.sqrt(1 + x**2), [-A / 2, A / 2]) fig, ax = plt.subplots(figsize=(8, 5)) ax.plot(B * 1e3, levels / A, lw=2) ax.plot(B * 1e3, breit_rabi_pm / A, "k:", lw=1, label="Breit-Rabi formula") ax.annotate("F = 1", (2, 0.33)) ax.annotate("F = 0", (2, -0.68)) ax.set_xlabel("B (mT)") ax.set_ylabel("E / A") ax.set_title(f"Hydrogen 1s hyperfine levels, A = {A * 1e6:.2f} µeV ↔ {hf.wavelength_m * 100:.1f} cm") ax.legend() fig.tight_layout() .. image-sg:: /api/gallery/quantum/angular_momentum/images/sphx_glr_plot_hydrogen_21cm_line_001.png :alt: Hydrogen 1s hyperfine levels, A = 5.88 µeV ↔ 21.1 cm :srcset: /api/gallery/quantum/angular_momentum/images/sphx_glr_plot_hydrogen_21cm_line_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 58-65 Check ----- Splitting 5.88e-6 eV, 1421 MHz and 21.1 cm from the Fermi formula; with the electron's anomaly and the reduced mass it is within 1e-4 of the measured 1420.405751 MHz. At B = 0 the levels are A/4 (three times) and -3A/4, and the two M = 0 levels follow the Breit-Rabi formula -A/4 +- (A/2) sqrt(1 + x^2) at every field. .. GENERATED FROM PYTHON SOURCE LINES 65-71 .. code-block:: Python assert abs(hf.energy_ev - 5.88e-6) < 0.01e-6 assert abs(hf.wavelength_m - 0.211) < 0.001 assert abs(hf_corr.frequency_hz / 1420.405751e6 - 1) < 1e-4 assert np.allclose(levels[0] / A, [-0.75, 0.25, 0.25, 0.25]) assert np.allclose(levels[:, 0] / A, breit_rabi_pm[:, 0] / A) assert np.max(np.min(np.abs(levels - breit_rabi_pm[:, [1]]), axis=1)) / A < 1e-10 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.052 seconds) .. _sphx_glr_download_api_gallery_quantum_angular_momentum_plot_hydrogen_21cm_line.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_hydrogen_21cm_line.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_hydrogen_21cm_line.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_hydrogen_21cm_line.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_