{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Chapter 6: Electrochemistry"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 1, Page no: 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "# Variables\n",
      "T = 25              # C\n",
      "E = 0.296           # V\n",
      "Cu = 0.015          # M\n",
      "\n",
      "# Solution\n",
      "Eo = E - 0.0296 * log10(Cu)\n",
      "print \"The standard electrode potential is\", \"{:.3f}\".format(Eo), \"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The standard electrode potential is 0.350 V\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 2, Page no: 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "# Variables\n",
      "T = 25                  # C\n",
      "Cu = 0.1                # M\n",
      "Zn = 0.001              # M\n",
      "Eo = 1.1\n",
      "\n",
      "# Solution\n",
      "E = Eo + 0.0296 * log10(Cu / Zn)\n",
      "print \"The emf of Daniell cell is\", \"{:.4f}\".format(E), \"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The emf of Daniell cell is 1.1592 V\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 3, Page no: 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "# Constant\n",
      "R = 8.314               # J / K\n",
      "F = 96500               # C / mol\n",
      "\n",
      "# Variables\n",
      "Cu = 0.15               # M\n",
      "Eo = 0.34               # V\n",
      "T = 298                 # K\n",
      "n = 2                   # moles\n",
      "\n",
      "# Solution\n",
      "E = Eo + (2.303 * R * T) / (n * F) * log10(Cu)\n",
      "print \"The single electrode potential for copper metal is\", \"{:.4f}\".format(E),\n",
      "print \"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The single electrode potential for copper metal is 0.3156 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 4, Page no: 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variable\n",
      "Eo_Cu = 0.3370          # Cu+2 -> Cu\n",
      "Eo_Zn = - 0.7630        # Zn -> Zn +2\n",
      "\n",
      "# Solution\n",
      "Eo_cell = Eo_Cu - Eo_Zn\n",
      "print \"Daniel cell is, Zn | Zn +2 || Cu+2 | Cu\"\n",
      "print \"Eo (cell) is\", Eo_cell, \"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Daniel cell is, Zn | Zn +2 || Cu+2 | Cu\n",
        "Eo (cell) is 1.1 V\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 5, Page no: 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variable\n",
      "Eo_Cu = 0.3370          # Cu+2 -> Cu\n",
      "Eo_Cd = - 0.4003        # Cd -> Cd +2\n",
      "\n",
      "# Solution\n",
      "Eo_cell = Eo_Cu - Eo_Cd\n",
      "print \"Cell is, Cd | Cd +2 || Cu+2 | Cu\"\n",
      "print \"Eo (cell) is\", Eo_cell, \"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cell is, Cd | Cd +2 || Cu+2 | Cu\n",
        "Eo (cell) is 0.7373 V\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 6, Page no: 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Constant\n",
      "F = 96500               # C / mol\n",
      "\n",
      "# Variables\n",
      "n = 2\n",
      "T = 25                  # C\n",
      "Eo_Ag = 0.80            # Ag+ / Ag\n",
      "Eo_Ni = - 0.24          # Ni+2 / Ni\n",
      "\n",
      "# Solution\n",
      "Eo_Cell = Eo_Ag - Eo_Ni\n",
      "print \"Standard free energy change,\"\n",
      "delta_Go = - n * F * Eo_Cell\n",
      "print delta_Go, \"J / mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Standard free energy change,\n",
        "-200720.0 J / mol\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 7, Page no: 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Solution\n",
      "print \"-------------------------\"\n",
      "print \"Reduction half reaction:\",\n",
      "print \"2Fe+3 + 2e- --> 2Fe+2\"\n",
      "print \"Oxidation half reaction:\",\n",
      "print \"Fe    - 2e- --> Fe+2\"\n",
      "print \"Overall cell reaction  :\",\n",
      "print \"2Fe+3 + Fe  --> 3Fe+2\"\n",
      "\n",
      "print \"-------------------------\"\n",
      "print \"Reduction half reaction:\",\n",
      "print \"Hg+2 + 2e- --> Hg\"\n",
      "print \"Oxidation half reaction:\",\n",
      "print \"Zn   - 2e- --> Zn+2\"\n",
      "print \"Overall cell reaction  :\",\n",
      "print \"Hg+2 + Zn  --> Hg + Zn+2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-------------------------\n",
        "Reduction half reaction: 2Fe+3 + 2e- --> 2Fe+2\n",
        "Oxidation half reaction: Fe    - 2e- --> Fe+2\n",
        "Overall cell reaction  : 2Fe+3 + Fe  --> 3Fe+2\n",
        "-------------------------\n",
        "Reduction half reaction: Hg+2 + 2e- --> Hg\n",
        "Oxidation half reaction: Zn   - 2e- --> Zn+2\n",
        "Overall cell reaction  : Hg+2 + Zn  --> Hg + Zn+2\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 8, Page no: 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Constant\n",
      "F = 96500               # C / mol\n",
      "\n",
      "# Variables\n",
      "E1o = - 2.48            # V\n",
      "E2o = 1.61              # V\n",
      "\n",
      "# Solution\n",
      "delta_G1 = - 3 * F * (- 2.48)\n",
      "delta_G2 = - 1 * F * 1.61\n",
      "print \"delta_G3 = delta_G1 + delta_G2\"\n",
      "print \"delta_G3 = - 4 * F * E3o\"\n",
      "E3o = (delta_G1 + delta_G2) / (- 4 * F)\n",
      "print \"The reduction potential for the half-cell Pt/Ce, Ce+4\",\n",
      "print \"is\", \"{:.4f}\".format(E3o), \"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "delta_G3 = delta_G1 + delta_G2\n",
        "delta_G3 = - 4 * F * E3o\n",
        "The reduction potential for the half-cell Pt/Ce, Ce+4 is -1.4575 V\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 9, Page no: 182"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Solution\n",
      "print \"Anodic half reaction   :\",\n",
      "print \"      Cd   --> Cd+2 + 2e-\"\n",
      "print \"Cathodic half reaction :\",\n",
      "print \"2H+ + 2e-  --> H2\"\n",
      "print \"-\" * 50\n",
      "print \"Overall cell reaction  :\",\n",
      "print \"Cd  + 2H+ <--> Cd+2 + H2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Anodic half reaction   :       Cd   --> Cd+2 + 2e-\n",
        "Cathodic half reaction : 2H+ + 2e-  --> H2\n",
        "--------------------------------------------------\n",
        "Overall cell reaction  : Cd  + 2H+ <--> Cd+2 + H2\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 10, Page no: 182"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "# Variables\n",
      "T = 25                  # C\n",
      "Cu = 0.1                # M\n",
      "Zn = 0.001              # M\n",
      "Eo = 1.1                # V\n",
      "\n",
      "# Solution\n",
      "print \"Zn(s) | Zn+2 (0.001M) || Cu+2(0.1M) | Cu(s)\"\n",
      "Ecell = Eo + 0.0592 / 2 * log10(Cu / Zn)\n",
      "print \"The emf of a Daniell cell is\", \"{:.4f}\".format(Ecell), \"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Zn(s) | Zn+2 (0.001M) || Cu+2(0.1M) | Cu(s)\n",
        "The emf of a Daniell cell is 1.1592 V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 11, Page no: 182"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "# Variables\n",
      "pH = 7                  # O2\n",
      "Eo = 1.229              # V\n",
      "pO2 = 0.20              # bar\n",
      "\n",
      "# Solution\n",
      "print \"Nearnst's equation at 25C is,\"\n",
      "print \"E = Eo - (0.0592 / 2) * log(1 / ([H+]^2 * [pO2]^ (1/2)))\"\n",
      "E = Eo - (0.0592 / 2) * log10(1.0 / (((10 ** (- 7)) ** 2) * (pO2 ** (1 / 2.0))))\n",
      "print \"The reduction potential for the reduction is\",\n",
      "print \"{:.3f}\".format(E), \"V\"\n",
      "# descrepency due to calculation error in the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nearnst's equation at 25C is,\n",
        "E = Eo - (0.0592 / 2) * log(1 / ([H+]^2 * [pO2]^ (1/2)))\n",
        "The reduction potential for the reduction is 0.804 V\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 12, Page no: 183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "E_KCl = 0.2415              # V\n",
      "E_cell = 0.445              # V\n",
      "\n",
      "\n",
      "# Solution\n",
      "print \"Emf of the cell is\"\n",
      "print \"At 25C,\"\n",
      "print \"E = Er - El = Eref - ((RT)/ F) * ln H+\"\n",
      "pH = (E_cell - E_KCl) / 0.059\n",
      "\n",
      "Eo_cell = - 0.8277          # V\n",
      "print \"Thus, equilibrium constant for the reaction\"\n",
      "print \"\\t 2H2O --> H3O+  + OH- may be calculated as\"\n",
      "K = 10 ** (Eo_cell / 0.0591)\n",
      "print \"K =\", \"{:.0e}\".format(K)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Emf of the cell is\n",
        "At 25C,\n",
        "E = Er - El = Eref - ((RT)/ F) * ln H+\n",
        "Thus, equilibrium constant for the reaction\n",
        "\t 2H2O --> H3O+  + OH- may be calculated as\n",
        "K = 1e-14\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 13, Page no: 183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "EoSn = 0.15             # V\n",
      "EoCr = - 0.74           # V\n",
      "\n",
      "# Solution\n",
      "print \"3Sn+4  +  2Cr  -->  3Sn+2 + 2Cr+3\"\n",
      "Eo_cell = EoSn - EoCr\n",
      "n = 6\n",
      "K = 10 ** (n * Eo_cell / 0.0591)\n",
      "print \"The equillibrium constant for th reaction is\", \"{:.2e}\".format(K)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "3Sn+4  +  2Cr  -->  3Sn+2 + 2Cr+3\n",
        "The equillibrium constant for th reaction is 2.27e+90\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 14, Page no: 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "T = 25                  # C\n",
      "Eo = - 0.8277           # V\n",
      "\n",
      "# Solution\n",
      "print \"The reversible reaction,\"\n",
      "print \"2H2O  <--> H3O+ + OH-\"\n",
      "print \"May be divided into two parts.\"\n",
      "print \"2H2O + e- --> 1/2 H2 + OH-    (cathode) Eo = -0.8277 V\"\n",
      "print \"H2O  + 1/2 H2 --> H3O+ + e-   (anode) Eo = 0\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reversible reaction,\n",
        "2H2O  <--> H3O+ + OH-\n",
        "May be divided into two parts.\n",
        "2H2O + e- --> 1/2 H2 + OH-    (cathode) Eo = -0.8277 V\n",
        "H2O  + 1/2 H2 --> H3O+ + e-   (anode) Eo = 0\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 15, Page no: 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "E = 0.4                 # V\n",
      "\n",
      "# Solution\n",
      "print \"The cell is Pt(H2) | H+, pH2 = 1 atm\"\n",
      "print \"The cell reaction is\"\n",
      "print \"1/2 H2 --> H+ + e-\"\n",
      "pH = E / 0.0591\n",
      "print \"pH =\", \"{:.3f}\".format(pH)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The cell is Pt(H2) | H+, pH2 = 1 atm\n",
        "The cell reaction is\n",
        "1/2 H2 --> H+ + e-\n",
        "pH = 6.768\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}