.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/electrochem/nernst/plot_01_nernst_equation.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_electrochem_nernst_plot_01_nernst_equation.py: The Nernst equation: cell potential versus concentration ========================================================== :func:`~chemistrykit.electrochem.systems.nernst.nernst_potential` implements :math:`E = E^\circ - \frac{RT}{nF}\ln Q`. This example checks that it reduces to :math:`E^\circ` at :math:`Q=1`, plots the logarithmic dependence on the reaction quotient, and then builds a concentration cell (:func:`~chemistrykit.electrochem.systems.nernst.concentration_cell_potential`) whose voltage comes entirely from a concentration difference -- about 59 mV per decade for a one-electron couple at 25 degC, as Nernst predicted. .. GENERATED FROM PYTHON SOURCE LINES 15-29 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from chemistrykit.electrochem.systems.nernst import concentration_cell_potential, nernst_potential from chemistrykit.electrochem.visualizers.electrochem_plots import plot_nernst_concentration_dependence E_standard, n = 0.34, 2 # Cu2+/Cu half-reaction vs. SHE for Q in np.logspace(-3, 3, 7): print(f"Q={Q:9.3g} E = {nernst_potential(E_standard, n, Q):+.4f} V") print(f"\nNernst at Q=1: {nernst_potential(E_standard, n, Q=1.0)} V (= E_standard)") ax = plot_nernst_concentration_dependence(E_standard=E_standard, n=n) plt.tight_layout() .. image-sg:: /api/gallery/electrochem/nernst/images/sphx_glr_plot_01_nernst_equation_001.png :alt: Nernst equation: cell potential vs. reaction quotient :srcset: /api/gallery/electrochem/nernst/images/sphx_glr_plot_01_nernst_equation_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Q= 0.001 E = +0.4287 V Q= 0.01 E = +0.3992 V Q= 0.1 E = +0.3696 V Q= 1 E = +0.3400 V Q= 10 E = +0.3104 V Q= 100 E = +0.2808 V Q= 1e+03 E = +0.2513 V Nernst at Q=1: 0.34 V (= E_standard) .. GENERATED FROM PYTHON SOURCE LINES 30-32 A concentration cell: identical half-cells, E_standard = 0, so the voltage is pure Nernst term. .. GENERATED FROM PYTHON SOURCE LINES 32-42 .. code-block:: Python ratios = np.array([2.0, 5.0, 10.0, 50.0, 100.0]) E_conc = concentration_cell_potential(n=1, C_cathode=ratios * 0.01, C_anode=0.01) fig, ax2 = plt.subplots() ax2.plot(ratios, E_conc * 1e3, "o-") ax2.set_xscale("log") ax2.set_xlabel(r"$C_{cathode}/C_{anode}$") ax2.set_ylabel("E (mV)") ax2.set_title("Concentration cell: about 59 mV per decade (n = 1)") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/electrochem/nernst/images/sphx_glr_plot_01_nernst_equation_002.png :alt: Concentration cell: about 59 mV per decade (n = 1) :srcset: /api/gallery/electrochem/nernst/images/sphx_glr_plot_01_nernst_equation_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.102 seconds) .. _sphx_glr_download_api_gallery_electrochem_nernst_plot_01_nernst_equation.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_nernst_equation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_nernst_equation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_nernst_equation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_