.. 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_01_ostwald_dilution_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. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_solutions_acid_base_plot_01_ostwald_dilution_law.py: Ostwald's dilution law: weak acids dissociate more when diluted ================================================================= Dissolving less acid in more water increases the *fraction* of it that dissociates, even though the absolute :math:`[H^+]` goes down -- the dilution law Wilhelm Ostwald derived in 1888 by applying the mass-action law to Arrhenius's dissociation equilibrium, .. math:: K_a = \frac{\alpha^2 C_a}{1-\alpha}. Here the degree of dissociation :math:`\alpha` of acetic acid is computed from the exact cubic charge-balance solution in :class:`~chemistrykit.solutions.systems.acid_base.WeakAcid` and compared against Ostwald's own closed-form solution of the quadratic above (which ignores water autoionization). .. GENERATED FROM PYTHON SOURCE LINES 22-43 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from chemistrykit.solutions.systems.acid_base import WeakAcid Ka = 1.8e-5 # acetic acid Ca_values = np.logspace(-6, 0, 80) alpha_exact = np.array([WeakAcid(Ca=Ca, Ka=Ka).percent_dissociation() / 100.0 for Ca in Ca_values]) # Ostwald's quadratic alpha^2 Ca + Ka alpha - Ka = 0, positive root: alpha_ostwald = (-Ka + np.sqrt(Ka**2 + 4.0 * Ka * Ca_values)) / (2.0 * Ca_values) fig, ax = plt.subplots(figsize=(7, 5)) ax.semilogx(Ca_values, 100.0 * alpha_exact, color="steelblue", label="exact (WeakAcid)") ax.semilogx(Ca_values, 100.0 * alpha_ostwald, color="darkorange", linestyle="--", label=r"Ostwald: $K_a = \alpha^2 C_a/(1-\alpha)$") ax.set_xlabel("total acid concentration $C_a$ (mol/L)") ax.set_ylabel(r"percent dissociated, $100\alpha$") ax.set_title("Ostwald dilution law: acetic acid") ax.legend() fig.tight_layout() .. image-sg:: /api/gallery/solutions/acid_base/images/sphx_glr_plot_01_ostwald_dilution_law_001.png :alt: Ostwald dilution law: acetic acid :srcset: /api/gallery/solutions/acid_base/images/sphx_glr_plot_01_ostwald_dilution_law_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 44-48 The "Ostwald constant" :math:`\alpha^2 C_a/(1-\alpha)` computed from the exact degree of dissociation stays equal to :math:`K_a` across four decades of dilution -- the experimental test Ostwald made with conductivity data for dozens of weak acids: .. GENERATED FROM PYTHON SOURCE LINES 48-53 .. code-block:: Python for Ca, alpha in zip(Ca_values[::20], alpha_exact[::20]): print(f"Ca = {Ca:.1e} M: alpha = {alpha:.4f}, alpha^2 Ca/(1-alpha) = {alpha**2 * Ca / (1 - alpha):.3e}") plt.show() .. rst-class:: sphx-glr-script-out .. code-block:: none Ca = 1.0e-06 M: alpha = 0.9494, alpha^2 Ca/(1-alpha) = 1.780e-05 Ca = 3.3e-05 M: alpha = 0.5144, alpha^2 Ca/(1-alpha) = 1.800e-05 Ca = 1.1e-03 M: alpha = 0.1204, alpha^2 Ca/(1-alpha) = 1.800e-05 Ca = 3.6e-02 M: alpha = 0.0221, alpha^2 Ca/(1-alpha) = 1.800e-05 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.068 seconds) .. _sphx_glr_download_api_gallery_solutions_acid_base_plot_01_ostwald_dilution_law.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_ostwald_dilution_law.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_ostwald_dilution_law.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_ostwald_dilution_law.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_