{
 "metadata": {
  "name": "",
  "signature": "sha256:18c54e3b106846f46428edc2ce784211e8ed1cb16969a115044ec2bc914626ae"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 - The phase rule and solutions"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - pg 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the molality of the mixture\n",
      "#initialisation of variables\n",
      "m= 98.08 #gms\n",
      "d= 1.102 #g ml^-1\n",
      "m1= 165.3 #gm\n",
      "v= 1000 #ml\n",
      "wt=.15\n",
      "#CALCULATIONS\n",
      "form=d*v*wt/m\n",
      "M= d*v-m1\n",
      "norm=2*form\n",
      "m2= m1*v/(m*M)\n",
      "#RESULTS\n",
      "print '%s %.3f %s' % (' molality = ',m2,'molal')\n",
      "print '%s %.3f %s' %('Formality = ',form,'gm formula wt/l')\n",
      "print '%s %.3f %s' %('Normality = ',norm,'N')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " molality =  1.799 molal\n",
        "Formality =  1.685 gm formula wt/l\n",
        "Normality =  3.371 N\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - pg 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Increase in enthalpy\n",
      "#initialisation of variables\n",
      "T= -40 #C\n",
      "v= 217.4 #cm^3\n",
      "r= 8.8 # atm deg^-1\n",
      "m= 18 #gms\n",
      "#CALCULATIONS\n",
      "H= (273+T)*(-v*m/1000)*r*(1.987/82.05)\n",
      "#RESULTS\n",
      "print '%s %.1f %s' % (' Increase in enthalpy =',H,'cal mole^-1')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Increase in enthalpy = -194.3 cal mole^-1\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - pg 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the density\n",
      "#initialisation of variables\n",
      "T= 27 #C\n",
      "R= 0.08206 #cal/mol T\n",
      "W= 28.6 #gms\n",
      "#CALCULATIONS\n",
      "d= W/((273.2+T)*R)\n",
      "#RESULTS\n",
      "print '%s %.3f %s' % (' density =',d,' g l^-1')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " density = 1.161  g l^-1\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - pg 289"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the mole fraction and total pressure\n",
      "#initialisation of variables\n",
      "P= 408. #mm of Hg\n",
      "P1= 141. # mm of Hg\n",
      "p= 60.\n",
      "#CALCULATIONS\n",
      "P2= P*(100-p)/100.\n",
      "P3= P1*p/100.\n",
      "N= P2/(P2+P3)\n",
      "P4= P2+P3\n",
      "#RESULTS\n",
      "print '%s %.3f' % (' mole fraction = ',N)\n",
      "print '%s %.1f %s' % (' \\n total pressure =',P4,' mm of Hg')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " mole fraction =  0.659\n",
        " \n",
        " total pressure = 247.8  mm of Hg\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - pg 289"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the molality\n",
      "#initialisation of variables\n",
      "P2= 760. #mm of Hg\n",
      "m2= 2.18*10**-3\n",
      "v= 23.5 #ml\n",
      "p= 21.\n",
      "p1= 79.\n",
      "#CALCULATIONS\n",
      "K= P2*55.5/m2\n",
      "K1= 760*55.5*22.4*10**3/v\n",
      "m= 55.5*(p*760/(100*K))+55.5*(p1*760/(100*K1))\n",
      "#RESULTS\n",
      "print '%s %.2e %s' % (' molality =',m,'molal')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " molality = 1.29e-03 molal\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - pg 297"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the percentage of Br in the vapors in steam distillation\n",
      "#initialisation of variables\n",
      "Ph= 643. #mm of Hg\n",
      "Mh= 18. #gms\n",
      "Po= 117. #mm of Hg\n",
      "Mo= 157. #gms\n",
      "#CALCULATIONS\n",
      "r= Ph*Mh/(Po*Mo)\n",
      "P= 100*(1/(1+r))\n",
      "#RESULTS\n",
      "print '%s %.1f %s' % (' percentage =',P,'percent')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " percentage = 61.3 percent\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8 - pg 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the amounts of phases present at 375 and 370 C\n",
      "#initialisation of variables\n",
      "n= 1 \n",
      "n1= 0.5\n",
      "n3= 0.36\n",
      "n4= 0.67\n",
      "n5= 0.34\n",
      "r= 3\n",
      "#CALCULATIONS\n",
      "A= (n-n1)/(n1-n3)\n",
      "A1= r*(n4-n1)/(n1-n5)\n",
      "#RESULTS\n",
      "print '%s %.1f' % (' amount of phase at 375 C = ',A)\n",
      "print '%s %.1f' % (' \\n amount of phase at 370 C = ',A1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " amount of phase at 375 C =  3.6\n",
        " \n",
        " amount of phase at 370 C =  3.2\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9 - pg 311"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the vapour pressure\n",
      "#initialisation of variables\n",
      "m= 100 #gms\n",
      "m1= 1 #gms\n",
      "m2= 2 #gms\n",
      "P= 23.756 #mm of Hg\n",
      "n= 18.02 \n",
      "n1= 60.06\n",
      "n2= 342.3 \n",
      "#CALCULATIONS\n",
      "r= ((m1/n1)+(m2/n2))/((m1/n1)+(m2/n2)+(m/n))\n",
      "dp= P*r\n",
      "P1= P-dp\n",
      "#RESULTS\n",
      "print '%s %.3f %s' % (' vapour pressure =',P1,' mm of Hg')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " vapour pressure = 23.660  mm of Hg\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11 - pg 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the boiling point of solution\n",
      "#initialisation of variables\n",
      "kf= 0.514 #K/molal\n",
      "m= 0.225 #molal\n",
      "#CALCULATIONS\n",
      "dT= kf*m\n",
      "T2=dT+100.\n",
      "#RESULTS\n",
      "print '%s %.3f %s' % (' boiling point =',T2,' C')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " boiling point = 100.116  C\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12 - pg 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the molecular weight of the solute\n",
      "#initialisation of variables\n",
      "kb= 2.64 #C gm\n",
      "dT= 0.083 #C\n",
      "m= 120 #gms\n",
      "W2= 0.764 #gms\n",
      "#CALCULATIONS\n",
      "m2= dT/kb\n",
      "M2= W2*1000/(m2*m)\n",
      "#RESULTS\n",
      "print '%s %.1f %s' % (' molecular weight of solute =',M2,'gms')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " molecular weight of solute = 202.5 gms\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13 - pg 318"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the value of n\n",
      "#initialisation of variables\n",
      "T= 176.5 #C\n",
      "T1= 158.8 #C\n",
      "Kf= 37.7\n",
      "W1= 0.522 #gms\n",
      "W2= 0.0386 #gms\n",
      "m= 12 #gms\n",
      "m1= 1 #gm\n",
      "#CALCULATIONS\n",
      "m3= (T-T1)/Kf\n",
      "M2= W2*1000/(m3*W1)\n",
      "r= M2/(m+m1)\n",
      "#RESULTS\n",
      "print '%s %d' % ('value of n = ',r)\n",
      "print '%s %d %s' %('Molecular weight = ',M2,'gm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of n =  12\n",
        "Molecular weight =  157 gm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14 - pg 319"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the triple point of the system\n",
      "#initialisation of variables\n",
      "T= 273.2 #K\n",
      "P= 0.0060 #atm\n",
      "P1= 1 #atm\n",
      "H= 3290 #cal\n",
      "dV= -0.0907 #cc\n",
      "#CALCULATIONS\n",
      "dT= T*dV*(P-P1)/H\n",
      "#RESULTS\n",
      "print '%s %.4f %s' % (' triple point =',dT,'C') \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " triple point = 0.0075 C\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16 - pg 323"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the fraction of impurity in both cases\n",
      "#initialisation of variables\n",
      "n= 100.\n",
      "K= 2.\n",
      "V= 100. #ml\n",
      "V2= 1000. #ml\n",
      "n= 10.\n",
      "n1= 100.\n",
      "#CALCULATIONS\n",
      "x= (K*V/(K*V+(V2/n)))**n\n",
      "y= (K*V/(K*V+(V2/n1)))**n1\n",
      "#RESULTS\n",
      "print '%s %.4f' % (' fraction of impurity = ',x)\n",
      "print '%s %.4f' % (' \\n fraction of impurity = ',y)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " fraction of impurity =  0.0173\n",
        " \n",
        " fraction of impurity =  0.0076\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 17 - pg 328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the molecular weight of the protein\n",
      "#initialisation of variables\n",
      "T= 27 #C\n",
      "m= 0.635 #gms\n",
      "V= 100 #ml\n",
      "R= 0.08205 #cal/mol K\n",
      "p= 2.35 #cm\n",
      "#CALCULATIONS\n",
      "M= 13.6*76*m*R*(T+273)*1000/(p*V)\n",
      "#RESULTS\n",
      "print '%s %d %s' % (' molecular weight =',M,'gms')\n",
      "print 'The answer is a bit different due to rounding off error in textbook'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " molecular weight = 68747 gms\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18 - pg 328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the osmotic pressure\n",
      "#initialisation of variables\n",
      "import math\n",
      "R= 0.08205 #cal/mol K\n",
      "v1= 0.0180#cc\n",
      "N= 0.9820\n",
      "T= 273.2\n",
      "#CALCULATIONS\n",
      "P= -R*T*math.log(N)/v1\n",
      "#RESULTS\n",
      "print '%s %.1f %s' % (' osmotic pressure =',P,'atm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " osmotic pressure = 22.6 atm\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19 - pg 331"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the osmotic pressure\n",
      "#initialisation of variables\n",
      "kf= 1.86\n",
      "dT= 0.402 #K\n",
      "T= 310 #K\n",
      "R= 0.08205 #cal/mol K\n",
      "#CALCULATIONS\n",
      "P= dT*T*R/kf\n",
      "#RESULTS\n",
      "print '%s %.2f %s' % (' osmotic pressure =',P,'atm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " osmotic pressure = 5.50 atm\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20 - pg 333"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Degrees of ionisation\n",
      "#initialisation of variables\n",
      "m= 0.100 #gms\n",
      "kf= 1.86 #K/gms\n",
      "dT= 0.300 #K\n",
      "v= 2\n",
      "#CALCULATIONS\n",
      "T= kf*m\n",
      "i= dT/T\n",
      "a= (i-1)/(v-1)\n",
      "#RESULTS\n",
      "print '%s %.2f' % (' Degrees of ionisation = ',a)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Degrees of ionisation =  0.61\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21 - pg 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the lowering of the freezing point\n",
      "#initialisation of variables\n",
      "W= 0.0020 #M\n",
      "W1= 0.0010 #M\n",
      "W2= 0.0040 #M\n",
      "T= 1.86 #C\n",
      "n= 1 #moles\n",
      "n1= 1 #moles\n",
      "n2= 2 #moles\n",
      "a= 1.122\n",
      "#CALCULATIONS\n",
      "dT= T*(W+W1+W2)\n",
      "I= 0.5*(n**2*W+n1**2*W2+n2**2*W1)\n",
      "g= 1-(2*a*I**1.5/(3*(W+W1+W2)))\n",
      "dT1= g*dT\n",
      "#RESULTS\n",
      "print '%s %.4f %s' % (' lowering the freezing point =',dT1,'C ')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " lowering the freezing point = 0.0125 C \n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22 - pg 338"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the activity coefficient of acetone and water\n",
      "#initialisation of variables\n",
      "p= 1820 #mm\n",
      "n= 2.5 #mole percent\n",
      "f= 0.470\n",
      "P= 420 #mm\n",
      "n1= 97.5 #percent\n",
      "#CALCULATIONS\n",
      "P1= p*n/(100*760)\n",
      "F= f/P1\n",
      "F1= (1-f)*760.*100/(P*n1)\n",
      "#RESULTS\n",
      "print '%s %.2f' % (' activity coefficient of acetone =  ',F)\n",
      "print '%s %.2f' % (' \\n activity coefficient of water =  ',F1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " activity coefficient of acetone =   7.85\n",
        " \n",
        " activity coefficient of water =   0.98\n"
       ]
      }
     ],
     "prompt_number": 19
    }
   ],
   "metadata": {}
  }
 ]
}