.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/volcanology/plot_02_rutherford_soddy_decay_law.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 or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_volcanology_plot_02_rutherford_soddy_decay_law.py: Rutherford and Soddy's decay law (1902) ======================================= Rutherford and Soddy found that the activity of thorium emanation (radon-220) falls by half every minute or so, whatever its temperature or chemistry, and concluded that radioactivity is the spontaneous transformation of one element into another at a fixed fractional rate. Decay is exponential, so a straight line on a logarithmic plot and its slope gives the half-life. .. GENERATED FROM PYTHON SOURCE LINES 11-34 .. image-sg:: /api/gallery/volcanology/images/sphx_glr_plot_02_rutherford_soddy_decay_law_001.png :alt: Half lost every 55.6 s, Straight line, half-life 55.6 s :srcset: /api/gallery/volcanology/images/sphx_glr_plot_02_rutherford_soddy_decay_law_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from earthsciencekit.volcanology import decay_constant, parent_fraction half_life = 55.6 # s, radon-220 time = np.linspace(0, 400, 81) remaining = parent_fraction(decay_constant(half_life), time) slope = np.polyfit(time, np.log(remaining), 1)[0] assert np.isclose(np.log(2) / -slope, half_life) assert np.isclose(parent_fraction(decay_constant(half_life), 2 * half_life), 0.25) fig, (left, right) = plt.subplots(1, 2, figsize=(10, 4)) left.plot(time, remaining) for n in range(1, 5): left.plot(n * half_life, 0.5**n, "ko", ms=4) left.set(xlabel="time [s]", ylabel="fraction of radon-220 left", title="Half lost every 55.6 s") right.semilogy(time, remaining) right.set(xlabel="time [s]", ylabel="fraction left (log scale)", title=f"Straight line, half-life {np.log(2) / -slope:.1f} s") fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.246 seconds) .. _sphx_glr_download_api_gallery_volcanology_plot_02_rutherford_soddy_decay_law.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../lite/lab/index.html?path=api/gallery/volcanology/plot_02_rutherford_soddy_decay_law.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_rutherford_soddy_decay_law.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_rutherford_soddy_decay_law.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_rutherford_soddy_decay_law.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_