{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3: Thermodynamic and Chemical Equilibrium"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 1, Page no: 105"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "q = 120                     # Heat from surrounding, cal\n",
      "W = 70                      # Work done, cal\n",
      "\n",
      "# Solution\n",
      "delta_E = q - W\n",
      "\n",
      "print \"Change in internal Energy\", delta_E, \"cals.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in internal Energy 50 cals.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 2, Page no: 105"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print \"CH4 (g) + 2O2 (g) -> CO2 (g) + 2H20 (l)\"\n",
      "delta_n = 1 - (1 + 2)\n",
      "solution = - 2 * 2 * 298                        # cals\n",
      "print \"Delta H - Delta E is:\", solution, \"cals\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "CH4 (g) + 2O2 (g) -> CO2 (g) + 2H20 (l)\n",
        "Delta H - Delta E is: -1192 cals\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 3, Page no: 105"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "delta_G = -16.0                 # Kelvin cal\n",
      "delta_H = -10.0                 # Kelvin cal\n",
      "T = 300                         # Kelvin\n",
      "\n",
      "# Solution\n",
      "delta_S = (delta_H - delta_G) * 10 ** 3 / T    # cal/deg\n",
      "new_T = 330                     # Kelvin\n",
      "new_delta_G = (delta_H * 10 ** 3) - new_T * delta_S\n",
      "\n",
      "print \"The free energy at 330K is:\", \"{:.2e}\".format(new_delta_G), \"K cal\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The free energy at 330K is: -1.66e+04 K cal\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 4, Page no: 106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "delta_S = -20.7                     # cal /deg /mol\n",
      "delta_H = -67.37                    # K cal\n",
      "T = 25                              # deg C\n",
      "\n",
      "# Solution\n",
      "T += 273                            # K\n",
      "delta_G = delta_H - (T * delta_S * 10 ** -3)\n",
      "print \"The change in free energy at 25deg C is:\", delta_G, \"K cal / mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in free energy at 25deg C is: -61.2014 K cal / mol\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 5, Page no: 106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "wt = 1                  # g\n",
      "delta_H = 149           # joules\n",
      "\n",
      "# Solution\n",
      "delta_H_fusion = delta_H * (10 * 12 + 8 * 1)\n",
      "print \"Enthalpy of fusion of naphthalene:\", delta_H_fusion * 10 ** -3, \"kJ/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Enthalpy of fusion of naphthalene: 19.072 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 6, Page no: 106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "delta_H_acetylene = 230             # kJ/mol\n",
      "delta_H_benzene = 85                # kJ/mol\n",
      "T = 298                             # K\n",
      "\n",
      "# Solution\n",
      "delta_H = delta_H_benzene - 3 * delta_H_acetylene\n",
      "print \"The enthalpy change for the reaction is:\", delta_H, \"kJ/mole\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy change for the reaction is: -605 kJ/mole\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 7, Page no: 106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Constant\n",
      "delta_H_vap = 2.0723                # kJ/g\n",
      "Tb = 373                            # K\n",
      "\n",
      "# Solution\n",
      "delta_H_vap *= 18                   # kJ/mol\n",
      "delta_S = delta_H_vap / Tb\n",
      "delta_G = delta_H_vap - Tb * delta_S\n",
      "delta_S *= 1000\n",
      "\n",
      "print \"The Entropy change is:\", \"{:.1f}\".format(delta_S), \"J/mol/K\"\n",
      "print \"The Free Energy change is:\", delta_G, \"kJ/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Entropy change is: 100.0 J/mol/K\n",
        "The Free Energy change is: 0.0 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 8, Page no: 106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Constant\n",
      "R = 1.987               # cal /K /mol\n",
      "\n",
      "# Variables\n",
      "moles = 5\n",
      "Vo = 4                  # litres, Initial Volume\n",
      "Vf = 40                 # litres, Final Volume\n",
      "T = 27                  # deg C\n",
      "\n",
      "# Solution\n",
      "print \"dS = nRln(V2 / V1)\"\n",
      "dS = moles * R * 2.303 * math.log10(Vf / Vo)\n",
      "print \"The change in entropy is:\", \"{:.2f}\".format(dS), \"cal / degree\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "dS = nRln(V2 / V1)\n",
        "The change in entropy is: 22.88 cal / degree\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 9, Page no: 107"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "wt = 10                     # g\n",
      "heat_abs = 4.5              # K\n",
      "\n",
      "# Solution\n",
      "mole = 10 / 100.0             # mol\n",
      "delta_H = heat_abs / mole\n",
      "print \"The heat of the reaction is:\", delta_H, \"K cal / mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat of the reaction is: 45.0 K cal / mol\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 10, Page no: 107"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Constant\n",
      "R = 8.314                   # J / K\n",
      "\n",
      "# Variables\n",
      "V_O2 = 2.8                  # litres\n",
      "V_H2 = 19.6                 # litres\n",
      "\n",
      "# Solution\n",
      "na = V_O2 / 22.4            # mol\n",
      "nb = V_H2 / 22.4            # mol\n",
      "Xa = na / (na + nb)\n",
      "Xb = nb / (na + nb)\n",
      "delta_S = (- R) * (na * math.log(Xa) + nb * math.log(Xb))\n",
      "\n",
      "print \"The increase in entropy on mixing is:\", \"{:.3f}\".format(delta_S), \"J / K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The increase in entropy on mixing is: 3.132 J / K\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 11, Page no: 107"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Solution\n",
      "print \"For 1 mole of ideal gas,\"\n",
      "print \"\\tPV = RT or T = (PV) / R\\n\"\n",
      "print \"Differentiating with respect to V at constant P,\"\n",
      "print \"\\t[dT/dV]p = P/R\\n\"\n",
      "print \"Differentiating again with respect oto P at constant V\"\n",
      "print \"\\t[d2T/(dV*dP)] = 1/R\\n\"\n",
      "print \"Now differectiating with respect to P at constant V,\"\n",
      "print \"\\t[dT/dP]v = V/R\\n\"\n",
      "print \"Differentiating again with respect to V at constant P,\"\n",
      "print \"\\t[d2T/(dV*dP)] = 1/R\\n\"\n",
      "print \"From equations we get:\"\n",
      "print \"\\t[d2T/(dV*dP)] = [d2T/(dV*dP)]\\n\"\n",
      "print \"Hence, dT is a perfect differential.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For 1 mole of ideal gas,\n",
        "\tPV = RT or T = (PV) / R\n",
        "\n",
        "Differentiating with respect to V at constant P,\n",
        "\t[dT/dV]p = P/R\n",
        "\n",
        "Differentiating again with respect oto P at constant V\n",
        "\t[d2T/(dV*dP)] = 1/R\n",
        "\n",
        "Now differectiating with respect to P at constant V,\n",
        "\t[dT/dP]v = V/R\n",
        "\n",
        "Differentiating again with respect to V at constant P,\n",
        "\t[d2T/(dV*dP)] = 1/R\n",
        "\n",
        "From equations we get:\n",
        "\t[d2T/(dV*dP)] = [d2T/(dV*dP)]\n",
        "\n",
        "Hence, dT is a perfect differential.\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 12, Page no: 108"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "delta_G_25 = - 85.77                # k J, Free Energy at 25 C\n",
      "delta_G_35 = - 83.68                # k J, Free Energy at 35 C\n",
      "Ti = 273 + 25                       # K\n",
      "Tf = 273 + 35                       # K\n",
      "\n",
      "# Solution\n",
      "print \"Equating the entropy change at both the temperatures.\"\n",
      "print \"(delta_H + delta_G_25) / Ti = (delta_H + delta_G_35) / Tf\"\n",
      "delta_H = - 148\n",
      "print \"The change in enthalpy for the process at 30C is\", delta_H, \"kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Equating the entropy change at both the temperatures.\n",
        "(delta_H + delta_G_25) / Ti = (delta_H + delta_G_35) / Tf\n",
        "The change in enthalpy for the process at 30C is -148 kJ\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 13, Page no: 108"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Constants\n",
      "Lv = 101                    # cal /g, Latent headt of vap.\n",
      "mwt = 78                    # molecular weight of benzene\n",
      "\n",
      "# Variable\n",
      "moles = 2\n",
      "Tb = 80.2                   # C, boiling point of benzene\n",
      "\n",
      "# Solution\n",
      "Tb += 273                   # K\n",
      "delta_H = Lv * mwt\n",
      "delta_S = delta_H / Tb\n",
      "delta_G = delta_H - Tb * delta_S\n",
      "print \"delta_S =\", \"{:.2f}\".format(delta_S), \"cal / K\"\n",
      "print \"delta_G = delta_A =\", delta_G\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "delta_S = 22.30 cal / K\n",
        "delta_G = delta_A = 0.0\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 14, Page no: 109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "V1 = 6                      # dm^3\n",
      "V2 = 2                      # dm^3\n",
      "T1 = 27                     # C\n",
      "moles = 5\n",
      "\n",
      "# Solution\n",
      "print \"T1*V1 ^ (gamma - 1) = T2 * V2 ^ (gamma - 1)\"\n",
      "T1 += 273                   # K\n",
      "T2 = T1 * (V1 / V2) ** (8.314 / 20.91)\n",
      "print \"The final temperature is\", \"{:.1f}\".format(T2), \"K\"\n",
      "q = 0                       # Adiabatic process\n",
      "delta_E = - moles * 20.91 * (T2 - T1)\n",
      "delta_E /= 1000\n",
      "print \"q = \", q\n",
      "print \"Change is Energy is\", \"{:.2f}\".format(delta_E), \"kJ / mol\"\n",
      "W = - delta_E\n",
      "print \"W = \", \"{:.2f}\".format(delta_E), \"kJ / mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T1*V1 ^ (gamma - 1) = T2 * V2 ^ (gamma - 1)\n",
        "The final temperature is 464.3 K\n",
        "q =  0\n",
        "Change is Energy is -17.18 kJ / mol\n",
        "W =  -17.18 kJ / mol\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 15, Page no: 109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Constant\n",
      "R = 8.314                       # J / K mol\n",
      "\n",
      "# Variables\n",
      "mole = 1\n",
      "V1 = 5                          # dm^3\n",
      "V2 = 10                         # dm^3\n",
      "T = 300                         # K\n",
      "\n",
      "# Solution\n",
      "print \"For isothermal and reversible process,\"\n",
      "delta_E = delta_H = 0\n",
      "delta_A = delta_G = - 2.303 * mole * R * T * math.log10(V2 / V1)\n",
      "q = W = - delta_G\n",
      "print \"delta_E = delta_H =\", delta_H\n",
      "print \"delta_G = delta_A =\", \"{:.3f}\".format(delta_G), \"J / mol\\n\"\n",
      "print \"For isothermal and reversible expansion\"\n",
      "print \"q = W = -delta_G =\", \"{:.3f}\".format(W), \"J / mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For isothermal and reversible process,\n",
        "delta_E = delta_H = 0\n",
        "delta_G = delta_A = -1729.159 J / mol\n",
        "\n",
        "For isothermal and reversible expansion\n",
        "q = W = -delta_G = 1729.159 J / mol\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 16, Page no: 109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Constant\n",
      "R = 8.314                       # J / K mol\n",
      "\n",
      "# Variables\n",
      "n = 5                           # moles\n",
      "T = 27                          # C\n",
      "V1 = 50.0                         # L, Initial Volume\n",
      "V2 = 1000                       # L, Final Volume\n",
      "\n",
      "# Solution\n",
      "T += 273\n",
      "delta_G = 2.303 * n * R * T * math.log10(V1 / V2)\n",
      "delta_G /= 1000\n",
      "print \"The free energy change is\", \"{:.3f}\".format(delta_G), \"k J\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The free energy change is -37.367 k J\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 17, Page no: 110"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "delta_H_neu = - 51.46                   # k J/mol, neutralization\n",
      "delta_H_ion = - 57.1                    # k J/mol, ionization\n",
      "\n",
      "# Solution\n",
      "delta_H = - delta_H_ion + delta_H_neu\n",
      "print \"The head of ionization for NH4OH is\", delta_H, \"kJ / mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The head of ionization for NH4OH is 5.64 kJ / mol\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 18, Page no: 110"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print \"For 1 mole of an ideal gas,\"\n",
      "print \"PV = RT or V = (RT)/P\"\n",
      "print \"(dV/ dP) = -(RT/P^2)\\t (at constant temperature)\"\n",
      "print \"(d^2V/ (dP*dT)) = -(R/ P^2)\"\n",
      "print \"(dV/ dT) = (R/ P)\\t (at constant pressure)\"\n",
      "print \"(d^2V/ (dT*dP)) = -(R/ P^2)\\n\"\n",
      "print \"(d^2V/ (dT*dP)) = (d^2V/ (dP*dT))\\t[From above equations]\"\n",
      "print \"Hence, dV is an exact differential.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For 1 mole of an ideal gas,\n",
        "PV = RT or V = (RT)/P\n",
        "(dV/ dP) = -(RT/P^2)\t (at constant temperature)\n",
        "(d^2V/ (dP*dT)) = -(R/ P^2)\n",
        "(dV/ dT) = (R/ P)\t (at constant pressure)\n",
        "(d^2V/ (dT*dP)) = -(R/ P^2)\n",
        "\n",
        "(d^2V/ (dT*dP)) = (d^2V/ (dP*dT))\t[From above equations]\n",
        "Hence, dV is an exact differential.\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 19, Page no: 110"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print \"Let P1, V1, T1 and P2, V2, T2 b the initial and final\",\n",
      "print \"state, respectively of the system\"\n",
      "print \"W rev = nRT[P1/ P2 - 1]\"\n",
      "print \"W irr = nRT[1 - P2/ P1]\"\n",
      "print \"W rev - W irr = [nRT/(P1P2)]*(P1 - P2)^2\"\n",
      "print \"Because RHS of the above equation is always positive,\"\n",
      "print \"W rev > W irr\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Let P1, V1, T1 and P2, V2, T2 b the initial and final state, respectively of the system\n",
        "W rev = nRT[P1/ P2 - 1]\n",
        "W irr = nRT[1 - P2/ P1]\n",
        "W rev - W irr = [nRT/(P1P2)]*(P1 - P2)^2\n",
        "Because RHS of the above equation is always positive,\n",
        "W rev > W irr\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 20, Page no: 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Solution\n",
      "Eq_HI = 1.56 / 2\n",
      "Eq_H2 = 0.22 / 2\n",
      "Eq_I2 = 0.22 / 2\n",
      "Kc = Eq_H2 * Eq_I2 / (Eq_HI ** 2)\n",
      "print \"The equilibrium constant for the dissociation reaction\",\n",
      "print \"{:.4f}\".format(Kc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equilibrium constant for the dissociation reaction 0.0199\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 21, Page no: 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "Kc = 0.5                    # / mole^2 litre^2\n",
      "T = 400                     # K\n",
      "R = 0.082                   # litre atm degree^-1 mole^-1\n",
      "\n",
      "# Solution\n",
      "Kp = Kc * (R * T) ** (-2)\n",
      "\n",
      "print \"The given equilibrium is\"\n",
      "print \"\\t\\tN2(g) + 3H2(g) <--> 2NH3(g)\"\n",
      "print \"Kp is\", \"{:.3e}\".format(Kp)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The given equilibrium is\n",
        "\t\tN2(g) + 3H2(g) <--> 2NH3(g)\n",
        "Kp is 4.648e-04\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 22, Page no: 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "solubility = 7.5 * 10 ** - 5        # mol L^-1\n",
      "\n",
      "# Solution\n",
      "Ksp = 4 * (solubility ** 3)\n",
      "print \"Solubility product of the salt is\", \"{:.4e}\".format(Ksp), \"mol^3 / L^-3\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Solubility product of the salt is 1.6875e-12 mol^3 / L^-3\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 23, Page no: 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "Ti = 25                         # C\n",
      "S = 0.00179            # g / L\n",
      "\n",
      "# Solution\n",
      "S /= 170                        # mol / L\n",
      "Ksp = S ** 2\n",
      "print \"Solubility product at 25 C is\", \"{:.4e}\".format(Ksp), \"mol^2 / L^-2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Solubility product at 25 C is 1.1087e-10 mol^2 / L^-2\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 24, Page no: 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "Ksp = 8 * 10 ** - 5               # Solubility product PbBr2\n",
      "disso = 80 / 100                  # % dissociation\n",
      "\n",
      "# Solution\n",
      "S = (Ksp / 4) ** (1 / 3.0)          # Solubility is 100%\n",
      "S_80 = S * (80 / 100.0)\n",
      "S_per_g = S_80 * 367 - 1.621\n",
      "print \"Solubility in gm per litre is\", \"{:.3f}\".format(S_per_g), \"gm / litre\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Solubility in gm per litre is 6.349 gm / litre\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 25, Page no: 112"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "n_acid = 1                          # mole\n",
      "n_alcohol = 1                       # mole\n",
      "T = 25                              # C\n",
      "x = 0.667                           # mole\n",
      "\n",
      "# Solution\n",
      "print \"Kc = [CH3COOC2H][H2O] / ([CH3COOH][C2H2OH])\"\n",
      "Kc = 4\n",
      "print \"[CH3COOH] = (2 - x) / V\"\n",
      "print \"[C2H5OH] = (1 - x) / V\"\n",
      "print \"[CH3COOC2H5] = [H20] = x / V\"\n",
      "print \"3x^2 - 12x + 8 = 0\"\n",
      "print \"x =\", 2.366, \"or\", 0.634\n",
      "print \"0.634 mole of ester would be formed, because the other value,\",\n",
      "print \"x = 2.366, is not permissible.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Kc = [CH3COOC2H][H2O] / ([CH3COOH][C2H2OH])\n",
        "[CH3COOH] = (2 - x) / V\n",
        "[C2H5OH] = (1 - x) / V\n",
        "[CH3COOC2H5] = [H20] = x / V\n",
        "3x^2 - 12x + 8 = 0\n",
        "x = 2.366 or 0.634\n",
        "0.634 mole of ester would be formed, because the other value, x = 2.366, is not permissible.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 26, Page no: 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "n_acid = 0.2                          # mole\n",
      "n_salt = 0.10                         # mole\n",
      "Ka = 1.8 * 10 ** -5\n",
      "\n",
      "# Solution\n",
      "pH = - math.log10(Ka) + math.log10(n_salt / n_acid)\n",
      "print \"The pH of acidic buffer is\", \"{:.3f}\".format(pH)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pH of acidic buffer is 4.444\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 27, Page no: 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "n_salt = 0.02               # mole\n",
      "n_base = 0.2                # mole\n",
      "pKb = 4.7\n",
      "\n",
      "# Solution\n",
      "pOH = pKb + math.log10(n_salt / n_base)\n",
      "pH = 14 - pOH\n",
      "print \"pH of a buffer solution is\", pH\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "pH of a buffer solution is 10.3\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem: 28, Page no: 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "n_H2 = 8.07                     # moles\n",
      "n_I2 = 9.08                     # moles\n",
      "T = 448                         # C\n",
      "n_eqHI2 = 13.38                 # moles\n",
      "\n",
      "# Solution\n",
      "x = n_eqHI2 / 2 + 6.69\n",
      "Kc = n_eqHI2 ** 2 / (n_H2 * n_I2)\n",
      "\n",
      "print \"H2   +   I2 <--> 2HI\"\n",
      "print \"1         0       0\"\n",
      "print \"1 - 2xx   x       x\"\n",
      "print \"x/(1 - 2x) = (1/Kc)^0.5\"\n",
      "print \"Dissociation constant of HI is 106.75 x 10^-3\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "H2   +   I2 <--> 2HI\n",
        "1         0       0\n",
        "1 - 2xx   x       x\n",
        "x/(1 - 2x) = (1/Kc)^0.5\n",
        "Dissociation constant of HI is 106.75 x 10^-3\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}