{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "    Chapter 1 - The properties of gases"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the pressure in the glass flask\n",
      "#Initialzation of variables\n",
      "m=1.25 #g\n",
      "MN2=28.02 #g/mol\n",
      "T=20+273.15 #K\n",
      "V=0.25#L\n",
      "#Calculations\n",
      "P=m*8.31451*T/(MN2*V)\n",
      "#Results\n",
      "print '%s %.1f %s' %('Pressure in the gas flask = ',P,'kPa')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure in the gas flask =  434.9 kPa\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example I2 - Pg 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the partial pressures of Oxygen, Nitrogen and Argon\n",
      "#Initialzation of variables\n",
      "xN2=0.780\n",
      "xO2=0.210\n",
      "xAr=0.009\n",
      "P=100 #kPa\n",
      "#Calculations\n",
      "PN2=xN2*P\n",
      "PO2=xO2*P\n",
      "PAr=xAr*P\n",
      "#Results\n",
      "print '%s %.1f' %('Partial pressure of Nitrogen(kPa) = ',PN2)\n",
      "print '%s %.1f' %('\\n Partial pressure of Oxygen(kPa) = ',PO2)\n",
      "print '%s %.1f' %('\\n Partial pressure of Argon(kPa) = ',PAr)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Partial pressure of Nitrogen(kPa) =  78.0\n",
        "\n",
        " Partial pressure of Oxygen(kPa) =  21.0\n",
        "\n",
        " Partial pressure of Argon(kPa) =  0.9\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example I3 - Pg 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the percentage loss of speed of air molecules\n",
      "#Initialzation of variables\n",
      "import math\n",
      "T1=298. #K\n",
      "T2=273. #K\n",
      "#Calculations\n",
      "factor=math.sqrt(T2/T1)\n",
      "percentage=(1-factor)*100\n",
      "#Results\n",
      "print '%s %.3f' %('Factor by which speed is reduced = ',factor)\n",
      "print '%s %d' %('Percentage loss of speed of air molecules = ',percentage)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Factor by which speed is reduced =  0.957\n",
        "Percentage loss of speed of air molecules =  4\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example I4 - Pg 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the ratio of rates of effusion\n",
      "#Initialzation of variables\n",
      "import math\n",
      "MH2=2.016 #g/mol\n",
      "MCO2=44.01 #g/mol\n",
      "#calculations\n",
      "ratio=math.sqrt(MCO2/MH2)\n",
      "#results\n",
      "print '%s %.3f' %('ratio of rates of effusion = ',ratio)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ratio of rates of effusion =  4.672\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example I5 - Pg 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the mean free path and collision frequency\n",
      "#Initialzation of variables\n",
      "import math\n",
      "T=25+273. #K\n",
      "sigma=0.4*math.pow(10,(-18)) #m^2\n",
      "P=math.pow(10,5) #Pa\n",
      "c=481.8 #m/sec\n",
      "#Calculations\n",
      "Lambda=8.31451*T/(math.pow(2,0.5) *6.022*math.pow(10,23) *sigma*P)\n",
      "frequency=math.pow(2,0.5) *6.022*math.pow(10,23) *sigma*P*c/(8.31451*T)\n",
      "#Results\n",
      "print '%s %.1e %s' %('Mean free path =',Lambda,'m')\n",
      "print '%s %.1e %s' %('\\n Collision frequency =',frequency,'m')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mean free path = 7.3e-08 m\n",
        "\n",
        " Collision frequency = 6.6e+09 m\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}