{
 "metadata": {
  "name": "",
  "signature": "sha256:63e7a1dd37e633f9295c9d960c0e205303b570a077850a55f1a7161c70b32cb5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Introduction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1 pg : 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "import math \n",
      "d = 8. \t\t\t#in\n",
      "ir = 16. \t\t\t#in\n",
      "MW = 28.97\n",
      "T = 70.+460 \t\t\t#R\n",
      "P = 30+14.7 \t\t\t#psia\n",
      "\t\t\t\n",
      "# Calculations\n",
      "V = math.pi**2 *d**2 *(d+ir)/4\n",
      "V = V*10./12**3\n",
      "Rair = 1545/MW\n",
      "m = P*144*V/(Rair*T)\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"Mass of air  =  %.2f lbm\"%(m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of air  =  4.99 lbm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2 pg : 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "V = 4. \t\t\t#in**3\n",
      "P = 30. \t\t\t#psia\n",
      "T = 500.\t\t\t#R\n",
      "MW = 32.\n",
      "\t\t\t\n",
      "# Calculations\n",
      "print (\"Metric unit conversion,\")\n",
      "V = V*2.54**3 *10**-3\n",
      "P = 30*4.448/(2.54**2 *10**-4)\n",
      "T = 5*(T-32)/9 +273\n",
      "n = P*V/(8314.5*T)\n",
      "eta = n*1000\n",
      "N = eta*6.025*10**23\n",
      "m = eta*MW\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"No. of molecules of oxygen  =  %.3e molecules\"%(N)\n",
      "print \" Mass of molecules  =  %.1f g\"%(m)\n",
      "\n",
      "#The answer in the textbook is a bit different due to rounding off error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Metric unit conversion,\n",
        "No. of molecules of oxygen  =  1.843e+24 molecules\n",
        " Mass of molecules  =  97.9 g\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3 pg : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "import math \n",
      "P = 14.7 \t\t\t#psia\n",
      "T = 70.+460 \t\t\t#R\n",
      "M = 32.\n",
      "\t\t\t\n",
      "# Calculations\n",
      "Ro = 1545/M\n",
      "V2 = 3*Ro*T\n",
      "V2 = V2*32.174\n",
      "vrms = math.sqrt(V2)\n",
      "\t\t\t\n",
      "# Results\n",
      "print \"rms velocity  =  %d ft/sec\"%(vrms)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rms velocity  =  1571 ft/sec\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}