{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5:The second Law of Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.1,Page no:59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "T1=373.0 \t\t\t\t#initial temperature [K]\n",
      "T2=573.0 \t\t\t\t#final temperature [K]\n",
      "Q2=750.0 \t\t\t\t#Heat absorbed by carnot engine[J]\n",
      "\n",
      "e=(T2-T1)/T2 \t\t\t#efficiency of the engine\n",
      "W=e*Q2 \t\t\t\t#Workdone by the engine[J]\n",
      "Q1=T1*Q2/T2 \t\t\t#Heat rejected by the engine[J]\n",
      "print\"Efficiency of the engine =\",round(e,3) \n",
      "print\"\\n Workdone by the engine =\",round(W),\"J\"\n",
      "print\"\\n Heat rejected by the engine =\",round(Q1),\"J\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency of the engine = 0.349\n",
        "\n",
        " Workdone by the engine = 262.0 J\n",
        "\n",
        " Heat rejected by the engine = 488.0 J\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2,Page no:61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "T1=250.0 #temperature of heat rejection[K]\n",
      "T2=1000.0 #temperature of heat absorption[K]\n",
      "e=1-(T1/T2) \n",
      "print\"Efficiency of the corresponding carnot engine =\",e,\"or\",e*100,\"%\"\n",
      "print\" Therefore , the inventors claim of 80% efficiency is absurd.The patent application should be rejected\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency of the corresponding carnot engine = 0.75 or 75.0 %\n",
        " Therefore , the inventors claim of 80% efficiency is absurd.The patent application should be rejected\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3,Page no:62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "T1=323.0 \t\t\t\t#temperature [K]\n",
      "T2=423.0 \t\t\t\t#temperature [K]\n",
      "W=1.3 \t\t\t\t#work [KJ]\n",
      "e=(T2-T1)/T2 \t\t\t#efficiency\n",
      "Q2=W/e \t\t\t\t#minimum heat withdrawal from heat source[KJ]\n",
      "print\"Minimum heat withdrawal from heat source=\",round(Q2,2),\"kJ\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum heat withdrawal from heat source= 5.5 kJ\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5,Page no:64"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "T=298 \t\t\t#Temperature [K]\n",
      "n=1 \t\t\t#no. of moles\n",
      "V1=500 \t\t\t#initial volume [cm3]\n",
      "V2=1000 \t\t#final volume [cm3]\n",
      "R=8.314 \t\t#Universal gas constant [J/mol/K]\n",
      "import math\n",
      "S=R*math.log(V2/V1)\t\t#molar entropy change at constant temperature[J/K]\n",
      "print\"Molar entropy change of argon =\",round(S,1),\"J/K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Molar entropy change of argon = 5.8 J/K\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.6,Page no:64"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "W=1728.0 \t\t\t#Isothermal and reversible work done[J/mol]\n",
      "T=298.0 \t\t\t#Isothermal temperature[K]\n",
      "\n",
      "S=W/T \t\t\t#change in molar entropy for isothermal and reversible process\n",
      "print\"The change in molar entropy =\",round(S,1),\"JK^-1mol^-1\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in molar entropy = 5.8 JK^-1mol^-1\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7,Page no:68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "H=-92.22 \t\t\t#Standard reaction enthalpy[KJ]\n",
      "T=298 \t\t\t\t#Temperature [K]\n",
      "\n",
      "\t#standard reaction enthalpy is H.Therefore, heat gained by the surroundings at 298K is -H\n",
      "S=-H*1000/T \t\t\t#Change in entropy[J/K]\n",
      "print\"Change in entropy of the surroundings at 298k =\",round(S,1),\"J/K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in entropy of the surroundings at 298k = 309.5 J/K\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.8,Page no:69"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "T1=298.0 \t\t\t\t#Initial Temperature[K]\n",
      "T2=573.0 \t\t\t\t#Final Temperature[K]\n",
      "Cv=29.1 \t\t\t#Specific Heat capacity of argon gas [J/K/mol]\n",
      "n=1 \t\t\t\t#no. of moles\n",
      "\n",
      "import math\n",
      "S=n*Cv*math.log(T2/T1) \t\t#Change in entropy [J/K]\n",
      "print\"The change in entropy of the argon gas is\",round(S,2),\"J/K\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in entropy of the argon gas is 19.03 J/K\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 5.9,Page no:69"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "T1=276.0 \t\t\t\t#Initial temperature[K]\n",
      "Tf=278.7 \t\t\t#Freezing point temperature[K]\n",
      "Tb=353.3 \t\t\t#Boiling point temperature[K]\n",
      "T2=373.0 \t\t\t\t#Final temperature[K]\n",
      "Hf=9870.0 \t\t\t#Standard enthalpy of fusion[J/mol]\n",
      "Hv=30800.0 \t\t\t#Standard enthalpy of vaporization[J/mol]\n",
      "Cp=136.1 \t\t\t#Specific heat capacity of benzene[J/K/mol]\n",
      "mol_wt=78.0 \t\t\t#molecular weight of benzene[g/mol]\n",
      "mass=200.0\t\t\t#weight of solid benzene[g]\n",
      "print\"Cp doesnot change within this temp limit\" \n",
      "import math\n",
      "n=mass/mol_wt \t\t\t#no. of moles\n",
      "\n",
      "S1=n*Cp*math.log(Tf/T1) \t#entropy change in heating [J/K]\n",
      "S2=n*Hf/Tf \t\t\t#entropy change in melting[J/K] \n",
      "S3=n*Cp*math.log(Tb/Tf) \t#entropy change in heating[J/K]\n",
      "S4=n*Hv/Tb \t\t\t#entropy change in vaporization[J/K]\n",
      "S5=n*Cp*math.log(T2/Tb) \t#entropy change in heating[J/K]\n",
      "S=S1+S2+S3+S4+S5 \t\t#total entropy change in heating from 276 to 373K\n",
      "print\"Total entropy change in heating 200g benzene from 3 to 100`C is\",round(S,1),\"J/K or\",round(S/1000,3),\"KJ/K\"\n",
      "print\"\\nNOTE:In textbook the value of 'n' is wrongly calculated as 25.64 instead of 2.564,SO there is a error in answer shown in book\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cp doesnot change within this temp limit\n",
        "Total entropy change in heating 200g benzene from 3 to 100`C is 419.4 J/K or 0.419 KJ/K\n",
        "\n",
        "NOTE:In textbook the value of 'n' is wrongly calculated as 25.64 instead of 2.564,SO there is a error in answer shown in book\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.10,Page no:71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "mass=32 \t\t\t#weight of methane gas[gm]\n",
      "P1=6*10**5 \t\t\t#Initial temperature[N/m2]\n",
      "P2=3*10**5 \t\t\t#Final pressure[N/m2]\n",
      "mol_wt=16 \t\t\t#molecular weight of methane gas[g/mol]\n",
      "T=298 \t\t\t\t#Temperature[K]\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "import math\t\n",
      "n=mass/mol_wt \t\t\t#no. of moles\n",
      "S=n*R*math.log(P1/P2) \t\t#change in entropy of gas[J/K]\n",
      "\n",
      "print\"The change in entropy of the gas is\",round(S,2),\"J/K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in entropy of the gas is 11.53 J/K\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.11,Page no:75"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "black=2              #No. of black balls\n",
      "white=1              #No. of white ball\n",
      "\n",
      "\n",
      "W=math.factorial(black+white)/(math.factorial(black)*math.factorial(white))\n",
      "P=1.0/W\n",
      "E1=0+1+2\n",
      "E2=E1\n",
      "E3=E2\n",
      "E=E1+E2+E3\n",
      "E_av=E/3\n",
      "E1_dash=1+2+3\n",
      "E2_dash=E1_dash\n",
      "E3_dash=E2_dash\n",
      "E_dash=E1_dash+E2_dash+E3_dash\n",
      "change=E_dash-E\n",
      "\n",
      "print\"1.Total No. of possible configuration:\",W\n",
      "print\"2.Probability of getting a configuration=\",P,\"or 1/3\"\n",
      "print\"3.Total energy of system=\",E\n",
      "print\"  Therefore,Average energy=\",E_av\n",
      "print\"4.In this case,Total energy=\",E_dash\n",
      "print\"  Change in total energy of system=\",change"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1.Total No. of possible configuration: 3\n",
        "2.Probability of getting a configuration= 0.333333333333 or 1/3\n",
        "3.Total energy of system= 9\n",
        "  Therefore,Average energy= 3\n",
        "4.In this case,Total energy= 18\n",
        "  Change in total energy of system= 9\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.12,Page no:77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "n=1.0 \t\t\t#no. of moles\n",
      "T=273.0 \t\t\t#temperature [K]\n",
      "Hf=6000.0 \t\t#enthalpy of fusion at 273K [J/mol]\n",
      "k=1.38*(10**-23) \t#boltzmann constant[J/K]\n",
      "\n",
      "p=Hf/(k*T)/2.303 \n",
      "print\"\\nTHE RESULT IS 10^24,which is too large to be displayed by ipython \"\n",
      "print\"This value of w is very large to calculate for python,because it's in the range of 10^24\"\n",
      "print\"The relative no. of distinguishable quantum states in 1 mole of water and ice at 273K is 10^24\" \n",
      "print\"\\nTHE RESULT IS 10^24,which is too large to be displayed by ipython \"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "THE RESULT IS 10^24,which is too large to be displayed by ipython \n",
        "This value of w is very large to calculate for python,because it's in the range of 10^24\n",
        "The relative no. of distinguishable quantum states in 1 mole of water and ice at 273K is 10^24\n",
        "\n",
        "THE RESULT IS 10^24,which is too large to be displayed by ipython \n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.13,Page no:86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "T=300 \t\t\t#temperature[K]\n",
      "n=4 \t\t\t#no. of moles of an ideal gas\n",
      "P1=2.02*10**5 \t\t#initial pressure[N/m2]\n",
      "P2=4.04*10**5 \t\t#final pressure[N/m2]\n",
      "R=8.314 \t\t#Universal gas constant[J/K/mol]\n",
      "import math\n",
      "G=n*R*T*2.303*math.log10(P2/P1) \t#[J]\n",
      "print\" The change in Gibbs free energy is\",round(G,1),\"J\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The change in Gibbs free energy is 6916.6 J\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.14,Page no:86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "n=1 \t\t\t#no. of moles\n",
      "T=300 \t\t\t#temperature[K]\n",
      "V1=2 \t\t\t#initial volume[m3]\n",
      "V2=20 \t\t\t#final volume[m3]\n",
      "R=8.314 \t\t#Universal gas constant[J/K/mol]\n",
      "import math\n",
      "\t\n",
      "A=-n*R*T*2.303*math.log10(V2/V1) \t#Change in work function[J/mol]\n",
      "print\"The change in Helmholts free energy is\",round(A),\"J/mol\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in Helmholts free energy is -5744.0 J/mol\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15,Page no:87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"C6H12O6(s) + 6O2(g) --> 6CO2(g) + 6H2O(l)\"\n",
      "T=298 \t\t\t\t#Temperature[k]\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "S=182.45 \t\t\t#standard entropy change at 298K [J/K]\n",
      "U=-2808 \t\t\t#change in internal energy at 298K[KJ/mol]\n",
      "\t#reaction is taking place in bomb calorimeter so no volume change \n",
      "\t#therefore U=Q at constant volume\n",
      "\t\n",
      "A=U-T*S*0.001 \t\t\t#Energy extracted as heat[KJ/mol]\n",
      "Wmax=A \t\t\t\t#work done [KJ/mol]\n",
      "dn=6-6 \t\t\t\t#change in no. of moles\n",
      "H=U+dn*R*T \t\t\t#Change in enthalpy of the bomb calorimeter[KJ]\n",
      "print\"The energy change that can be extracted as heat is\",round(A),\"KJ/mol\"\n",
      "print\"\\nThe energy change that can be extracted as work is\",round(-A),\"KJ/mol\"\n",
      "print\"\\nThe change in enthalpy of bomb calorimeter is\",round(H),\"KJ/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C6H12O6(s) + 6O2(g) --> 6CO2(g) + 6H2O(l)\n",
        "The energy change that can be extracted as heat is -2862.0 KJ/mol\n",
        "\n",
        "The energy change that can be extracted as work is 2862.0 KJ/mol\n",
        "\n",
        "The change in enthalpy of bomb calorimeter is -2808.0 KJ/mol\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.16,Page no:87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "print\"C8H18(g)+12.5O2(g)-->8CO2(g)+9H2O(l)\" \n",
      "\n",
      "T=298.0 \t\t\t\t#temperature[K]\n",
      "S=421.5 \t\t\t#change in entropy[J/K]\n",
      "H=-5109000.0 \t\t\t#Heat of reaction[J]\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "dn=8-(1+12.5) \t\t\t#change in no. of moles\n",
      "\n",
      "U=H \t\t\t\t#[J]\n",
      "A=U-T*S \t\t\t#Change in helmholts free energy[J]\n",
      "G=A+dn*R*T \t\t\t#Change in Gibbs free energy[J]\n",
      "print\"The change in Helmholts free energy is\",round(A),\"J\"\n",
      "print\"\\nThe change in Gibbs free energy is\",round(G),\"J\"\n",
      "print\"The calculation is not precise in book,that's why a slight change in answer\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C8H18(g)+12.5O2(g)-->8CO2(g)+9H2O(l)\n",
        "The change in Helmholts free energy is -5234607.0 J\n",
        "\n",
        "The change in Gibbs free energy is -5248234.0 J\n",
        "The calculation is not precise in book,that's why a slight change in answer\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.17,Page no:88"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"C3H6(g)+4.5O2(g)-->3CO2(g)+3H2O(l)\" \n",
      "S=-339.23 \t\t\t#standard change in entropy [J/K]\n",
      "T=298 \t\t\t\t#temperature[K]\n",
      "Hf1=20.42 \t\t\t#enthalpy of formation of C3H6(g)[J]\n",
      "Hf2=-393.51 \t\t\t#enthalpy of formation of CO2(g)[J]\n",
      "Hf3=-285.83 \t\t\t#enthalpy of formation of H2O(l)[J]\n",
      "dn=3-4.5-1 \t\t\t#change in no. of moles\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "\n",
      "H=3*Hf2+3*Hf3-Hf1 \t\t#Enthalpy of the reaction[J]\n",
      "U=H-dn*R*0.001*T \t\t#Change in internal energy of the reaction[J]\n",
      "A=U-T*S*0.001 \t\t\t#Helmholts free energy change[J]\n",
      "G=A+dn*R*0.001*T \t\t#Gibbs free energy change[J]\n",
      "print\"The change in Helmholts free energy is\",round(A,2),\"kJ\"\n",
      "print\"\\nThe change in Gibbs free energy is\",round(G,2),\"kJ\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C3H6(g)+4.5O2(g)-->3CO2(g)+3H2O(l)\n",
        "The change in Helmholts free energy is -1951.16 kJ\n",
        "\n",
        "The change in Gibbs free energy is -1957.35 kJ\n"
       ]
      }
     ],
     "prompt_number": 56
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.19,Page no:92"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"CH4(g)+2O2(g)-->CO2(g)+2H2O(l)\"\n",
      "\n",
      "S1=-242.98 \t\t\t\t#standard entropy change for the combustion reaction[J/K]\n",
      "Hf1=-74.81 \t\t\t\t#Enthalpy of formation of CH4(g)[KJ/mol]\n",
      "Hf2=-393.51 \t\t\t\t#Enthalpy of formation of CO2(g)[KJ/mol]\n",
      "Hf3=-285.83 \t\t\t\t#Enthalpy of formation of H2O(l)[KJ/mol]\n",
      "T=298 \t\t\t\t\t#temperature[K]\n",
      "\t \n",
      "H=Hf2+2*Hf3-Hf1 \t\t\t#Change in enthalpy of reaction[KJ]\n",
      "S2=-H*1000/T \t\t\t\t#Change in entropy of the surrounding[J/K]\n",
      "Stotal=(S1+S2)*0.001 \t\t\t#Total entropy change \n",
      "print\"The total change in entropy is\",round(Stotal,2),\"KJ/K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "CH4(g)+2O2(g)-->CO2(g)+2H2O(l)\n",
        "The total change in entropy is 2.74 KJ/K\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.20,Page no:93"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"2H2(g)+O2(g)-->2H2O(l)\" \n",
      "Hf1=-285.83 \t\t\t\t#standard enthalpy of formation of H2O(l)[KJ/mol]\n",
      "S=-327 \t\t\t\t\t#Standard entropy change for the same reaction[J/K]\n",
      "T=298 \t\t\t\t\t#temperature[K]\n",
      "\n",
      "\t\n",
      "H=2*Hf1-0-0 \t\t\t\t#Enthalpy of the reaction[KJ/mol]\n",
      "G=H-T*S*0.001 \t\t\t\t#Change in Gibbs free energy[KJ]\n",
      "print\"The change in Gibbs free energy is\",round(G,2),\"KJ\\n \"\n",
      "print\"As change in Gibbs free energy is negative.Therefore,the reaction is spontaneous\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "2H2(g)+O2(g)-->2H2O(l)\n",
        "The change in Gibbs free energy is -474.21 KJ\n",
        " \n",
        "As change in Gibbs free energy is negative.Therefore,the reaction is spontaneous\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.21,Page no:94"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "print\"CH4(g)+2O2(g)-->CO2(g)+2H2O(l)\" \n",
      "S=-242.98 \t\t\t#standard entropy change for reaction [J/K]\n",
      "T=298 \t\t\t\t#temperature[K]\n",
      "Gf1=-50.72 \t\t\t#standard Gibbs free energy of formation for CH4(g)[KJ/mol]\n",
      "Gf2=-394.36 \t\t\t#standard Gibbs free energy of formation for CO2(g)[KJ/mol]\n",
      "Gf3=-237.13 \t\t\t#standard Gibbs free energy of formation for H2O(l)[KJ/mol]\n",
      "\n",
      "G=Gf2+2*Gf3-Gf1 \t\t#Standard Gibbs free energy for reaction[KJ/mol]\n",
      "H=G+T*S*0.001 \t\t\t#Standard enthalpy of reaction [KJ]\n",
      "print\"The standard enthalpy of reaction is\",round(H,2),\"kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "CH4(g)+2O2(g)-->CO2(g)+2H2O(l)\n",
        "The standard enthalpy of reaction is -890.31 kJ\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.22,Page no:94"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"C6H12O6(s)+6O2(g)-->6CO2(g)+6H2O(l)\"\n",
      "mass=25.0 \t\t\t#mass of glucose for combustion under standard condition[gm]\n",
      "T=298 \t\t\t\t#temperature[K]\n",
      "Gf1=-910 \t\t\t#Standard Gibbs free energy of formation for C6H12O6[KJ/mol]\n",
      "Gf2=-394.4 \t\t\t#Standard Gibbs free energy of formation for CO2(g)[KJ/mol]\n",
      "Gf3=-237.13 \t\t\t#Standard Gibbs free energy of formation for H2O(l)[KJ/mol]\n",
      "mol_wt=180.0 \t\t\t#molecular weight of glucose[gm/mol]\n",
      "\t\n",
      "G=6*Gf2+6*Gf3-Gf1\n",
      "n=mass/mol_wt \t\t\t#no. of moles\n",
      "Gactual=G*n \t\t\t#Gibbs free energy for the combustion of 0.139mol of glucose \n",
      "print\"The energy that can be extracted as non-expansion work is\",round(-Gactual),\"KJ\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C6H12O6(s)+6O2(g)-->6CO2(g)+6H2O(l)\n",
        "The energy that can be extracted as non-expansion work is 400.0 KJ\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.23,Page no:97"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "a=1.39*10**-2 \t\t#constant for a vanderwaal's gas[lit2.atm/mol2]\n",
      "b=3.92*10**-2 \t\t#constant for a vanderwaal's gas[lit2.atm/mol2]\n",
      "R=0.082 \t\t#Universal gas constant[lit.atm/deg/mol]\n",
      "\t\n",
      "Ti=(2*a)/(R*b) \t\t#inversion temperature [K]\n",
      "print\"The inversion temperature for the gas is\",round(Ti,3),\" K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The inversion temperature for the gas is 8.649  K\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.26,Page no:100"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "T=169.25 \t\t\t#Boiling point[K]\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "print\"dlnP/dT=He/R*T**2\" \n",
      "print\"dlnP/dT=(2.303*834.13/T**2)+(1.75/T)-(2.30*8.375*10**-3)\" \n",
      "print\"Therefore using these two equations we calculate the He(enthalpy) of ethylene\" \n",
      "\n",
      "x=(2.303*834.13/T**2)+(1.75/T)-(2.30*8.375*10**-3) #it is dlnP/dT\n",
      "He=R*0.001*T**2*x #Enthalpy of vaporization[J/mol]\n",
      "print\"\\n\\nThe Enthalpy of vaporization of ethylene at its boiling point is\",round(He,3),\"KJ/mol\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "dlnP/dT=He/R*T**2\n",
        "dlnP/dT=(2.303*834.13/T**2)+(1.75/T)-(2.30*8.375*10**-3)\n",
        "Therefore using these two equations we calculate the He(enthalpy) of ethylene\n",
        "\n",
        "\n",
        "The Enthalpy of vaporization of ethylene at its boiling point is 13.846 KJ/mol\n"
       ]
      }
     ],
     "prompt_number": 59
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.27,Page no:101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "P1=101.3 \t\t\t#Initial Pressure[KPa]\n",
      "P2=60 \t\t\t\t#Final Pressure[KPa]\n",
      "He=31.8 \t\t\t#Enthalpy of vaporization[KJ/mol]\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "T1=353.2 \t\t\t#boiling point of benzene at 101.3KPa[K]\n",
      "import math\n",
      "\n",
      "x=(T1**-1)-(R*0.001*math.log(P2/P1)/He) \n",
      "T2=x**-1 \t\t\t#Boiling point of benzene at 60KPa\n",
      "print\"The boiling point of benzene at 60KPa is\",round(T2,1),\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The boiling point of benzene at 60KPa is 336.9 K\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.28,Page no:101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "P1=0.016 \t\t\t#Vapour pressure of pure ethanol at 273K[bar]\n",
      "P2=0.470 \t\t\t#Vapour pressure of pure ethanol at 333K[bar]\n",
      "T1=273 \t\t\t\t#initial temperature [K]\n",
      "T2=333 \t\t\t\t#final temperature[K]\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "P=1.01 \t\t\t\t#vapour pressure at normal boiling point[bar]\n",
      "import math\n",
      "\t\n",
      "x=(T2**-1)-(T1**-1) \n",
      "He=-R*0.001*math.log(P2/P1)/x \t#molar enthalpy of vaporization[J/mol]\n",
      "t=(T2**-1)-(R*0.001*math.log(P/P2)/He) \n",
      "T=(t**-1)-273 \t\t\t#normal boiling point [C]\n",
      "print\"\\n\\nThe normal boiling point for pure ethanol is \",round(T,1),\"C\"\n",
      "print\"The molar enthalpy of vapourization is\",round(He,2),\"J/mol\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "The normal boiling point for pure ethanol is  77.4 C\n",
        "The molar enthalpy of vapourization is 42.58 J/mol\n"
       ]
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.29,Page no:102"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "T2=353.2 \t\t\t#normal boiling point of benzene at 1.01325bar[K]\n",
      "T1=298\t \t\t\t#temperature [K]\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "P2=1.01325 \t\t\t#Vapour pressure of benzene[bar]\n",
      "import math\n",
      "\t#benzene obey's Trouton's rule\n",
      "print\" from Troutons rule , \" \n",
      "print\" He/Tb=85J/K/mol\" \n",
      "\n",
      "He=85*T2 \t\t\t#molar enthalpy of vapourization[J/K/mol]\n",
      "x=(T2**-1)-(T1**-1) \n",
      "t=-He*x/R \n",
      "P1=P2/math.exp(t) \n",
      "print\"\\nThe vapour pressure of benzene at 298K is\",round(P1,3),\" bar\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " from Troutons rule , \n",
        " He/Tb=85J/K/mol\n",
        "\n",
        "The vapour pressure of benzene at 298K is 0.152  bar\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.30,Page no:111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "c=1 \t\t\t#no. of components(only CO2)\n",
      "p=2 \t\t\t#no. of phases(liquid + gas)\n",
      "\n",
      "F=c-p+2 \t\t#degree of freedom\n",
      "print\"Degrees of freedom is\",F \n",
      "print\"Degrees of freedom 1 means that either pressure or temperature can be varied independently,i.e.when temperature is fixed,pressure is automatically fixed\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Degrees of freedom is 1\n",
        "Degrees of freedom 1 means that either pressure or temperature can be varied independently,i.e.when temperature is fixed,pressure is automatically fixed\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.31,Page no:111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "c=1 \t\t\t#no. of components\n",
      "p=1 \t\t\t#no. of phases\n",
      "\n",
      "F=c-p+2 \t\t#Degrees of freedom\n",
      "print\"Degrees of freedom,F is\",F \n",
      "print\"Degrees of freedom 2 means both the pressure and temperature can be varied independently\" \n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Degrees of freedom,F is 2\n",
        "Degrees of freedom 2 means both the pressure and temperature can be varied independently\n"
       ]
      }
     ],
     "prompt_number": 61
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.32,Page no:113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "P=1.75*10**-5 \t\t\t#Vapour pressure of pure water at 293K[torr]\n",
      "dP=1.1*10**-7 \t\t\t#Lowering in vapour pressure of water\n",
      "\n",
      "x=dP/P \t\t\t\t#mole fraction of sucrose\n",
      "print\"The mole fraction of sucrose is\",round(x,6) \n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mole fraction of sucrose is 0.006286\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.33,Page no:114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "P=94.6 \t\t\t\t#The vapour pressure of pure benzene at 298K[torr]\n",
      "n1=20.0 \t\t\t\t#no. of moles of pure benzene\n",
      "n2=5.0 \t\t\t\t#no. of moles of pure naphthalene\n",
      "\n",
      "x=n1/(n1+n2) \t\t\t#(mole fraction of benzene)\n",
      "p=x*P \t\t\t\t#the partial vapour pressure of benzene[torr]\n",
      "print\"The partial vapour pressure of benzene is\",p,\"torr\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The partial vapour pressure of benzene is 75.68 torr\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.34,Page no:114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "x=0.28 \t\t\t\t#mole fraction of solute\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "T=298 \t\t\t\t#temperature[K]\n",
      "import math\n",
      "\n",
      "du=R*T*math.log(1-x) \t\t#reduction in chemical potential[J/mol]\n",
      "print\"The reduction in chemical potential is\",round(-du,1),\"J/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reduction in chemical potential is 813.9 J/mol\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.35,Page no:116"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Kb=0.51 \t\t\t#ebullioscopic constant of water [K*Kg/mol]\n",
      "n=155.0/180.0 \t\t\t#no. of moles of glucose\n",
      "m=n/1 \t\t\t\t#[mol/Kg]\n",
      "Ti=373.0 \t\t\t\t#Boiling point temperature of water[K]\n",
      "\n",
      "Tf=(Ti+Kb*m)-273 \t\t#boiling point temperature of the solution[C]\n",
      "print\"The boiling point of the solution is\",round(Tf,2),\"degree C\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The boiling point of the solution is 100.44 degree C\n"
       ]
      }
     ],
     "prompt_number": 62
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.36,Page no:117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Ti=5.44 #freezing point of pure benzene[K]\n",
      "Tf=4.63 #freezing point of solution[K]\n",
      "m1=2.12 #mass of the solute[gm]\n",
      "m2=125.0 #mass of the benzene[gm]\n",
      "Kf=5.12 #cryoscopic constant of pure benzene[K*Kg/mol]\n",
      "\n",
      "dTf=Ti-Tf \t#depression in freezing point[K]\n",
      "M2=(m1*1000*Kf)/(m2*dTf) #molar mass of solute\n",
      "print\"The molar mass of solute is\",round(M2),\"(approx)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The molar mass of solute is 107.0 (approx)\n"
       ]
      }
     ],
     "prompt_number": 65
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.38,Page no:124"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"N2(g)+3H2(g)<=>2NH3(g)\"\n",
      "T=298 \t\t\t#Temperature[K]\n",
      "Gf1=-16450 \t\t#Gibb's free energy of formation for NH3(g)[J/mol]\n",
      "R=8.314 \t\t#Universal gas constant[J/K/mol]\n",
      "import math\t\n",
      "\t\n",
      "Gf=2*Gf1\t\t\t#Gibb's free energy for the reaction[KJ]\n",
      "x=Gf/R/T\n",
      "Kp=math.exp(-x) \n",
      "print\"The Kp for above reaction is\",round(Kp),\"or 5.85*10^5,in scientific notation(APPROX)\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "N2(g)+3H2(g)<=>2NH3(g)\n",
        "The Kp for above reaction is 584861.0 or 5.85*10^5,in scientific notation(APPROX)\n"
       ]
      }
     ],
     "prompt_number": 66
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.39,Page no:124"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"0.5N2(g)+1.5H2(g)<=>NH3(g)\" \n",
      "T=298 #Temperature[K]\n",
      "Kp=900 #Equilibrium constant for above reaction\n",
      "P1=0.32 #partial pressure of N2(g)[bar]\n",
      "P2=0.73 #partial pressure of H2(g)[bar]\n",
      "P3=0.98 #partial pressure of NH3(g)[bar]\n",
      "R=8.314 #Universal gas constant[J/K/mol]\n",
      "import math\n",
      "\n",
      "G=-R*T*math.log(Kp) \n",
      "x=(P1**0.5)*(P2**1.5) \n",
      "p=P3/x \n",
      "Gr=(G+R*T*math.log(p))*0.001 \n",
      "print\"The reaction Gibbs free energy is\",round(Gr*1000),\"J/mol \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0.5N2(g)+1.5H2(g)<=>NH3(g)\n",
        "The reaction Gibbs free energy is -14322.0 J/mol \n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.40,Page no:125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"N2(g)+3H2(g)<=>2NH3(g)\"\n",
      "\n",
      "Kp1=5.85*10**5 #equilibrium constant at 298K\n",
      "H1=-46.11 #standard enthalpy of formation of NH3(g)[KJ/mol]\n",
      "T1=298 #Initial temperature[K]\n",
      "T2=423 #Final temperature[K]\n",
      "R=8.314 #Universal gas constant[J/K/mol]\n",
      "import math\n",
      "\n",
      "H=2*H1 #enthalpy for reaction [KJ]\n",
      "t=(T1**-1)-(T2**-1) \n",
      "x=-H*t/(R*0.001) \n",
      "Kp2=Kp1*math.exp(x) \n",
      "print\"The Equilibrium constant for reaction  at 423K is\",round(Kp2) \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "N2(g)+3H2(g)<=>2NH3(g)\n",
        "The Equilibrium constant for reaction  at 423K is 35004905509.0\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.41,Page no:128"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"Zn(s)|ZnCl2(aq)||CdSO4(aq)|Cd(s)\"\n",
      "T=298.0 \t\t\t#Temperature[K]\n",
      "R=8.314 \t\t#Universal gas constant[J/K/mol]\n",
      "E1=-0.7618 \t\t#Standard electrode potential for Zn2+/Zn [volts]\n",
      "E2=-0.403 \t\t#Standard electrode potential for Cd2+/Cd [volts]\n",
      "F=96500.0 \t\t#Faraday's constant[coulomb/mol]\n",
      "n=2.0 \t\t\t#no. of electrons balancing\n",
      "\n",
      "Ei=E2-E1 \t\t#Standard potential for the reaction[volts]\n",
      "import math\n",
      "Gi=-n*F*Ei \t\t#Standard Gibb's Free Energy [KJ/mol] \n",
      "Ki=math.exp(-Gi/R/T) \t#Equilibrium constant\n",
      "print\"The Free energy for the rection is\",Gi*0.001,\"KJ/mol\"\n",
      "print\"The value of equilibrium constant is\",Ki \n",
      "\n",
      "print\"Cd(s)|CdSO4(aq),Hg2SO4(s)|Hg(l)\" \n",
      "E3=0.6141 \t\t#Standard electrode potential for Hg2SO4(s),SO4^2-/Hg(l) [volts]\n",
      "\n",
      "Eii=E3-E2 \t\t#Standard potantial for the reaction[volts]\n",
      "Gii=-n*F*Eii \t\t#Standard Gibb's free energy[KJ/mol]\n",
      "Kii=math.exp(-Gii/R/T) \t#Equilibrium constant\n",
      "print\"The Free energy for the rection is\",round(Gii*0.001,1),\"KJ/mol\"\n",
      "print\"The value of equilibrium constant is\",Kii\n",
      "print\"PLEASE REDO the last line calculation,It is showing wrong result in my PC\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Zn(s)|ZnCl2(aq)||CdSO4(aq)|Cd(s)\n",
        "The Free energy for the rection is -69.2484 KJ/mol\n",
        "The value of equilibrium constant is 1.37586809667e+12\n",
        "Cd(s)|CdSO4(aq),Hg2SO4(s)|Hg(l)\n",
        "The Free energy for the rection is -196.3 KJ/mol\n",
        "The value of equilibrium constant is 2.56773255559e+34\n",
        "PLEASE REDO the last line calculation,It is showing wrong result in my PC\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.42,Page no:130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"Zn(s)|ZnCl2(soln)||AgCl(s)|Ag-Ag|AgCl(s)|ZnCl2(soln)|Zn(s)\" \n",
      "\n",
      "m1=0.02 \t\t\t#concentration[M]\n",
      "Y1=0.65 \t\t\t#mean ionic activity coefficient\n",
      "m2=1.5 \t\t\t\t#concentration[M]\n",
      "Y2=0.29 \t\t\t#mean ionic activity coefficient \n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "T=298 \t\t\t\t#Temperature [K]\n",
      "F=96500 \t\t\t#Faraday's constant[coulomb/mol]\n",
      "import math\n",
      "\t\n",
      "E=R*T*(math.log(m2*Y2/m1/Y1))*3/2/F \t#[volts]\n",
      "print\"The overall e.m.f of the cell is\",round(E,4),\"volt\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Zn(s)|ZnCl2(soln)||AgCl(s)|Ag-Ag|AgCl(s)|ZnCl2(soln)|Zn(s)\n",
        "The overall e.m.f of the cell is 0.1352 volt\n"
       ]
      }
     ],
     "prompt_number": 67
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.43,Page no:131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"H2(g,1atm)|HCl(aq)|HCl(aq)|H2(g,1atm)\" \n",
      "m1=0.02 \t\t\t#concentration[M]\n",
      "Y1=0.88 \t\t\t#mean ionic activity coefficient\n",
      "m2=1 \t\t\t\t#concentration[M]\n",
      "Y2=0.81 \t\t\t#mean ionic activity coefficient\n",
      "R=8.314 \t\t\t#universal gas constant[J/K/mol]\n",
      "T=298 \t\t\t\t#Temperature[K]\n",
      "F=96487 \t\t\t#Faraday's constant[coulombs/mol]\n",
      "t=0.178 \t\t\t#Tranference number of Cl-1\n",
      "import math\n",
      "\n",
      "E=-2*t*R*T*(math.log(m1*Y1/m2/Y2))/F \t#e.m.f of the cell[volts]\n",
      "print\"The e.m.f of the cell is\",round(E,3),\" volts\" \n",
      "print\"\\nWrongly calculated in book as 0.351 volt\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "H2(g,1atm)|HCl(aq)|HCl(aq)|H2(g,1atm)\n",
        "The e.m.f of the cell is 0.035  volts\n",
        "\n",
        "Wrongly calculated in book as 0.351 volt\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.44,Page no:133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "print\"The values for reaction that goes on within the cadmium cell\" \n",
      "n=2 \t\t\t#no. of moles\n",
      "E=1.01463 \t\t#standard cadmium cell potential[volts]\n",
      "d=-5*10**-5 \t\t#i.e d=dE/dT[V/K]\n",
      "F=96500 \t\t#[coulomb/mol]\n",
      "T=298 \t\t\t#Temperature [K]\n",
      "\n",
      "dG=-n*E*F \t\t#Change in Gibb's free energy[J]\n",
      "dS=n*F*d \t\t#Change in entropy [J/K]\n",
      "dH=dG+T*dS \t\t#change in enthalpy[J]\n",
      "print\" dG=\",dG,\"J\\nWrongly calculated in book as -195815 J\"\n",
      "print\"\\n dS=\",dS,\"J/K\"\n",
      "print\"\\n dH=\",dH,\"J\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The values for reaction that goes on within the cadmium cell\n",
        " dG= -195823.59 J\n",
        "Wrongly calculated in book as -195815 J\n",
        "\n",
        " dS= -9.65 J/K\n",
        "\n",
        " dH= -198699.29 J\n"
       ]
      }
     ],
     "prompt_number": 68
    }
   ],
   "metadata": {}
  }
 ]
}