.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/solutions/acid_base/plot_05_sorensen_ph_scale.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_solutions_acid_base_plot_05_sorensen_ph_scale.py: Sorensen's pH scale: a logarithm for hydrogen-ion concentration ================================================================= Sorensen's 1909 definition :math:`\mathrm{pH} = -\log_{10}[H^+]` (:func:`~chemistrykit.solutions.systems.acid_base.ph_from_h`) turns hydrogen-ion concentrations spanning fourteen orders of magnitude into numbers between 0 and 14. Below, the pH of several everyday solutions is computed from their equilibrium :math:`[H^+]` and placed on the scale, and the companion relation :math:`\mathrm{pH} + \mathrm{pOH} = pK_w = 14` is checked with :func:`~chemistrykit.solutions.systems.acid_base.poh_from_oh`. .. GENERATED FROM PYTHON SOURCE LINES 15-43 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from chemistrykit.solutions.systems.acid_base import WeakAcid, WeakBase, h_from_ph, ph_from_h, poh_from_oh Kw = 1.0e-14 samples = { "0.1 M HCl": 0.1, "vinegar (0.8 M acetic)": WeakAcid(Ca=0.8, Ka=1.8e-5).h_concentration(), "0.01 M acetic acid": WeakAcid(Ca=0.01, Ka=1.8e-5).h_concentration(), "pure water": np.sqrt(Kw), "0.1 M ammonia": Kw / WeakBase(Cb=0.1, Kb=1.8e-5).oh_concentration(), "0.1 M NaOH": Kw / 0.1, } pH_axis = np.linspace(0, 14, 200) fig, ax = plt.subplots(figsize=(8, 5)) ax.semilogy(pH_axis, h_from_ph(pH_axis), color="steelblue", label=r"$[H^+] = 10^{-\mathrm{pH}}$") for name, h in samples.items(): pH = float(ph_from_h(h)) ax.plot(pH, h, "o", color="darkorange") ax.annotate(name, (pH, h), textcoords="offset points", xytext=(6, 4), fontsize=8) ax.set_xlabel("pH") ax.set_ylabel("[H+] (mol/L)") ax.set_title("Sorensen's pH scale") ax.legend() fig.tight_layout() .. image-sg:: /api/gallery/solutions/acid_base/images/sphx_glr_plot_05_sorensen_ph_scale_001.png :alt: Sorensen's pH scale :srcset: /api/gallery/solutions/acid_base/images/sphx_glr_plot_05_sorensen_ph_scale_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 44-45 pH and pOH of each sample always sum to :math:`pK_w = 14` at 25 degC: .. GENERATED FROM PYTHON SOURCE LINES 45-52 .. code-block:: Python for name, h in samples.items(): pH = float(ph_from_h(h)) pOH = float(poh_from_oh(Kw / h)) print(f"{name:24s}: [H+] = {h:.2e} M, pH = {pH:5.2f}, pOH = {pOH:5.2f}, sum = {pH + pOH:.2f}") plt.show() .. rst-class:: sphx-glr-script-out .. code-block:: none 0.1 M HCl : [H+] = 1.00e-01 M, pH = 1.00, pOH = 13.00, sum = 14.00 vinegar (0.8 M acetic) : [H+] = 3.79e-03 M, pH = 2.42, pOH = 11.58, sum = 14.00 0.01 M acetic acid : [H+] = 4.15e-04 M, pH = 3.38, pOH = 10.62, sum = 14.00 pure water : [H+] = 1.00e-07 M, pH = 7.00, pOH = 7.00, sum = 14.00 0.1 M ammonia : [H+] = 7.50e-12 M, pH = 11.12, pOH = 2.88, sum = 14.00 0.1 M NaOH : [H+] = 1.00e-13 M, pH = 13.00, pOH = 1.00, sum = 14.00 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.059 seconds) .. _sphx_glr_download_api_gallery_solutions_acid_base_plot_05_sorensen_ph_scale.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_05_sorensen_ph_scale.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_05_sorensen_ph_scale.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_05_sorensen_ph_scale.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_