{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 4 States of Matter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_1 pgno:91"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Volume of 14g of Nitrogen at 380 mm Hg pressure=V1=litres 44.8\n",
      "\n",
      "Pressure of 14g of Nitrogen of volume 5.6litres=P2=mm Hg 3040.0\n"
     ]
    }
   ],
   "source": [
    "P=760;#pressure of 14g of nitrogen in mm of Hg#\n",
    "V=22.4;#Volume occupied by 14g of Nitrogen in litres#\n",
    "P1=380;#changed pressure of 14g of nitrogen in mm of Hg#\n",
    "V1=(P*V)/P1;#changed volume of 14g of nitrogen at 380mm pressure in litres#\n",
    "print'Volume of 14g of Nitrogen at 380 mm Hg pressure=V1=litres',V1\n",
    "V2=5.6;#changed volume of 14g of nitrogen in litres#\n",
    "P2=(P*V)/V2;#Pressure of 14g of nitrogen of volume 5.6litres#\n",
    "print'\\nPressure of 14g of Nitrogen of volume 5.6litres=P2=mm Hg',P2\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_2 pgno:93"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Temperature of 8g of Oxygen Occupying 11.6litres=T1=Kelvin=273degrees 546.0\n"
     ]
    }
   ],
   "source": [
    "V=5.6;#Volume occupied by 8g of Oxygen at 0 C in litres#\n",
    "T=273;#Temperature at which 8g of Oxygen occupies 5.6litres in Kelvin#\n",
    "V1=11.2;#Changed volume of 8g of Oxygen in litres#\n",
    "T1=(V1*T)/V;#Temperature at which 8g of Oxygen occupies 11.6litres in kelvin# \n",
    "print'Temperature of 8g of Oxygen Occupying 11.6litres=T1=Kelvin=273degrees',T1\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_3 pgno:93"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Volume of 11g of CO2 at 760 mm Hg pressure at 546K=V1=litres 11.2\n"
     ]
    }
   ],
   "source": [
    "P=380.;#pressure of 11g of CO2 at 273K in mm of Hg#\n",
    "T=273.;#Initial temperature of 11g of CO2 in kelvin#\n",
    "V=11.2;#Volume occupied by 11g of CO2 in litres at 273K#\n",
    "P1=760.;#changed pressure of 11g of CO2 at 546K in mm of Hg#\n",
    "T1=546.;#Final temperature of 11g of CO2 in kelvin#\n",
    "V1=(P*V*T1)/(T*P1);#changed volume of 11g of CO2 at 760mm pressure in litres#\n",
    "print'Volume of 11g of CO2 at 760 mm Hg pressure at 546K=V1=litres',V1\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_4 pgno:96"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of moles of Hydrogen present=n=mol 0.305\n"
     ]
    }
   ],
   "source": [
    "P=570./760.;#pressure of 10L of H2 at 300K in Atmospheres#\n",
    "T=300.;#Temperature of 10L of H2 in kelvin#\n",
    "V=10.;#Volume occupied by H2 at 300K in litres#\n",
    "R=0.082;#Value of R in litre-atmospheres#\n",
    "n=(P*V)/(R*T);#Number of moles of hydrogen present#\n",
    "print'Number of moles of Hydrogen present=n=mol',round(n,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_5 pgno:98"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "partial pressure of dry gas at 298k=mm of Hg 722.0\n",
      "\n",
      "Volume of dry gas at pressure 760mm of Hg=V1=ml 190.0\n"
     ]
    }
   ],
   "source": [
    "TP=746.;#Total pressure of gas at 298K in mm of Hg#\n",
    "PP=24.;#Partial pressure of Water vapour at 298K in mm of Hg#\n",
    "PPG=TP-PP;#partial pressure of gas at 298K in mm of Hg#\n",
    "print'partial pressure of dry gas at 298k=mm of Hg',PPG\n",
    "V=200.;#Volume occupied by gas at 298K in millilitres#\n",
    "P1=760.;\n",
    "V1=(PPG*V)/P1;#Volume of dry gas at a pressure of 760mm Hg#\n",
    "print'\\nVolume of dry gas at pressure 760mm of Hg=V1=ml',V1\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_6 pgno:98"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "No. of moles of gas A=nA=mol 0.0025\n",
      "\n",
      "No. of moles of gas B=nB=mol 0.005\n",
      "\n",
      "mole fraction of gas A=MFA= 0.333333333333\n",
      "\n",
      "mole fraction of gas B=MFB= 0.666666666667\n",
      "\n",
      "Partial pressure of gas A=PPA=mm of Hg 253.0\n",
      "\n",
      "Partial pressure of gas B=PPB=mm of Hg 506.0\n"
     ]
    }
   ],
   "source": [
    "mA=0.11;#amount of gas A in grams#\n",
    "MWA=44;#Molecular weight of gas A in grams#\n",
    "nA=mA/MWA;#No. of moles of gas A#\n",
    "print'No. of moles of gas A=nA=mol',nA\n",
    "mB=0.17;#amount of gas B in grams#\n",
    "MWB=34;#Molecular weight of gas B in grams#\n",
    "nB=mB/MWB;#No. of moles of gas B#\n",
    "print'\\nNo. of moles of gas B=nB=mol',nB\n",
    "MFA=nA/(nA+nB);#mole fraction of gas A#\n",
    "print'\\nmole fraction of gas A=MFA=',MFA\n",
    "MFB=nB/(nA+nB);#mole fraction of gas B#\n",
    "print'\\nmole fraction of gas B=MFB=',MFB\n",
    "PPA=MFA*759;#Partial pressure of gas A#\n",
    "print'\\nPartial pressure of gas A=PPA=mm of Hg',PPA\n",
    "PPB=MFB*759;#Partial pressure of gas B#\n",
    "print'\\nPartial pressure of gas B=PPB=mm of Hg',PPB\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_7 pgno:99"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Pressure of gas A in vessel=PA=atm 0.03\n",
      "\n",
      "Pressure of gas B in vessel=PB=atm 0.2\n",
      "\n",
      "Total pressure in vessel=P=atm 0.23\n"
     ]
    }
   ],
   "source": [
    "P1=0.3;#pressure of gas A in atm#\n",
    "VA=50.;#volume of gas A in ml#\n",
    "V=500.;#Volume of vessel in ml#\n",
    "PA=P1*VA/V;#Pressure of gas A in vessel#\n",
    "print'Pressure of gas A in vessel=PA=atm',PA\n",
    "P2=0.4;#pressure of gas B in atm#\n",
    "VB=250.;#volume of gas B in ml#\n",
    "PB=P2*VB/V;#Pressure of gas A in vessel#\n",
    "print'\\nPressure of gas B in vessel=PB=atm',PB\n",
    "P=PA+PB;#Total pressure in vessel in atm#\n",
    "print'\\nTotal pressure in vessel=P=atm',P\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_8 pgno:100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The volume of 1 mole of H2 at 1 atm and 273.15K=22.415Litres\n",
      "\n",
      "The volume at 0.5atm is obtained by considering the constancy of PV\n",
      "\n",
      "Volume at 0.5atm of H2 at 273.15K=V2=Litres 44.83\n",
      "\n",
      "Density of H2=DH2=gram per litre 0.0446\n"
     ]
    }
   ],
   "source": [
    "print'The volume of 1 mole of H2 at 1 atm and 273.15K=22.415Litres'\n",
    "print'\\nThe volume at 0.5atm is obtained by considering the constancy of PV'\n",
    "P1=1;\n",
    "V1=22.415;\n",
    "P2=0.5;\n",
    "V2=(P1*V1)/P2;#Volume at 0.5atm in litres#\n",
    "print'\\nVolume at 0.5atm of H2 at 273.15K=V2=Litres',V2\n",
    "MH2=2;#molecular weight of H2#\n",
    "DH2=MH2/V2;#density of H2 in gram per litre#\n",
    "print'\\nDensity of H2=DH2=gram per litre',round(DH2,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_9 pgno:101"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "One mole of H2 Occupies 22.415Litres at 273.15K\n",
      "\n",
      "The volume at 300K is obtained by considering the constancy of V/T\n",
      "\n",
      "Volume of 1mole of H2 at 300.15K=V2=Litres 24.6306507414\n",
      "\n",
      "Density of H2=DH2=gram per litre 0.0811996410896\n"
     ]
    }
   ],
   "source": [
    "print'One mole of H2 Occupies 22.415Litres at 273.15K'\n",
    "print'\\nThe volume at 300K is obtained by considering the constancy of V/T'\n",
    "T1=273.15;\n",
    "V1=22.415;\n",
    "T2=300.15;\n",
    "V2=(V1/T1)*T2;#Volume at 300K in litres#\n",
    "print'\\nVolume of 1mole of H2 at 300.15K=V2=Litres',V2\n",
    "MH2=2;#molecular weight of H2#\n",
    "DH2=MH2/V2;#density of H2 in gram per litre#\n",
    "print'\\nDensity of H2=DH2=gram per litre',DH2\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_10 pgno:101"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Density is proportional to molecular weight\n",
      "\n",
      "Relative density of O2 with respect to H2 is 32/2=16.\n",
      "\n",
      "Realtive density of gas to oxygen=p1= 10.24\n"
     ]
    }
   ],
   "source": [
    "print'Density is proportional to molecular weight'\n",
    "print'\\nRelative density of O2 with respect to H2 is 32/2=16.'\n",
    "t1=12.;#time for certain volume of gas to stream through hole in mins#\n",
    "p2=16.;#Relative density of O2 w.r.t H2#\n",
    "t2=15.;#time for same volume(as gas) of oxygen to stream through hole in mins#\n",
    "p1=((t1/t2)**2)*p2;#according to graham's law#\n",
    "print'\\nRealtive density of gas to oxygen=p1=',p1#here the answer given in textbook is wrongly printed the actual answer is the one we got here through execution# \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_11 pgno:108"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Root mean square velocity of Oxygen=Crms=cm/sec 49929.9509313\n",
      "\n",
      "Mean velocity of Oxygen=Cm=cm/sec 46001.3491471\n",
      "\n",
      "Mean probable velocity of Oxygen=Cmpv=cm/sec 40768.0\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,pi\n",
    "T=320;#47C in kelvin#\n",
    "R=8.31*10**7;#Universal gas constant in erg per degree per mole#\n",
    "M=32;#molecular weight of O2 in gram per mole#\n",
    "C2=(3*R*T)/M;#mean square velocity of Oxygen in (cm/sec)^2#\n",
    "Crms=sqrt(C2);#Root mean square velocity of Oxygen in cm/sec#\n",
    "print 'Root mean square velocity of Oxygen=Crms=cm/sec',Crms\n",
    "Cm=sqrt(8*R*T/(pi*M));#mean velocity of Oxygen in cm/sec#\n",
    "print '\\nMean velocity of Oxygen=Cm=cm/sec',Cm\n",
    "Cmpv=sqrt(2*R*T/M);#mean probable velocity in cm/sec#\n",
    "print '\\nMean probable velocity of Oxygen=Cmpv=cm/sec',round(Cmpv)#in textbook in Cmpv value it is misprinted as 10^9 but it is actually 10^4#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_12 pgno:109"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Root mean square velocity of Gas=Crms=cm/sec 30015.0112594\n",
      "\n",
      "Mean velocity of Oxygen=Cm=cm/sec 27663.6048474\n",
      "\n",
      "Mean probable velocity of Oxygen=Cmpv=cm/sec 24524.0\n"
     ]
    }
   ],
   "source": [
    "P=10**6;#pressure of gas in dyn per cm^2#\n",
    "p=0.00333;#density of gas in gram per cm^3#\n",
    "C2=3*P/p;#mean square velocity of gas in (cm/sec)^2#\n",
    "Crms=(C2)**0.5;#Root mean square velocity of Oxygen in cm/sec#\n",
    "print 'Root mean square velocity of Gas=Crms=cm/sec',Crms\n",
    "Cm=Crms/1.085;#mean velocity of Gas in cm/sec#\n",
    "print '\\nMean velocity of Oxygen=Cm=cm/sec',Cm\n",
    "Cmpv=Cm/1.128;#mean probable velocity in cm/sec#\n",
    "print '\\nMean probable velocity of Oxygen=Cmpv=cm/sec',round(Cmpv)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_13 pgno:111"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mean free path is inversely proportional to N which is proportional to pressure\n",
      "\n",
      "Mean free path of N2 at 58atm pressure=1*10^-7cm\n"
     ]
    }
   ],
   "source": [
    "print'Mean free path is inversely proportional to N which is proportional to pressure'\n",
    "L1=5.8*10**-6;#mean free path of N2 at NTP in cm#\n",
    "K=58;#preesure is raised 58 times so factor is 58#\n",
    "L2=L1/K;#mean free path of N2 at 58atm pressure in cm#\n",
    "print'\\nMean free path of N2 at 58atm pressure=1*10^-7cm'\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_14 pgno:113"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Since 22.4Litres of Nitrogen gas at 0C and 1atm pressure will contain 6.023*10**23Molecules.\n",
      "\n",
      "Number of molecular collisions per second of Nitrogen at 0C and 1atm==10.43*10**28molecular collisions per sec per cm**3 1.0432680598e+29\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sqrt\n",
    "T=273;#temperature 0C in kelvin#\n",
    "R=8.31*10**7;#Universal gas constant in erg per degree per mole#\n",
    "M=28;#molecular weight of N2 in gram per mole#\n",
    "print'Since 22.4Litres of Nitrogen gas at 0C and 1atm pressure will contain 6.023*10**23Molecules.'\n",
    "N=2.69*10**19;#no. of molecules in molecules per cm**3#\n",
    "G=3.78*10**-8;#collision diameter in cm#\n",
    "K=sqrt(pi*R*T/M);\n",
    "Z11=2*N**2*G**2*K;#number of collisions per second of Nitrogen at 0C and 1atm#\n",
    "print'\\nNumber of molecular collisions per second of Nitrogen at 0C and 1atm==10.43*10**28molecular collisions per sec per cm**3',Z11\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_15 pgno:115"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Since 22.4Litres of Nitrogen gas at 0C and 1atm pressure will contain 6.023*10**23Molecules.\n",
      "\n",
      "Mean velocity of Nitrogen=Cm=cm/sec 45422.6927897\n",
      "\n",
      "Density of Nitrogen=p==1.25*10**-3gram per cm**3 0.00125\n",
      "\n",
      "Mean free path of Nitrogen=L=5.81*10**-6cm\n",
      "\n",
      "Collission diameter of Nitrogen=G=3.80*10**-8cm\n",
      "\n",
      "Number of molecular collisions per second of Nitrogen at NTP==10.52*10**28molecular collisions per sec per cm**3 1.05226395096e+29\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,pi\n",
    "T=273.;#temperature 0C in kelvin#\n",
    "R=8.31*10**7;#Universal gas constant in erg per degree per mole#\n",
    "M=28.;#molecular weight of N2 in gram per mole#\n",
    "print'Since 22.4Litres of Nitrogen gas at 0C and 1atm pressure will contain 6.023*10**23Molecules.'\n",
    "N=2.69*10**19;#no. of molecules in molecules per cm**3#\n",
    "Cm=sqrt(8*R*T/(pi*M));#mean velocity of Nitrogen in cm/sec#\n",
    "print'\\nMean velocity of Nitrogen=Cm=cm/sec',Cm\n",
    "V=22400.;#volume of nitrogen in cm**3#\n",
    "p=M/V;#Density of nitrogen in gram per cm**3#\n",
    "print'\\nDensity of Nitrogen=p==1.25*10**-3gram per cm**3',p\n",
    "n=10.99*10**-5;#Viscosity of N2 in poise#\n",
    "L=(3*n)/(Cm*p);#mean free path of nitrogen in cm#\n",
    "print'\\nMean free path of Nitrogen=L=5.81*10**-6cm'\n",
    "G=sqrt(1/(1.414*pi*L*N));#Collision diameter of Nitrogen in cm#\n",
    "print'\\nCollission diameter of Nitrogen=G=3.80*10**-8cm'\n",
    "K=sqrt(pi*R*T/M);\n",
    "Z11=2*N**2*G**2*K;#number of collisions per second of Nitrogen at 0C and 1atm#\n",
    "print'\\nNumber of molecular collisions per second of Nitrogen at NTP==10.52*10**28molecular collisions per sec per cm**3',round(Z11,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_16 pgno:120"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NH3 being a nonlinear molecule has 3 translational,3 rotational and 6 vibrational degrees of freedom.\n",
      "\n",
      "Cv=3*0.5*R+3*0.5*R+6*R=9*R\n",
      "\n",
      "Change in internal energy of a mole of NH3=dU=cal per mole 2700\n",
      "\n",
      "The actual increase in energy may not be 2700cal per mol\n",
      "because at the given temperature,none or only some of the vibrational degrees of freedom may be contributing to the total energy.\n"
     ]
    }
   ],
   "source": [
    "T1=27;#initial temperature in C#\n",
    "T2=177;#final temperature in C#\n",
    "print'NH3 being a nonlinear molecule has 3 translational,3 rotational and 6 vibrational degrees of freedom.'\n",
    "print'\\nCv=3*0.5*R+3*0.5*R+6*R=9*R'\n",
    "Cv=18;#Molar heat capacity in cal per deg per mol#\n",
    "dU=Cv*(T2-T1);#Change in internal energy of a mole in cal per mole#\n",
    "print'\\nChange in internal energy of a mole of NH3=dU=cal per mole',dU\n",
    "print'\\nThe actual increase in energy may not be 2700cal per mol\\nbecause at the given temperature,none or only some of the vibrational degrees of freedom may be contributing to the total energy.'#answer should come as 2700 not 2400,it was just misprinted#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_17 pgno:120"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CH4 being a nonlinear molecule has 3 translational,3 rotational and 9 vibrational degrees of freedom.\n",
      "\n",
      "Cv=3*0.5*R+3*0.5*R+9*R=12*R\n",
      "\n",
      "Actual Cv is 16cal per degree per mol\n",
      "\n",
      "Real molar heat capapcity of a mole of CH4=Cvr=cal per degree per mole 14\n",
      "\n",
      "The Real molar heat capacity at constant volume is 10cal less than the theoretical value.\n",
      "Since each vibrational degree of freedom can contribute 2cal,this means that 5 vibrational degrees\n",
      "are not contributing at the given temperature.\n"
     ]
    }
   ],
   "source": [
    "print'CH4 being a nonlinear molecule has 3 translational,3 rotational and 9 vibrational degrees of freedom.'\n",
    "print'\\nCv=3*0.5*R+3*0.5*R+9*R=12*R'\n",
    "Cv=24;#Molar heat capacity in cal per degree per mol#\n",
    "print'\\nActual Cv is 16cal per degree per mol'\n",
    "R=2;\n",
    "Cvr=16-R;#Real molar heat capapcity in cal per degree per mole#\n",
    "print'\\nReal molar heat capapcity of a mole of CH4=Cvr=cal per degree per mole',Cvr\n",
    "print'\\nThe Real molar heat capacity at constant volume is 10cal less than the theoretical value.\\nSince each vibrational degree of freedom can contribute 2cal,this means that 5 vibrational degrees\\nare not contributing at the given temperature.'\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_18 pgno:123"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The lowest temperature at which cylinder can explode=T=K 645.8\n"
     ]
    }
   ],
   "source": [
    "a=3.60;#Van der Waals constant for CO2 in L^2 atm per mol^2#\n",
    "b=4.30*10**-2;#Van der Waals constant for CO2 in litre per mol#\n",
    "N=300.;#No. of moles of CO2 the cylinder contains#\n",
    "V=100.;#volume of cylinder in litres#\n",
    "P=150.;#Maximum pressure the cylinder can withstand in atm#\n",
    "R=0.082;\n",
    "K1=P+(N**2*a/V**2);\n",
    "K2=V-(N*b);\n",
    "T=(K1*K2)/(N*R);#The lowest temperature at which cylinder can explode in Kelvin#\n",
    "print'The lowest temperature at which cylinder can explode=T=K',round(T,1)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_19 pgno:137"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Viscosity of Liquid A=nA=centipoise 10.8\n",
      "\n",
      "Viscosity of Liquid B=nB=centipoise 8.5\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "tA=280.;#time of flow for liquid A in seconds#\n",
    "tB=200.;#time of flow for liquid B in seconds#\n",
    "pA=1.;#density of liquid A in gram per cm**3#\n",
    "pB=1.1;#density of liquid B in gram per cm**3#\n",
    "h=10.;#height of liquid responsible for the flow in cm#\n",
    "g=980.;#gravity constant in dyns#\n",
    "V=1.;#volume of liquid in ml#\n",
    "L=10.;#length of the capillary in cm#\n",
    "r=0.1;#radius of the capillary in cm#\n",
    "PA=h*pA*g;#Pressure of liquid A#\n",
    "PB=h*pB*g;#Pressure of liquid B#\n",
    "nA=(pi*PA*tA*r**4)/(8*L*V);#Viscosity of Liquid A in centipoise#\n",
    "print'\\nViscosity of Liquid A=nA=centipoise',round(nA,1)\n",
    "nB=(pi*PB*tB*r**4)/(8*L*V);#Viscosity of Liquid B in centipoise#\n",
    "print'\\nViscosity of Liquid B=nB=centipoise',round(nB,1)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_20 pgno:142"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Depression observed in capillary tube=h=cm 0.78\n"
     ]
    }
   ],
   "source": [
    "ST=520.;#surface tension of mercury in dyn per cm#\n",
    "d=13.6;#density of mercury in gram per cm**3#\n",
    "g=980.;#gravity constant in dyns#\n",
    "r=0.1;#radius of the capillary tube in cm#\n",
    "h=(ST*2)/(g*r*d);#Depression observed in capillary tube in cm#\n",
    "print'Depression observed in capillary tube=h=cm',round(h,3)#the answer is given wrong in textbook,it should actually be double the one given#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_21 pgno:146"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "surface excess concentration of phenol=mol per cm^2 4.06599228694e-10\n"
     ]
    }
   ],
   "source": [
    "T=293.;#temperature 20C in kelvin#\n",
    "R=8.31*10**7;#Universal gas constant in erg per degree per mole#\n",
    "dr=165.;#Change of surface tension in erg per cm^2 per mol litre#\n",
    "C=0.06;#concentration we are considering in M#\n",
    "t=(C*dr)/(R*T);#surface excess concentration of phenol in mol per cm^2#\n",
    "print'surface excess concentration of phenol=mol per cm^2',t\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_22 pgno:148"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Area per molecule=20.4*10^-16cm^2.\n",
      "This is the area of crosssection A for a vertical position.\n",
      "\n",
      "Length of a molecule= 2.56950717655e-07\n"
     ]
    }
   ],
   "source": [
    "M=256;#Molecular weight of acid in grams#\n",
    "w=2.56*10**-5;#weight of palmitic acid in grams#\n",
    "N=w/M;#No. of molecules of acid#\n",
    "A=123.;#Total area occupied in cm^2#\n",
    "AM=A/N;#Area per molecule in cm^2#\n",
    "print'Area per molecule=20.4*10^-16cm^2.\\nThis is the area of crosssection A for a vertical position.'\n",
    "V=w/0.81;#Volume of acid in cm^3#\n",
    "VM=V/N;#Volume of one molecule of acid in cm^3#\n",
    "L=VM/AM;#Length of molecule in cm#\n",
    "print'\\nLength of a molecule=',L\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_23 pgno:150"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Molecular weight of substance=MW==123 122.947499\n"
     ]
    }
   ],
   "source": [
    "T=298.;#Temperature in kelvin#\n",
    "ST=0.2;#Lowered surface tension in dyn per cm#\n",
    "K=1.37*10**-16;#Boltzman's constant#\n",
    "AM=(K*T)/ST;#Area per molecule on the surface in cm**2#\n",
    "A=300.;#Total area occupied in cm**2#\n",
    "N=A/AM;#no. of molecules#\n",
    "W=3*10**-7;#weight of insoluble substance in grams#\n",
    "w=W/N;#weight of one molecule in grams#\n",
    "N1=6.023*10**23;\n",
    "MW=w*N1;#Molecular weight of substance in grams#\n",
    "print'Molecular weight of substance=MW==123',MW\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_24 pgno:152"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The count for lead iodide as absorbed=CR=%fcount per minute 2100.0\n",
      "\n",
      "The ratio of weights of lead iodide and radio lead iodide in solution is equal to that of the same ratio on surface\n",
      "\n",
      "Weight of lead iodide in solution=0.0014grams\n",
      "\n",
      "Weight of radio lead iodide is proportional to the count.\n",
      "Weight of lead iodide on the surface=0.0014*21/9.\n",
      "Molecular weight of lead iodide=461.\n",
      "Area of the surface per gram=4266cm**2 g**-1\n"
     ]
    }
   ],
   "source": [
    "MW=461.;#molecular weight of lead iodide in  grams#\n",
    "CR1=3000.;#initial count rate in count per minute#\n",
    "CR2=900.;#final count rate in count per minute#\n",
    "CR=CR1-CR2;\n",
    "print'The count for lead iodide as absorbed=CR=%fcount per minute',CR\n",
    "print'\\nThe ratio of weights of lead iodide and radio lead iodide in solution is equal to that of the same ratio on surface'\n",
    "print'\\nWeight of lead iodide in solution=0.0014grams'\n",
    "print'\\nWeight of radio lead iodide is proportional to the count.\\nWeight of lead iodide on the surface=0.0014*21/9.\\nMolecular weight of lead iodide=461.\\nArea of the surface per gram=4266cm**2 g**-1'\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_25 pgno:154"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "From the linear plot of the langmuir isotherm the intercept Xm=1/0.19=5.26milligrams\n",
      "\n",
      "This is the weight of N2 that forms a unimolecular layer of 2g charcoal.\n",
      "\n",
      "Area of N2 per gram=cm**2 90517.0\n"
     ]
    }
   ],
   "source": [
    "print'From the linear plot of the langmuir isotherm the intercept Xm=1/0.19=5.26milligrams'\n",
    "Xm=5.26*10**-3;\n",
    "print'\\nThis is the weight of N2 that forms a unimolecular layer of 2g charcoal.'\n",
    "MW=28;#molecular weight of N2#\n",
    "N=Xm*6.023*10**23/MW;#No. of molecules of N2#\n",
    "TA=N*16*10**-16;#Total area in cm**2#\n",
    "A=TA/2;#Area per gram in cm**2#\n",
    "print'\\nArea of N2 per gram=cm**2',round(A)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_26 pgno:155"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "From the linear plot of the langmuir isotherm the intercept=0.35*10**-3 and slope=9.47*10**-2\n",
      "\n",
      "Volume is the inverse of summation of intercept and slope and that is 10.52cc\n",
      "\n",
      "Area of N2 per gram=cm**2 25862.0\n"
     ]
    }
   ],
   "source": [
    "print'From the linear plot of the langmuir isotherm the intercept=0.35*10**-3 and slope=9.47*10**-2'\n",
    "print'\\nVolume is the inverse of summation of intercept and slope and that is 10.52cc'\n",
    "Vm=10.52;#volume in cc#\n",
    "m=Vm/22400;#No. of moles of N2#\n",
    "N=m*6.023*10**23;#No. of molecules of N2#\n",
    "TA=N*16*10**-16;#Total area in cm**2#\n",
    "A=TA/17.5;#Area per gram in cm**2#\n",
    "print'\\nArea of N2 per gram=cm**2',round(A)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_28 pgno:161"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "One globule of mercury occpies a volume of 1.33*3.14*r**3cm**3\n",
      "Surface area of one globule=4*3.14*r**2\n",
      "\n",
      "No. of globules in 0.0738cm**3=y= 4.12164838569e+14\n",
      "\n",
      "Surface area of y globules=SA=cm**2 63416.0\n"
     ]
    }
   ],
   "source": [
    "d=13.56;#density of mercury in gr per cm**3#\n",
    "V=1/d;#Volume of mercury in cm**3#\n",
    "D=0.07*10**-4;#Diameter of the globule in cm#\n",
    "r=D/2;#radius of globule in cm#\n",
    "print'One globule of mercury occpies a volume of 1.33*3.14*r**3cm**3\\nSurface area of one globule=4*3.14*r**2'\n",
    "Vg=1.33*3.14*r**3;#volume of one globule in cm**3#\n",
    "y=0.0738/Vg;#No of globules in 0.0738 volume#\n",
    "print'\\nNo. of globules in 0.0738cm**3=y=',y\n",
    "SA=y*4*3.14*r**2;#Surface area of y globules in cm**2#\n",
    "print'\\nSurface area of y globules=SA=cm**2',round(SA)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_29 pgno:168"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Since the dispersion medium is water its density is p1=1.\n",
      "when the system equilibrated average number of colloidal particles seen in the field is halved so N0/N=2.\n",
      "the required expression is derived based on kinetic energy of particles\n",
      "\n",
      "Value of Avagadro number is L==6.037*10**23molecules per mol. 6.03775763968e+23\n"
     ]
    }
   ],
   "source": [
    "from math import pi,log\n",
    "T=300;#temperature in kelvin#\n",
    "R=8.31*10**7;#Universal gas constant in ergs#\n",
    "r=2*10**-5;#average radius of particles in cm#\n",
    "h=4.15*10**-3;#Vertical seperation in cm#\n",
    "p=1.21;#density of latex in gram per cm**3#\n",
    "g=980;#gravity constant in dynes#\n",
    "print'Since the dispersion medium is water its density is p1=1.\\nwhen the system equilibrated average number of colloidal particles seen in the field is halved so N0/N=2.\\nthe required expression is derived based on kinetic energy of particles'\n",
    "p1=1;#density of water#\n",
    "L=log(2)*0.75*(R*T)/(pi*g*h*(p-p1)*r**3);\n",
    "print'\\nValue of Avagadro number is L==6.037*10**23molecules per mol.',round(L,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_30 pgno:169"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "No .of particles per ml=N= 81963735.7136\n",
      "\n",
      "Weight of one particle=w=1.83*10**-15grams\n",
      "\n",
      "Volume of one particle=V=3.52*10**-16cm**3\n",
      "Radius of particle=R=\n",
      "Diameter of particle= 2e-05 5.2\n"
     ]
    }
   ],
   "source": [
    "Vf=117.857*10**-9;#Volume falling within field of view in ml#\n",
    "AN=9.66;#Average no. of particles per count#\n",
    "N=AN/Vf;#No. of particles per count#\n",
    "print'No .of particles per ml=N=',N\n",
    "W=1.5*10**-7;#Weight of iron oxide per ml#\n",
    "w=W/N;#weight of one particle in grams#\n",
    "print'\\nWeight of one particle=w=1.83*10**-15grams'\n",
    "d=5.2;#density of iron oxide in g per cm**3#\n",
    "V=w/d;#Volume of one particle in cm**3#\n",
    "print'\\nVolume of one particle=V=3.52*10**-16cm**3'\n",
    "R=2.032*10**-5;#radius of particle in cm#\n",
    "print'Radius of particle=R=\\nDiameter of particle=',r,d\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_31 pgno:177"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Electrokinetic potential of the catalyst=EP=volts 0.0352\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "D=78.;#dielectric constant#\n",
    "V=0.009;#viscosity of suspension in dyn sec per cm**2#\n",
    "P=3.2;#potential gradient in volt per cm#\n",
    "t=38.2;\n",
    "d=0.033;#standard distance between electrodes in cm#\n",
    "u=90000.;\n",
    "EP=(4*pi*V*u*d)/(D*t*P);#Electrokinetic potential of the catalyst in volts#\n",
    "print'Electrokinetic potential of the catalyst=EP=volts',round(EP,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_32 pgno:178"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Zeta potential of the catalyst=EP=volts 0.0422215040552\n",
      "\n",
      "The effective thickness of the double layer can be taken to be 1cm\n",
      "\n",
      "Total no. of charges carried by a particle=N= 2.82743338823e-11\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "D=80.36;#dielectric constant#\n",
    "V=0.01;#viscosity of suspension in dyn sec per cm**2#\n",
    "P=10;#potential gradient in volt per cm#\n",
    "v=3*10**-3;#observed velocity in cm per sec#\n",
    "u=90000;\n",
    "EP=(4*pi*V*u*v)/(D*P);#Zeta potential of the catalyst in volts#\n",
    "print'Zeta potential of the catalyst=EP=volts',EP\n",
    "print'\\nThe effective thickness of the double layer can be taken to be 1cm'\n",
    "e=9*10**-4;\n",
    "r=0.5*10**-4;\n",
    "N=4*pi*e*r**2;#total no. of charges carried by a particle#\n",
    "print'\\nTotal no. of charges carried by a particle=N=',N\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_33 pgno:179"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Amount of flow of water through diaphragm=FW=cm per hour 76.7\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "D=80.36;#dielectric constant#\n",
    "V=0.01;#viscosity of suspension in dyn sec per cm**2#\n",
    "P=100;#potential gradient in volt per cm#\n",
    "u=90000;\n",
    "EP=0.03;#Electrokinetic potential of the catalyst in volts#\n",
    "FW=(P*EP*D*3600)/(4*pi*V*u);#amount of flow of water in cm per hour#\n",
    "print'Amount of flow of water through diaphragm=FW=cm per hour',round(FW,1)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_34 pgno:179"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Amount of flow of water through diaphragm=FW=cc per hour 0.4018\n"
     ]
    }
   ],
   "source": [
    "D=80.36;#dielectric constant#\n",
    "V=0.01;#viscosity of suspension in dyn sec per cm^2#\n",
    "P=40;#potential gradient in volt per cm#\n",
    "r=0.05;#radius of capillary in cm#\n",
    "u=90000;\n",
    "ZP=0.05;#Zeta potential of the catalyst in volts#\n",
    "FW=(P*ZP*D*3600*r**2)/(4*V*u);#amount of flow of water in cc per hour#\n",
    "print'Amount of flow of water through diaphragm=FW=cc per hour',FW\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_35 pgno:189"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The amount of Na+ transported at equilibrium=x=2*10**-4M\n",
      "\n",
      "Na+ on RHS=4.5*10**-4M.\n",
      "Cl- on RHS=x=2*10**-4M.\n",
      "Na+ on LHS=Cl- on LHS=C1-x=3*10**-4M\n",
      "\n",
      "E is in volts and F in coulombs.for homogeneity of units either R should be expressed in coulombs or F in calories.F is 96500C or 23060cal.\n",
      "\n",
      "Emf across membrane=E=volts 0.0105\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "C1=5*10**-4;\n",
    "C2=2.5*10**-4;\n",
    "x=(C1**2)/(C2+(2*C1));#The amount of Na+ transported at equilibrium in M#\n",
    "print'The amount of Na+ transported at equilibrium=x=2*10**-4M'\n",
    "NaR=C2+x;#Na+ on RHS#\n",
    "print'\\nNa+ on RHS=4.5*10**-4M.\\nCl- on RHS=x=2*10**-4M.\\nNa+ on LHS=Cl- on LHS=C1-x=3*10**-4M'\n",
    "print'\\nE is in volts and F in coulombs.for homogeneity of units either R should be expressed in coulombs or F in calories.F is 96500C or 23060cal.'\n",
    "F=23060;\n",
    "n=1;\n",
    "T=300;#temperature in kelvin#\n",
    "R=2;\n",
    "K=1.5;\n",
    "E=(R*T*log(K))/(n*F);#Emf across membrane in volts#\n",
    "print'\\nEmf across membrane=E=volts',round(E,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_36 pgno:190"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The amount of Na+ transported at equilibrium=x=M 0.016\n",
      "\n",
      "Na+ on RHS=NaR=M 0.036\n",
      "\n",
      "Na+ on LHS=NaL=M 0.024\n"
     ]
    }
   ],
   "source": [
    "C1=0.04;\n",
    "C2=0.02;\n",
    "x=(C1**2)/(C2+(2*C1));#The amount of Na+ transported at equilibrium in M#\n",
    "print'The amount of Na+ transported at equilibrium=x=M',x\n",
    "NaR=C2+x;#Na+ on RHS#\n",
    "print'\\nNa+ on RHS=NaR=M',NaR\n",
    "NaL=C1-x;#Na+ on LHS#\n",
    "print'\\nNa+ on LHS=NaL=M',NaL\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_37 pgno:210"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Molar Volume of NaCl=MV=cc 26.935483871\n",
      "\n",
      "This must contain 6.023*10^23 NaCl units.\n",
      "In one unit cell of NaCl there are 8 corner Na+ ions and 6 on the face centres.\n",
      "The number of Na+ ions in one unit cell is 8*1/8+6*1/2=4.\n",
      "There are 12Cl- ions on the edges,and one in the centre.\n",
      "The number of Cl- ions are 12*1/4+1=4 \n",
      "\n",
      "The volume of the unit cell containing 4 NaCl units=179*10^-24cc\n",
      "\n",
      "Unit cell length of NaCl crystal=a=5.63*10^-8cm\n",
      "\n",
      "Interionic distance in the crystal=Id=2.815*10^-8cm\n",
      "\n",
      "Wavelength of the Xrays used=L=Angstrums 0.58\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sin\n",
    "MW=58.45;#Molar weight of NaCl in grams#\n",
    "d=2.17;#density of NaCl in g/cc#\n",
    "MV=MW/d;#Molar volume in cc#\n",
    "print'Molar Volume of NaCl=MV=cc',MV\n",
    "print'\\nThis must contain 6.023*10^23 NaCl units.\\nIn one unit cell of NaCl there are 8 corner Na+ ions and 6 on the face centres.\\nThe number of Na+ ions in one unit cell is 8*1/8+6*1/2=4.\\nThere are 12Cl- ions on the edges,and one in the centre.\\nThe number of Cl- ions are 12*1/4+1=4 '\n",
    "print'\\nThe volume of the unit cell containing 4 NaCl units=179*10^-24cc'\n",
    "a=5.63*10**-8;#unit cell length in cm#\n",
    "print'\\nUnit cell length of NaCl crystal=a=5.63*10^-8cm'\n",
    "Id=a/2;#Interionic distance in cm#\n",
    "print'\\nInterionic distance in the crystal=Id=2.815*10^-8cm'\n",
    "Q=5.9;#glancing angle in degrees#\n",
    "L=2*Id*sin(Q*pi/180)*10**8;#wavelenth in angstrums#\n",
    "print'\\nWavelength of the Xrays used=L=Angstrums',round(L,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4_39 pgno:215"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Density of Na at room temperature=p=g/cm**3 0.966650377571\n",
      "\n",
      "Density of Na at -195degrees temperature=P=g/cm**3 1.0051230626\n",
      "\n",
      "Number of unitcells at -195degrees=N1= 4.0\n",
      "\n",
      "At -195degrees temperature Na have 4 unitcells which means it assumes an FCC structure.\n"
     ]
    }
   ],
   "source": [
    "N=2.;#No. of atoms or unit cells in BCC structure#\n",
    "L=6.023*10**23;#Avagadro number#\n",
    "a=4.291*10**-8;#Unit cell edge length in cm#\n",
    "Na=23.;#weight of Na#\n",
    "p=(N*Na)/(L*a**3);#density of Na at room temperature in g/cm**3#\n",
    "print'Density of Na at room temperature=p=g/cm**3',p\n",
    "P=p*1.0398;#density of Na at -195degrees temperature in g/cm**3#\n",
    "print'\\nDensity of Na at -195degrees temperature=P=g/cm**3',P\n",
    "a1=5.35*10**-8;#unit cell edge length in cm#\n",
    "N1=(P*L*a1**3)/(Na);#No. of unitcells at -195degrees#\n",
    "print'\\nNumber of unitcells at -195degrees=N1=',round(N1)\n",
    "print'\\nAt -195degrees temperature Na have 4 unitcells which means it assumes an FCC structure.'\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
