{
 "metadata": {
  "name": "",
  "signature": "sha256:1833f0f72d4fcfdfc05d274c870f8929bea706e80b14f9268d3407df8540de4d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 - Kinetic theory of gases and equations of state"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the final volume of the gas\n",
      "#initialisation of variables\n",
      "V= 22.394 #l\n",
      "m= 32 #gm\n",
      "T= 0 #C\n",
      "T1= 50. #C\n",
      "p= .8 #atm\n",
      "#CALCULATIONS\n",
      "V1= (T1+273.16)*V/(T+273.16)\n",
      "V2= (1./p)*V1\n",
      "#RESULTS\n",
      "print '%s %.3f %s' % (' Volume = ',V2,'lt')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Volume =  33.116 lt\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate gthe argon temperature\n",
      "#initialisation of variables\n",
      "P= 1 #atm\n",
      "T= 0 #C\n",
      "#CALCULATIONS\n",
      "T1= 10*(T+273.2)\n",
      "#RESULTS\n",
      "print '%s %.1f %s' %(' Argon temperature =',T1,' K')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Argon temperature = 2732.0  K\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Atomic Weight\n",
      "#initialisation of variables\n",
      "x= 0.0820544\n",
      "T= 0 #C\n",
      "l= 1.7826 #gl^-1atm^-1\n",
      "#CALCULATIONS\n",
      "M= x*(273.16+T)*l\n",
      "#RESULTS\n",
      "print '%s %.3f %s' % (' Atomic Weight =',M,'gm mole^-1')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Atomic Weight = 39.955 gm mole^-1\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Molecular weight and molecular formula\n",
      "#initialisation of variables\n",
      "g=.270 #g\n",
      "R=0.08205\n",
      "T=296.4 #K\n",
      "P=754.6/760.0 #atm\n",
      "V=0.03576 #lt\n",
      "m1= 12\n",
      "m2= 19\n",
      "m3= 35.46\n",
      "yx=.57\n",
      "#CALCULATIONS\n",
      "M1=g*R*T/(P*V)\n",
      "y=round(yx*M1/m3)\n",
      "n=round((M1-m3*y+m2)/(2*m2+m1))\n",
      "x=2*n-1\n",
      "M= n*m1+x*m2+y*m3\n",
      "#RESULTS\n",
      "print '%s %.2f %s' %('Approximate molecular weight = ',M1,\"gms\")\n",
      "print '%s %.2f %s' % (' Molecular weight =',M,' gms')\n",
      "print '%s %d %s %d %s %d' %('Molecular formula is C',n,'F',x,'Cl',y)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Approximate molecular weight =  184.94 gms\n",
        " Molecular weight = 187.38  gms\n",
        "Molecular formula is C 2 F 3 Cl 3\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the pressure in both cases\n",
      "#initialisation of variables\n",
      "n= 10 #moles\n",
      "R= 0.08205 #atml/molK\n",
      "T= 300 #K\n",
      "V= 4.86 #l\n",
      "b= 0.0643 #ml mol**-1\n",
      "a= 5.44 #l**2\n",
      "#CALCULATIONS\n",
      "P= n*R*T/V\n",
      "P1= (n*R*T/(V-n*b))-(a*n**2/V**2)\n",
      "#RESULTS\n",
      "print '%s %.1f %s' % (' Pressure in case of perfect gas law=',P,' atm')\n",
      "print '%s %.1f %s' % ('  \\n Pressure in case of vanderwaals equation =',P1,' atm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure in case of perfect gas law= 50.6  atm\n",
        "  \n",
        " Pressure in case of vanderwaals equation = 35.3  atm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the pressure of the gas\n",
      "#initialisation of variables\n",
      "n= 10 #moles\n",
      "T= 300 #K\n",
      "V= 4.86 #l\n",
      "R= 0.08205 #atml/molK\n",
      "v= 0.1417 #l\n",
      "T1= 305.7 #K\n",
      "#CALCULATIONS\n",
      "b= v/2\n",
      "a= 2*v*R*T1\n",
      "P= ((n*R*T)/(V-n*b))*2.71**(-a*n/(V*R*T))\n",
      "#RESULTS\n",
      "print '%s %.1f %s' % (' Pressure =',P,' atm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure = 32.8  atm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - Pg 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the root mean square velocity\n",
      "#initialisation of variables\n",
      "import math\n",
      "from math import sqrt\n",
      "T= 0 #C\n",
      "T1= 100 #C\n",
      "R= 8.314 #atm lit/mol K\n",
      "n= 3\n",
      "M= 2.016 #gm\n",
      "M1= 28.02 #gm\n",
      "M2= 146.1 #gm\n",
      "#CALCULATIONS\n",
      "u= sqrt(n*R*10**7*(T+273.2)/M)\n",
      "u1= sqrt(n*R*10**7*(T+273.2)/M1)\n",
      "u2= sqrt(n*R*10**7*(T+273.2)/M2)\n",
      "u3= sqrt(n*R*10**7*(T1+273.2)/M)\n",
      "u4= sqrt(n*R*10**7*(T1+273.2)/M1)\n",
      "u5= sqrt(n*R*10**7*(T1+273.2)/M2)\n",
      "#RESULTS\n",
      "print '%s %.2f %s' % (' root mean square velocity of H2 at 0 C  =',u*10**-4,' cm/sec')\n",
      "print '%s %.3f %s' % (' \\n root mean square velocity of N2 at 0 C=',u1*10**-4,' cm/sec')\n",
      "print '%s %.3f %s' % (' \\n root mean square velocity of SF6 at 0 C =',u2*10**-4,'cm/sec')\n",
      "print '%s %.2f %s' % (' \\n root mean square velocity of H2 at 100 C =',u3*10**-4,' cm/sec')\n",
      "print '%s %.3f %s' % (' \\n root mean square velocity of N2 at 100 C =',u4*10**-4,' cm/sec')\n",
      "print '%s %.3f %s' % (' \\n root mean square velocity of SF6 at 100 C =',u5*10**-4,' cm/sec')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " root mean square velocity of H2 at 0 C  = 18.38  cm/sec\n",
        " \n",
        " root mean square velocity of N2 at 0 C= 4.931  cm/sec\n",
        " \n",
        " root mean square velocity of SF6 at 0 C = 2.160 cm/sec\n",
        " \n",
        " root mean square velocity of H2 at 100 C = 21.49  cm/sec\n",
        " \n",
        " root mean square velocity of N2 at 100 C = 5.764  cm/sec\n",
        " \n",
        " root mean square velocity of SF6 at 100 C = 2.524  cm/sec\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9 - Pg 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the no. of collisions in He and N2\n",
      "#Initialisation of variables\n",
      "import math\n",
      "from math import sqrt\n",
      "P= 1 #at,\n",
      "T= 300 #K\n",
      "R= 82.05 #atm l/mol K\n",
      "R1= 8.314\n",
      "s= 4*10**-8 #cm\n",
      "s1= 2*10**-8 #cm\n",
      "m= 4 #gm\n",
      "m1= 28 #gm\n",
      "#CALCULATIONS\n",
      "N= P*6.02*10**23/(R*T)\n",
      "n= 2*s1**2*N**2*sqrt(math.pi*R1*10**7*T/m)\n",
      "n1= 2*s**2*N**2*sqrt(math.pi*R1*10**7*T/m1)\n",
      "#RESULTS\n",
      "print '%s %.e %s' % (' no of collisions =',n,'collisions sec^-1 mol^-1')\n",
      "print '%s %.2e %s' % (' \\n no of collisions =',n1,' collisions sec^-1 mol^-1')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " no of collisions = 7e+28 collisions sec^-1 mol^-1\n",
        " \n",
        " no of collisions = 1.01e+29  collisions sec^-1 mol^-1\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10 - Pg 36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the viscosity of N2\n",
      "#initialisation of variables\n",
      "import math\n",
      "from math import sqrt\n",
      "M= 28 #gm\n",
      "R= 8.314*10**7 #atm l/mol K\n",
      "N= 6.023*10**23\n",
      "T= 300 #K\n",
      "s= 4*10**-8#cm\n",
      "#CALCULATIONS\n",
      "m= M/N\n",
      "k= R/N\n",
      "n= (5./16.)*sqrt(math.pi*m*k*T)/(math.pi*s**2)\n",
      "#RESULTS\n",
      "print '%s %.2e %s' % (' viscosity =',n,'poise')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " viscosity = 1.53e-04 poise\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12 - Pg 45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Increase in energy per degree for 1 mole of gas\n",
      "#initialisation of variables\n",
      "n= 3\n",
      "R= 2 #cal mol^-1 deg^-1\n",
      "#CALCULATIONS\n",
      "I= n*R\n",
      "#RESULTS\n",
      "print '%s %.1f %s' %(' Increase in energy =',I,'cal mol^-1 deg^-1')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Increase in energy = 6.0 cal mol^-1 deg^-1\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13 - Pg 51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Dipole moment and percentage of ionic character\n",
      "#initialisation of variables\n",
      "import math\n",
      "k= 1.38*10**-16\n",
      "N= 6*10**23 #molecules\n",
      "a= 105 #degrees\n",
      "l= 0.957 #A\n",
      "e= 4.8*10**-10 #ev\n",
      "#CALCULATIONS\n",
      "u= math.sqrt(9*k*2.08*10**4/(4*math.pi*N))\n",
      "uh= u/(2*math.cos(a*math.pi/180/2.))\n",
      "z= uh/(l*e*10**-8) \n",
      "#RESULTS\n",
      "print '%s %.2e %s' % (' Dipole moment of H2O=',u,'e.s.u.cm')\n",
      "print '%s %.2e %s' % (' \\n Dipole moment of OH bond =',uh,'e.s.u.cm')\n",
      "print '%s %.2f' % (' \\n fraction of ionic character =',z)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Dipole moment of H2O= 1.85e-18 e.s.u.cm\n",
        " \n",
        " Dipole moment of OH bond = 1.52e-18 e.s.u.cm\n",
        " \n",
        " fraction of ionic character = 0.33\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14 - Pg 52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the dielectric constant\n",
      "#initialisation of variables\n",
      "import math\n",
      "u= 1.44*10**-18 #e.s.u\n",
      "k= 3.8*10**-16 \n",
      "T= 273. #k\n",
      "N= 6.023*10**23 #molecules\n",
      "v= 6. #cc\n",
      "Vm= 44.8*10**3 #cc\n",
      "#CALCULATIONS\n",
      "Pm= v+(4*math.pi*N*u**2/(3*3*k*T))\n",
      "r= Pm/Vm\n",
      "k= (2*r+1)/(1-r)\n",
      "#RESULTS\n",
      "print '%s %.5f' % (' dielectric constant =',k)\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": [
        " dielectric constant = 1.00153\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 13
    }
   ],
   "metadata": {}
  }
 ]
}