{
 "metadata": {
  "name": "",
  "signature": "sha256:163d017a43636b203253208922a2be0b72d9894b37f4d97c9da43a5e9b39c875"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 - Gases and Introductory stastical thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - pg 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Gas constant\n",
      "#Initialization of variables\n",
      "h=76. #cm\n",
      "d=13.5951 #g/cc\n",
      "g=980.655 #cm/s^2\n",
      "T=273.15 #K\n",
      "v=22414.6 #cm^3 /mol\n",
      "#calculations\n",
      "P=h*d*g\n",
      "R=P*v/(T)\n",
      "#results\n",
      "print '%s %.3e %s' %(\"Gas constant =\",R,\"ergs/deg. mol\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gas constant = 8.315e+07 ergs/deg. mol\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - pg 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the R value in calories\n",
      "#Initialization of variables\n",
      "cal=4.184*10**7 #ergs\n",
      "R=8.315*10**7 #ergs/deg/mol\n",
      "#calculations\n",
      "Rdash=R/cal\n",
      "#results\n",
      "print '%s %.3f %s' %(\"R in calories =\",Rdash,\" cal/ deg mol\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R in calories = 1.987  cal/ deg mol\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - pg 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the root mean square velocity\n",
      "#Initialization of variables\n",
      "import math\n",
      "from math import sqrt\n",
      "R=8.315*10**7 #ergs/deg/mol\n",
      "T=273.2 #deg\n",
      "M=4 #g/mol\n",
      "#calculations\n",
      "u2=3*T*R/M\n",
      "u=sqrt(u2)\n",
      "#results\n",
      "print '%s %.2e %s' %(\"root mean square velocity =\",u,\" cm/sec\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "root mean square velocity = 1.31e+05  cm/sec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - pg 194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Partial pressure of N2, O2 and CO2\n",
      "#Initialization of variables\n",
      "n1=2.\n",
      "n2=10.\n",
      "n3=3.\n",
      "P=720. #mm of Hg\n",
      "#calculations\n",
      "n=n1+n2+n3\n",
      "x1=n1/n\n",
      "P1=x1*P\n",
      "x2=n2/n\n",
      "P2=x2*P\n",
      "x3=n3/n\n",
      "P3=x3*P\n",
      "#results\n",
      "print '%s %d %s' %(\"\\n Partial pressure of N2 =\",P1,\"mm\")\n",
      "print '%s %d %s' %(\"\\n Partial pressure of O2 =\",P2,\" mm\")\n",
      "print '%s %d %s' %(\"\\n Partial pressure of CO2 =\",P3,\"mm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " Partial pressure of N2 = 96 mm\n",
        "\n",
        " Partial pressure of O2 = 480  mm\n",
        "\n",
        " Partial pressure of CO2 = 144 mm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - pg 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Total energy\n",
      "#Initialization of variables\n",
      "T=273.2+25 #K\n",
      "n=1 #mol\n",
      "R=1.987 #cal/deg mol\n",
      "#calculations\n",
      "Etr=1.5*n*R*T\n",
      "Erot=1.5*n*R*T\n",
      "Evib=0\n",
      "Eel=0\n",
      "Etot=Etr+Erot+Evib+Eel\n",
      "#results\n",
      "print '%s %d %s' %(\"Total energy =\",Etot,\"cal\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total energy = 1777 cal\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - pg 199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Molecular diameter of He\n",
      "#Initialization of variables'\n",
      "import math\n",
      "b=24.1 #cm^2/mol\n",
      "N=6.023*10**23 #mole^-1\n",
      "#calculations\n",
      "d=(3*b/(2*math.pi*N))**(1./3)\n",
      "#results\n",
      "print '%s %.2e %s' %(\"Molecular diameter of He =\",d,\" cm\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Molecular diameter of He = 2.67e-08  cm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8 - pg 205"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Volume\n",
      "#Initialization of variables\n",
      "P=100. #atm\n",
      "T=200. #K\n",
      "n=1. #mole\n",
      "R=0.08206 #l atm/deg mol\n",
      "print \"From psychrometric charts,\"\n",
      "Tc=126.2 #K\n",
      "Pc=33.5 #K\n",
      "#calculations\n",
      "Pr=P/Pc\n",
      "Tr=T/Tc\n",
      "print \"From z charts,\"\n",
      "z=0.83\n",
      "V=z*n*R*T/P\n",
      "#results\n",
      "print '%s %.3f %s' %(\"Volume =\",V,\" liter\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From psychrometric charts,\n",
        "From z charts,\n",
        "Volume = 0.136  liter\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}