.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/solutions/titration/plot_01_titration_curves.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_titration_plot_01_titration_curves.py: Volumetric titration: locating the equivalence point ====================================================== The volumetric analysis Gay-Lussac and Mohr systematized finds how much acid a sample contains from the burette volume at which it has been exactly neutralized -- the equivalence point, seen by eye as an indicator's sudden colour change and here located numerically as the steepest point of the pH curve (:meth:`~chemistrykit.solutions.core.base_system.Titration.find_equivalence_point`). Comparing a strong-acid/strong-base titration (:class:`~chemistrykit.solutions.systems.titration.StrongAcidStrongBaseTitration`) against a weak-acid/strong-base titration (:class:`~chemistrykit.solutions.systems.titration.WeakAcidStrongBaseTitration`) of the same concentrations: the weak-acid curve starts at a higher pH, has a buffer region around its half-equivalence point (where pH = pKa), and its equivalence point is basic rather than neutral -- all visible directly from the curve shapes. .. GENERATED FROM PYTHON SOURCE LINES 22-55 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from chemistrykit.solutions.systems.titration import ( StrongAcidStrongBaseTitration, WeakAcidStrongBaseTitration, ) Ca, Va, Cb = 0.100, 0.050, 0.100 Ka = 1.8e-5 # acetic acid strong = StrongAcidStrongBaseTitration(Ca=Ca, Va=Va, Cb=Cb) weak = WeakAcidStrongBaseTitration(Ca=Ca, Va=Va, Ka=Ka, Cb=Cb) Vb = np.linspace(1e-6, 0.09, 2000) result_strong = strong.curve(Vb) result_weak = weak.curve(Vb) Vb_eq_strong = strong.find_equivalence_point(Vb) Vb_eq_weak = weak.find_equivalence_point(Vb) fig, ax = plt.subplots(figsize=(8, 6)) ax.plot(result_strong.Vb * 1000.0, result_strong.pH, label="strong acid + strong base", color="steelblue") ax.plot(result_weak.Vb * 1000.0, result_weak.pH, label="weak acid + strong base", color="darkorange") ax.axvline(Vb_eq_strong * 1000.0, color="steelblue", linestyle=":", alpha=0.6) ax.axvline(Vb_eq_weak * 1000.0, color="darkorange", linestyle=":", alpha=0.6) ax.axhline(7.0, color="gray", linestyle="--", linewidth=0.7, label="pH 7") ax.set_xlabel("volume of NaOH added (mL)") ax.set_ylabel("pH") ax.set_title("Titration of 50.0 mL of 0.100 M acid with 0.100 M NaOH") ax.legend() fig.tight_layout() .. image-sg:: /api/gallery/solutions/titration/images/sphx_glr_plot_01_titration_curves_001.png :alt: Titration of 50.0 mL of 0.100 M acid with 0.100 M NaOH :srcset: /api/gallery/solutions/titration/images/sphx_glr_plot_01_titration_curves_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 56-60 The numerically detected equivalence points (steepest-ascent points) for each curve, compared against the exact stoichiometric volume (identical for both, since it only depends on moles of acid and base, not on Ka): .. GENERATED FROM PYTHON SOURCE LINES 60-66 .. code-block:: Python print(f"Stoichiometric equivalence volume: {strong.equivalence_volume() * 1000.0:.3f} mL") print(f"Strong-acid titration: numeric equivalence at {Vb_eq_strong * 1000.0:.3f} mL, pH there = 7.00 (neutral)") print(f"Weak-acid titration: numeric equivalence at {Vb_eq_weak * 1000.0:.3f} mL, pH there > 7 (basic)") plt.show() .. rst-class:: sphx-glr-script-out .. code-block:: none Stoichiometric equivalence volume: 50.000 mL Strong-acid titration: numeric equivalence at 50.020 mL, pH there = 7.00 (neutral) Weak-acid titration: numeric equivalence at 50.020 mL, pH there > 7 (basic) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.408 seconds) .. _sphx_glr_download_api_gallery_solutions_titration_plot_01_titration_curves.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_titration_curves.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_titration_curves.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_titration_curves.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_