{
 "metadata": {
  "name": "",
  "signature": "sha256:e0fac09bbeb2cd0ce192e8aaee02b91055f447d7bbfe0689b860ffad5cfd7b06"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : The Ideal Gas"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1  Page No : 241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "P1 = 100.; \t\t\t#Pressure at volume V1 = 100 ft**3 \t\t\t#Unit:psia\n",
      "V1 = 100.; \t\t\t#Unit:ft**3 \t\t\t#V1 = Volume at 100 psia\n",
      "P2 = 30. \t\t\t# Reduced Pressure \t\t\t#Unit:psia\n",
      "\n",
      "# Calculations\n",
      "#Boyle's law,P1*V1 = P2*V2\n",
      "V2 = (P1*V1)/P2; \t\t\t#Volume occupied by the gas \t\t\t#ft**3\n",
      "\n",
      "# Results\n",
      "print \"Volume occupied by the gas  =  %.2f ft**3\"%(V2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume occupied by the gas  =  333.33 ft**3\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2  Page No : 241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "P1 = 10.**6; \t\t\t#Pressure at volume V1 = 2 m**3 \t\t\t#Unit:Pa\n",
      "V1 = 2.; \t\t\t#Unit:m**3 \t\t\t#V1 = Volume at 10**6 Pa\n",
      "P2 = 8.*10**6 \t\t\t# Increased Pressure \t\t\t#Unit:Pa\n",
      "\n",
      "# Calculations\n",
      "#Boyle's law,P1*V1 = P2*V2\n",
      "V2 = (P1*V1)/P2; \t\t\t#Volume occupied by gas \t\t\t#unit:m**3\n",
      "\n",
      "# Results\n",
      "print \"Volume occupied by gas  =  %.2f m**3\"%(V2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume occupied by gas  =  0.25 m**3\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3  Page No : 242"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given value\n",
      "T1 = 32.+460; \t\t\t#Temperature at volume V1 = 150 ft**3 \t\t\t#Unit:R\n",
      "V1 = 150.; \t\t\t#Unit:ft**3 \t\t\t#V1 = Volume at 32 F\n",
      "T2 = 100.+460 \t\t\t# Increased Temperature \t\t\t#Unit:R\n",
      "\n",
      "# Calculations\n",
      "#Charles's law,V1/V2  =  T1/T2\n",
      "V2 = (T2*V1)/T1; \t\t\t#Volume occupied by gas \t\t\t#unit:m**3\n",
      "\n",
      "# Results\n",
      "print \"Volume occupied by gas  =  %.2f m**3\"%(V2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume occupied by gas  =  170.73 m**3\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4  Page No : 242"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#If for this process T2 = 1.25*T1,\n",
      "# T2/T1  =  1.25\n",
      "#Therefore,\n",
      "# p2/p1  =  T2/T1 \t\t\t#Charles's law(volume constant)\n",
      "#Thus,\n",
      "print \"The absolute gas pressure increases by 25 percent\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute gas pressure increases by 25 percent\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5  Page No : 242"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "V1 = 4.; \t\t\t#m**3 \t\t\t#initial volume\n",
      "T2 = 0.+273; \t\t\t#celsius converted to kelvin  \t\t\t#gas is cooled to 0 C \t\t\t#final temperature\n",
      "T1 = 100+273; \t\t\t#celsius converted to kelvin \t\t\t#initial temperature\n",
      "\n",
      "# Calculations\n",
      "V2 = V1*(T2/T1); \t\t\t#final volume \t\t\t#Charles's law(pressure constant) \t\t\t#unit:m**3\n",
      "\n",
      "# Results\n",
      "print \"The final volume is %.2f m**3\"%(V2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The final volume is 2.93 m**3\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6  Page No : 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Let us first put each of the given variables into a consistent set of units:\n",
      "p = (200+14.7)*(144); \t\t\t#Unit:psfa*(lbf/ft**2) \t\t\t#1 ft**2 = 144 in**2 \t\t\t#pressure\n",
      "T = (460.+73); \t\t\t#Fahrenheit temperature converted to absolute temperature \t\t\t#unit:R\n",
      "V = 120./1728;  \t\t\t#1 ft**3 = 1728 in**3 \t\t\t#total volume \t\t\t#unit:ft**3\n",
      "R = 1545./28; \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#because the molecular weight of nitrogen is 28 \t\t\t#constant of proportionality\n",
      "#Applying, p*v = R*T, \t\t\t#ideal gas law\n",
      "v = (R*T)/p; \t\t\t#Unit:ft**3/lbm \t\t\t#specific volume\n",
      "print \"The specific volume is %.2f ft**3/lbm\"%(v);\n",
      "#The mass of gas is the total volume divided by the specific volume\n",
      "print \"The gas in the container is %.2f lbm\"%(V/v);\n",
      "#The same result is obtained by direct use of eq. p*V = m*R*T\n",
      "m = (p*V)/(R*T); \t\t\t#The gas in the container \t\t\t#unit:lbm \t\t\t#ideal gas law\n",
      "print \"The gas in the container is %.2f lbm\"%(m); \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The specific volume is 0.95 ft**3/lbm\n",
        "The gas in the container is 0.07 lbm\n",
        "The gas in the container is 0.07 lbm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7  Page No : 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Applying , (p1*V1)/T1  =  (p2*V2)/T2\n",
      "#and p2 = p1*(T2/T1) because V1 = V2\n",
      "p1 = 200+14.7; \t\t\t#Unit:psia \t\t\t#initial pressure\n",
      "T2 = 460.+200; \t\t\t#final temperature is 200 F \t\t\t#Fahrenheit temperature converted to absolute temperature \t\t\t#unit:R\n",
      "T1 = 460+73; \t\t\t#Fahrenheit temperature converted to absolute temperature \t\t\t#unit:R\n",
      "\n",
      "# Calculations\n",
      "p2 = p1*(T2/T1); \t\t\t#final pressure \t\t\t#Unit:psia \t\t\t#Charles's law(volume constant)\n",
      "\n",
      "# Results\n",
      "print \"The final pressure is %.2f psia\"%(p2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The final pressure is 265.86 psia\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8  Page No : 246"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#For CO2,\n",
      "R = 8.314/44; \t\t\t#Unit:kJ/kg*K \t\t\t#constant of proportionality \t\t\t#Molecular weight of CO2 = 44\n",
      "p = 500; \t\t\t#Unit:kPa \t\t\t#pressure\n",
      "V = 0.5; \t\t\t#Unit:m**3 \t\t\t#volume\n",
      "T = (100.+273); \t\t\t#Unit:K \t\t\t#Celsius converted to kelvin\n",
      "\n",
      "# Calculations\n",
      "#Applying p*V = m*R*T ,\n",
      "m = (p*V)/(R*T); \t\t\t#mass \t\t\t#kg \t\t\t#ideal gas law\n",
      "\n",
      "# Results\n",
      "print \"The mass of gas in the math.tank is %.2f kg\"%(m);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mass of gas in the math.tank is 3.55 kg\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.9  Page No : 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "T2 = 500+460;  \t\t\t#absolute  final temperature  \t\t\t#unit:R\n",
      "T1 = 80+460;  \t\t\t#absolute initial temperature \t\t\t#unit:R\n",
      "#The equation cpbar =  0.338-(1.24*10**2/T)+(4.15*10**4)/T**2 has a form , cbar =  Adash+(Bdash/T)+(Ddash/T**2)\n",
      "#So,\n",
      "Adash = 0.338;      \t\t\t#constant\n",
      "Bdash = -1.24*10**2; \t\t\t#constant\n",
      "Ddash = 4.15*10**4;  \t\t\t#constant\n",
      "\n",
      "# Calculations\n",
      "#Therefore,from equation,cbar = Adash+((Bdash*math.log(T2/T1))/(T2-T1))+(Ddash/(T2*T1))\n",
      "cpbar = Adash+((Bdash*math.log(T2/T1))/(T2-T1))+(Ddash/(T2*T1)); \t\t\t#The mean specific heat \t\t\t#Btu/lbm*R\n",
      "\n",
      "# Results\n",
      "print \"The mean specific heat at constant pressure between 80F and 500F is %.2f Btu/lbm*R\"%(cpbar);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mean specific heat at constant pressure between 80F and 500F is 0.42 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.10  Page No : 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#The table in Appendix 3 does not give us the enthalpy data at 960R and 540R that we need.Interpolating yields\n",
      "#  T    hbar      T    hbar\n",
      "# 537  3729.5    900   6268.1\n",
      "# 540  3750.4    960   6694.0\n",
      "# 600  4167.9    1000  6977.9\n",
      "#So,\n",
      "hbar540 = 3729.5+(3./63)*(4167.9-3729.5); \t\t\t#enthalpy \t\t\t#unit:Btu/lbm\n",
      "hbar960 = 6268.1+(60./100)*(6977.9-6268.1);  \t\t\t#enthalpy \t\t\t#unit:Btu/lbm\n",
      "#Note that hbar is given for a mass of 1 lb mole.To obtain the enthalpy per pound,it is necessary to divide the values og h by the molecular weight,28.\n",
      "h2 = 6694.0;  \t\t\t#enthalpy \t\t\t#unit:Btu/lbm\n",
      "h1 = 3750.4;  \t\t\t#enthalpy \t\t\t#unit:Btu/lbm\n",
      "T2 = 500.+460; \t\t\t#absolute  final temperature \t\t\t#unit:R\n",
      "T1 = 80.+460; \t\t\t#absolute initial temperature \t\t\t#unit:R\n",
      "\n",
      "# Calculations\n",
      "cbar = (h2-h1)/(28*(T2-T1)); \t\t\t#The mean specific heat at constant pressure  \t\t\t#unit:Btu/lbm*R\n",
      "\n",
      "# Results\n",
      "print \"The mean specific heat at constant pressure is %.2f Btu/lbm*R\"%(cbar);\n",
      "#With the more extesive Gas tables,these interpolations are avoided.The Gas Tables provide a relatively easy and accurate method of obtaining average specific heats.Also,these tables have been computerized for ease of application.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mean specific heat at constant pressure is 0.25 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.11  Page No : 253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "T2 = 500+460; \t\t\t#absolute  final temperature  \t\t\t#unit:R\n",
      "T1 = 80+460; \t\t\t#absolute initial temperature  \t\t\t#unit:R\n",
      "#cp = 0.219 + (3.42*10**-5*T) - (2.93*10**-9*T**2); \t\t\t#Unit:Btu/lbm*R\n",
      "#Comparing with c = A+(B*T)+(D*T**2) \n",
      "A = 0.219;        \t\t\t#constant\n",
      "B = 3.42*10**-5;   \t\t\t#constant\n",
      "D = 2.93*10**-9;   \t\t\t#constant\n",
      "\n",
      "# Calculations\n",
      "#Using these values and equation cbar = A+((B/2)(T2+T1))+((D/3)*(T2**2+(T2*T1)+T1**2))\n",
      "cpbar = A+((B/2)*(T2+T1))+((D/3)*(T2**2+(T2*T1)+T1**2)); \t\t\t#The mean specific heat \t\t\t#Btu/lbm*R\n",
      "\n",
      "# Results\n",
      "print \"The mean specific heat at constant pressure for air between 80F and 500F is %.2f Btu/lbm*R\"%(cpbar);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mean specific heat at constant pressure for air between 80F and 500F is 0.25 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.12  Page No : 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#The molecular weight of oxygen is 32.Therefore,\n",
      "R = 1545./32; \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "cp = 0.24; \t\t\t#Unit:Btu/lbm*R \t\t\t#specific heat at constant pressure\n",
      "\n",
      "# Calculations\n",
      "#cp-cv = R/J\n",
      "cv = cp-(R/J); \t\t\t#specific heat at constant volume \t\t\t#unit:Btu/lbm*R\n",
      "\n",
      "# Results\n",
      "print \"Specific heat at constant volume is %.2f Btu/lbm*R\"%(cv);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific heat at constant volume is 0.18 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.13  Page No : 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#From equation,cv = R/(k-1) ,\n",
      "R = 8.314/32; \t\t\t#constant of proportionality \t\t\t#kJ/kg*K \t\t\t#The molecular weight of oxygen is 32\n",
      "k = 1.4 \t\t\t#for oxygen \t\t\t#given \t\t\t#k = cp/cv\n",
      "cv = R/(k-1); \t\t\t#Specific heat at constant volume \t\t\t#unit:kJ/kg*K\n",
      "print \"Specific heat at constant volume is %.2f kJ/kg*K\"%(cv);\n",
      "cp = k*cv; \t\t\t#specific heat at constant pressure \t\t\t#Unit:kJ/kg*K\n",
      "print \"Specific heat at constant pressure is %.2f kJ/kg*K\"%(cp);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific heat at constant volume is 0.65 kJ/kg*K\n",
        "Specific heat at constant pressure is 0.91 kJ/kg*K\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.14  Page No : 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "R = 60.; \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "deltah = 500.; \t\t\t#Btu/lbm \t\t\t#change in enthalpy\n",
      "deltau = 350.; \t\t\t#Btu/lbm \t\t\t#change in internal energy\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "#Because deltah-(cp*deltaT) and deltau = cv*deltaT\n",
      "# deltah/deltau = (cp*deltaT)/(cv*deltaT) = cp/cv = k\n",
      "k = deltah/deltau; \t\t\t#Ratio of specific heats\n",
      "print \"Ratio of specific heats k is %.2f\"%(k);\n",
      "#From equation cv = R/(J*(k-1))\n",
      "cv = R/(J*(k-1)); \t\t\t#specific heat at constant volume \t\t\t#Btu/lbm*R\n",
      "print \"Specific heat at constant volume is %.2f Btu/lbm*R\"%(cv);\n",
      "cp = k*cv; \t\t\t#Specific heat at constant pressure \t\t\t#Btu/lbm*R\n",
      "print \"Specific heat at constant pressure is %.2f Btu/lbm*R\"%(cp);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of specific heats k is 1.43\n",
        "Specific heat at constant volume is 0.18 Btu/lbm*R\n",
        "Specific heat at constant pressure is 0.26 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.15  Page No : 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#When solving this type of problem,it is necessary to note carefully the information given and to write the correct energy equation for this process.Because the    process is carried out at constant volume,the heat added equals the change in inernal energy.Because the change in internal energy per pound for the ideal gas is      cv*(T2-T1),the total change in internal energy for m pounds must equals the heat added.Thus,\n",
      "#data given\n",
      "Q = 0.33; \t\t\t#heat\n",
      "#Initial conditions\n",
      "V = 60; \t\t\t#in**3 \t\t\t#volume\n",
      "m = 0.0116; \t\t\t#lbs \t\t\t#mass\n",
      "p1 = 90; \t\t\t#psia \t\t\t#pressure\n",
      "T1 = 460+40; \t\t\t#Fahrenheit temperature converted to absolute temperature\n",
      "#Final condition = Initial condition + heat\n",
      "V = 60; \t\t\t#in**3 \t\t\t#volume\n",
      "m = 0.0116; \t\t\t#lbs \t\t\t#mass\n",
      "p2 = 108; \t\t\t#psia \t\t\t#pressure \n",
      "T2 = 460+140; \t\t\t#Fahrenheit temperature converted to absolute temperature \t\t\t#unit:R\n",
      "#Q = m*(u2-u1) = m*cv*(T2-T1)\n",
      "\n",
      "# Calculations and Results\n",
      "cv = Q/(m*(T2-T1)); \t\t\t#specific heat at constant volume \t\t\t#Btu/lbm*R\n",
      "print \"Specific heat at constant volume is %.2f Btu/lbm*R\"%(cv);\n",
      "#To obtain cp,it is first necessary to obtain R.Enough information was given in the initial conditions of the problem to apply eqn. p*V = m*R*T\n",
      "R = (144*p1*(V/1728.))/(m*T1); \t\t\t#1 ft**2 = 144 in**2 \t\t\t#1 ft**3 = 1728 in**3 \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "print \"Consmath.tant of proportionality R is %.2f ft*lbf/lbm*R\"%(R);\n",
      "#cp-cv = (R/J)\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "cp = cv+(R/J); \t\t\t#Specific heat at constant pressure \t\t\t#Btu/lbm*R\n",
      "print \"Specific heat at constant pressure is %.2f Btu/lbm*R\"%(cp);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific heat at constant volume is 0.28 Btu/lbm*R\n",
        "Consmath.tant of proportionality R is 77.59 ft*lbf/lbm*R\n",
        "Specific heat at constant pressure is 0.38 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.16  Page No : 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#data\n",
      "cp = 0.24; \t\t\t#Specific heat at constant pressure \t\t\t#Btu/lbm*R\n",
      "p2 = 15.; \t\t\t#psia \t\t\t#final pressure\n",
      "p1 = 100.; \t\t\t#psia \t\t\t#initial pressure\n",
      "T2 = 460.+0;  \t\t\t#absolute  final temperature \t\t\t#unit:R\n",
      "T1 = 460.+100; \t\t\t#absolute initial temperature  \t\t\t#unit:R\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "R = 1545./29; \t\t\t#moleculer weight = 29 \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "\n",
      "# Calculations\n",
      "#On the basis of the data given,\n",
      "deltas = (cp*(math.log(T2/T1)))-((R/J)*(math.log(p2/p1))); \t\t\t#change in entropy \t\t\t#Btu/lbm*R\n",
      "\n",
      "# Results\n",
      "print \"The change in enthalpy is %.2f Btu/lbm*R\"%(deltas);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in enthalpy is 0.08 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.17  Page No : 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#data of problem6.16\n",
      "cp = 0.24; \t\t\t#Specific heat at constant pressure \t\t\t#Btu/lbm*R\n",
      "p2 = 15.; \t\t\t#psia \t\t\t#final pressure\n",
      "p1 = 100.; \t\t\t#psia \t\t\t#initial pressure\n",
      "T2 = 460.+0;  \t\t\t#absolute  final temperature \t\t\t#unit:R\n",
      "T1 = 460.+100; \t\t\t#absolute initial temperature \t\t\t#unit:R\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "R = 1545./29; \t\t\t#moleculer weight = 29 \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "#Because cp and R are given,let us first solve for cv,\n",
      "#cp = (R*k)/(J*(k-1))\n",
      "k = (cp*J)/((cp*J)-R); \t\t\t#k = cp/cv \t\t\t#ratio of specific heats\n",
      "print \"Ratio of specific heats k is %.2f\"%(k);\n",
      "#k = cp/cv\n",
      "cv = cp/k; \t\t\t#Specific heat at constant volume \t\t\t#Btu/lbm*R\n",
      "print \"Specific heat at constant volume is %.2f Btu/lbm*R\"%(cv);\n",
      "#Now, deltas = (cv*math.log(p2/p1))+(cp*math.log(v2/v1));\n",
      "#But, v2/v1 = (T2*p1)/(T1*p2)\n",
      "v2byv1 = (T2*p1)/(T1*p2); \t\t\t# v2/v1 \t\t\t#unitless\n",
      "deltas = (cv*math.log(p2/p1))+(cp*math.log(v2byv1)); \t\t\t#The change in enthalpy  \t\t\t#unit:Btu/lbm*R\n",
      "print \"The change in enthalpy is %.2f Btu/lbm*R\"%(deltas);\n",
      "#The agreement is very good.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of specific heats k is 1.40\n",
        "Specific heat at constant volume is 0.17 Btu/lbm*R\n",
        "The change in enthalpy is 0.08 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.18  Page No : 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#data,\n",
      "cp = 0.9093; \t\t\t#Specific heat at constant pressure \t\t\t#kJ/kg*R\n",
      "p2 = 150.; \t\t\t#kPa \t\t\t#final pressure\n",
      "p1 = 500.; \t\t\t#kPa \t\t\t#initial pressure\n",
      "T2 = 273.+0;  \t\t\t#final temperature \t\t\t#Celsius converted to kelvin\n",
      "T1 = 273.+100; \t\t\t#initial temperature \t\t\t#Celsius converted to kelvin\n",
      "#J = 778; \t\t\t#conversion factor\n",
      "R = 8.314/32; \t\t\t#moleculer weight of oxygen = 32 \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "\n",
      "# Calculations\n",
      "#Using equation, and dropping J gives,\n",
      "deltas = (cp*(math.log(T2/T1)))-((R)*(math.log(p2/p1))); \t\t\t#change in entropy \t\t\t#kJ/kg*K\n",
      "#For 2 kg,\n",
      "deltaS = 2*deltas; \t\t\t#The change in enthalpy in kJ/K\n",
      "\n",
      "# Results\n",
      "print \"For 2 kg oxygen, The change in enthalpy is %.2f kJ/K\"%(deltaS);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For 2 kg oxygen, The change in enthalpy is 0.06 kJ/K\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.19  Page No : 262"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#from the equation, deltas/cv  =  (k*math.log(v2/v1))+ math.log(p2/p1) \t\t\t#change in entropy\n",
      "k = 1.4; \t\t\t#k = cp/cv \t\t\t#ratio of specific heats\n",
      "#deltas = (1/4)*cv \t\t\t#so, \n",
      "# 1/4 =  (k*math.log(v2/v1))+ math.log(p2/p1)\n",
      "v2 = 1./2; \t\t\t#Because,v2 = (1/2)*v1  \t\t\t#initial specific volume \n",
      "v1 = 1.;   \t\t\t#final specific volume\n",
      "\n",
      "# Calculations\n",
      "p2byp1 = math.exp((1./4)-(k*math.log(v2/v1))); \t\t\t#increase in pressure\n",
      "\n",
      "# Results\n",
      "print \"p2/p1 = %.2f\"%(p2byp1);\n",
      "print \"So, increase in pressure is %.2f \"%(p2byp1);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "p2/p1 = 3.39\n",
        "So, increase in pressure is 3.39 \n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.20  Page No : 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data\n",
      "T2 = 460+270; \t\t\t#Fahrenheit temperature converted to absolute final temperature \t\t\t#unit:R\n",
      "T1 = 460+70; \t\t\t#Fahrenheit temperature converted to absolute initial temperature \t\t\t#unit:R\n",
      "cv = 0.17; \t\t\t#specific heat at constant volume \t\t\t#Btu/lbm*R\n",
      "\n",
      "# Calculations\n",
      "#Now,\n",
      "deltas = cv*math.log(T2/T1); \t\t\t#change in entropy \t\t\t#Unit:Btu/lbm*R\n",
      "#For 1/2 lb,\n",
      "deltaS = (1./2)*deltas; \t\t\t#The change in enthalpy in Btu/R\n",
      "\n",
      "# Results\n",
      "print \"For 1/2 lb of gas, The change in enthalpy is %.2f Btu/R\"%(deltaS);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For 1/2 lb of gas, The change in enthalpy is 0.00 Btu/R\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.21  Page No : 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data\n",
      "T2 = 100.+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#final temperature\n",
      "T1 = 20+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#initial temperature\n",
      "cv = 0.7186; \t\t\t#specific heat at constant volume \t\t\t#kJ/kg*K\n",
      "#Now,\n",
      "deltas = cv*math.log(T2/T1); \t\t\t#change in entropy \t\t\t#Unit:kJ/kg*K\n",
      "#For 0.2 kg,\n",
      "deltaS = (0.2)*deltas; \t\t\t#The change in enthalpy in kJ/K\n",
      "print \"For 0.2 kg of air, The change in enthalpy is %.2f kJ/K\"%(deltaS);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For 0.2 kg of air, The change in enthalpy is 0.03 kJ/K\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.22  Page No : 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data\n",
      "deltas = 0.0743; \t\t\t#change in entropy \t\t\t#Unit:Btu/lbm*R\n",
      "T1 = 460+100; \t\t\t#Fahrenheit temperature converted to absolute initial temperature\n",
      "cv = 0.219; \t\t\t#specific heat at constant volume \t\t\t#Btu/lbm*R\n",
      "#Now,\n",
      "\n",
      "# Calculations\n",
      "#deltas = cv*math.log(T2/T1); \n",
      "T2 = T1*math.exp(deltas/cv); \t\t\t#higher temperature \t\t\t#absolute temperature  \t\t\t#unit:R\n",
      "\n",
      "# Results\n",
      "print \"The higher temperature is %.2f R\"%(T2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The higher temperature is 786.20 R\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.23  Page No : 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data\n",
      "deltaS = 0.4386; \t\t\t#change in entropy \t\t\t#Unit:kJ/K\n",
      "T2 = 273+425; \t\t\t#Celsius temperature converted to kelvin \t\t\t#initial temperature\n",
      "cv = 0.8216; \t\t\t#specific heat at constant volume \t\t\t#kJ/kg*K\n",
      "m = 1.5; \t\t\t#mass \t\t\t#kg\n",
      "#Now,\n",
      "\n",
      "# Calculations\n",
      "#deltas = m*cv*math.log(T2/T1); \n",
      "T1 = T2/(math.exp(deltaS/(m*cv))) \t\t\t#initial temperature \t\t\t#unit:K\n",
      "\n",
      "# Results\n",
      "print \"The initial temperature of the process is %.2f K or %.2f C\"%(T1,T1-273)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The initial temperature of the process is 488.98 K or 215.98 C\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.24  Page No : 267"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given\n",
      "T2 = 460.+400; \t\t\t#Fahrenheit temperature converted to absolute final temperature \t\t\t#unit:R\n",
      "T1 = 460.+70; \t\t\t#Fahrenheit temperature converted to absolute initial temperature \t\t\t#unit:R\n",
      "cp = 0.24; \t\t\t#specific heat at constant pressure \t\t\t#Btu/lbm*R\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "R = 1545./29; \t\t\t#moleculer weight = 29 \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "#From the energy equation for the constant-pressure process,the heat transferred is deltah.Therefore,\n",
      "#q = deltah = cp*(T2-T1)\n",
      "deltah = cp*(T2-T1); \t\t\t#heat transferred \t\t\t#Btu/lb \t\t\t#into system\n",
      "print \"The heat transferred is %.2f Btu/lbinto system)\"%(deltah);\n",
      "deltas = cp*math.log(T2/T1); \t\t\t#increase in entropy \t\t\t#Btu/lbm*R\n",
      "print \"The increase in entropy is %.2f Btu/lbm*R\"%(deltas);\n",
      "#The flow work change is (p2*v2)/J - (p1*v1)/J  =  (R/J)*(T2-T1)\n",
      "flowworkchange = (R/J)*(T2-T1); \t\t\t#Btu/lbm \t\t\t#The flow work change per pound of air\n",
      "print \"The flow work change per pound of air is %.2f Btu/lbm\"%(flowworkchange);\n",
      "#In addition to each of the assumptions made in all the process being considered,it has further been tacitly assumed that these processes are carried out quasi-      statically and without friction.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat transferred is 79.20 Btu/lbinto system)\n",
        "The increase in entropy is 0.12 Btu/lbm*R\n",
        "The flow work change per pound of air is 22.60 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.25  Page No : 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given\n",
      "T2 = 500.+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#final temperature\n",
      "T1 = 20+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#initial temperature\n",
      "cp = 1.0062; \t\t\t#specific heat at constant pressure \t\t\t#kJ/kg*K\n",
      "#From the energy equation for the constant-pressure process,the heat transferred is deltah.Therefore,\n",
      "#q = deltah = cp*(T2-T1)\n",
      "deltah = cp*(T2-T1); \t\t\t#heat transferred \t\t\t#kJ/kg \t\t\t#into system\n",
      "print \"The heat transferred is per kimath.logram of air %.2f kJ/kg\"%(deltah);\n",
      "deltas = cp*math.log(T2/T1); \t\t\t#increase in entropy \t\t\t#kJ/kg*K\n",
      "print \"The increase in entropy per kimath.logram of air is %.2f kJ/kg*K\"%(deltas);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat transferred is per kimath.logram of air 482.98 kJ/kg\n",
        "The increase in entropy per kimath.logram of air is 0.98 kJ/kg*K\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.26  Page No : 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given\n",
      "v2 = 2.; \t\t\t#Because,v2 = (2)*v1 \t\t\t#volume increases to its twice its final volume\n",
      "v1 = 1.; \t\t\t#initial volume\n",
      "T = 460.+200; \t\t\t#Fahrenheit temperature converted to absolute temperature\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "R = 1545./28; \t\t\t#moleculer weight of nitrogen = 28 \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "#From the equation, w/J = q = T*deltas = ((R*T)/J)*math.log(v2/v1)\n",
      "q = ((R*T)/J)*math.log(v2/v1); \t\t\t#Btu/lbm \t\t\t#the heat added to system\n",
      "#For 0.1 lb,\n",
      "Q = 0.1*q; \t\t\t#Btu \t\t\t#the heat added to system\n",
      "print \"The heat added to system is %.2f Btu\"%(Q);\n",
      "#The work out of the system is equal to the heat added;thus,\n",
      "WbyJ = Q; \t\t\t#The work out of the system(out of the system) \t\t\t#unit:Btu\n",
      "print \"The work out of the system is %.2f Btuout of the system)\"%(WbyJ);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat added to system is 3.24 Btu\n",
        "The work out of the system is 3.24 Btuout of the system)\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.27  Page No : 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given\n",
      "T = 50+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#final temperature \t\t\t#unit:K\n",
      "v2 = 1./2; \t\t\t#Because,v2 = (1/2)*v1 \t\t\t#volume increases to its half its final volume\n",
      "v1 = 1.;\n",
      "R = 8.314/32; \t\t\t#moleculer weight of oxygen = 32 \t\t\t#Unit:kJ/kg*K \t\t\t#constant of proportionality\n",
      "#From the equation, q = ((R*T))*math.log(v2/v1)\n",
      "q = R*T*math.log(v2/v1); \t\t\t#heat added \t\t\t#kJ/kg\n",
      "print \"The heat added to system is %.2f kJ/kgheat out of system)\"%(q);\n",
      "#The work out of the system is equal to the heat added;thus,\n",
      "W = q; \t\t\t#The work out of the system  \t\t\t#unit:kJ/kg\n",
      "print \"The work out of the system is %.2f kJ/kginto system)\"%(W);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat added to system is -58.17 kJ/kgheat out of system)\n",
        "The work out of the system is -58.17 kJ/kginto system)\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.28  Page No : 271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given in problem 6.27\n",
      "T = 50+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#final temperature\n",
      "v2 = 1./2; \t\t\t#Because,v2 = (1/2)*v1 \t\t\t#volume increases to its half its final volume\n",
      "v1 = 1;\n",
      "R = 8.314/32; \t\t\t#moleculer weight of oxygen = 32 \t\t\t#Unit:kJ/kg*K \t\t\t#constant of proportionality\n",
      "#From the equation, q = ((R*T))*math.log(v2/v1)\n",
      "q = R*T*math.log(v2/v1); \t\t\t#heat added \t\t\t#kJ/kg\n",
      "print \"The heat added to system is %.2f kJ/kgheat out of system)\"%(q);\n",
      "#For a constant temperature,\n",
      "deltas = q/T; \t\t\t#Change in entropy \t\t\t#unit:kJ/kg*K\n",
      "print \"The change in entropy is %.2f kJ/kg*K\"%(deltas);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat added to system is -58.17 kJ/kgheat out of system)\n",
        "The change in entropy is -0.18 kJ/kg*K\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.29  Page No : 274"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given\n",
      "T1 = 1000; \t\t\t#absolute initial temperature \t\t\t#unit:R\n",
      "p2 = 1.; \t\t\t#unit:atm \t\t\t#absolute final pressure\n",
      "p1 = 5.; \t\t\t#unit:atm \t\t\t#absolute initial pressure\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "R = 1545./29; \t\t\t#moleculer weight = 29 \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "k = 1.4; \t\t\t#k = cp/cv \t\t\t#ratio of specific heats\n",
      "\n",
      "# Calculations and Results\n",
      "#From the equation, \n",
      "T2 = T1*((p2/p1)**((k-1)/k)); \t\t\t#Unit:R \t\t\t#The absolute final temperature\n",
      "print \"The absolute final temperature is %.2f R\"%(T2);\n",
      "work = (R*(T2-T1))/(J*(1-k)); \t\t\t#Btu/lbm \t\t\t#The work done by air(out)\n",
      "print \"The work done by air is %.2f Btu/lbmout)\"%(work)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute final temperature is 631.39 R\n",
        "The work done by air is 63.11 Btu/lbmout)\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.30  Page No : 274"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#data given\n",
      "#mass of 1 kg\n",
      "T1 = 500+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#final temperature\n",
      "p2 = 1.; \t\t\t#atm \t\t\t#absolute final pressure\n",
      "p1 = 5.; \t\t\t#atm \t\t\t#absolute initial pressure\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "R = 8.314/29; \t\t\t#moleculer weight = 29 \t\t\t#Unit:kJ/kg*K \t\t\t#constant of proportionality\n",
      "k = 1.4; \t\t\t#k = cp/cv \t\t\t#ratio of specific heat\n",
      "#From the equation, \n",
      "T2 = T1*((p2/p1)**((k-1)/k)); \t\t\t#Unit:Kelvin \t\t\t#The absolute final temperature\n",
      "print \"The absolute final temperature is %.2f K or %.2f C\"%(T2,T2-273);\n",
      "work = (R*(T2-T1))/((1-k)); \t\t\t#kJ/kg \t\t\t#The work done by air(out)\n",
      "print \"The work done by air is %.2f kJ/kgout)\"%(work)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute final temperature is 488.06 K or 215.06 C\n",
        "The work done by air is 204.22 kJ/kgout)\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.31  Page No : 275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy.linalg import inv\n",
      "import math\n",
      "\n",
      "#data given\n",
      "T1 = 800.+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#initial temperature\n",
      "T2 = 500.+273; \t\t\t#Celsius temperature converted to Kelvin \t\t\t#final temperature\n",
      "p2 = 1.; \t\t\t#atm \t\t\t#absolute final pressure\n",
      "p1 = 5.; \t\t\t#atm \t\t\t#absolute initial pressure\n",
      "\n",
      "# Calculations\n",
      "#A gas expands isentropically\n",
      "#From the equation,\n",
      "#T2/T1 = ((p2/p1)**((k-1)/k));\n",
      "#rearranging,\n",
      "k = inv([[1-((math.log(T2/T1)/math.log(p2/p1)))]]); \t\t\t#k = cp/cv \t\t\t#Ratio of specific heats\n",
      "\n",
      "# Results\n",
      "print \"Ratio of specific heats k) is %.2f\"%(k);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of specific heats k) is 1.26\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.32  Page No : 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given\n",
      "n = 1.3; \t\t\t#p*v**1.3 = constant\n",
      "k = 1.4; \t\t\t#k = cp/cv Ratio of specific heats \n",
      "cp = 0.24; \t\t\t#specific heat at constant pressure \t\t\t#Btu/lbm*R\n",
      "T2 = 600.; \t\t\t#absolute final temperature \t\t\t#unit:R\n",
      "T1 = 1500.; \t\t\t#absolute initial temperature \t\t\t#unit:R\n",
      "R = 53.3; \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "cv = cp/k; \t\t\t#specific heat at constant volume \t\t\t#Btu/lbm*R\n",
      "#Therefore,\n",
      "cn = cv*((k-n)/(1-n)); \t\t\t#Polytropic specific heat \t\t\t#Btu/lbm*R\n",
      "print \"Polytropic specific heatcn, is %.2f Btu/lbm*R\"%(cn);\n",
      "#The negative sign of cn indicates that either the heat transfer for the process comes from the system or there is a negative temperature change while heat is        transferred to the system.\n",
      "#The heat transferred is cn*(T2-T1).Therefore,\n",
      "q = cn*(T2-T1); \t\t\t#heat transferred \t\t\t#Btu/lbm(to the system)\n",
      "print \"The heat transferred is %.2f Btu/lbmto the system\"%(q);\n",
      "#The work done can be found Using equation,\n",
      "w = (R*(T2-T1))/(J*(1-n)); \t\t\t#Btu/lbm \t\t\t#the workdone(from the system)\n",
      "print \"The work done is %.2f Btu/lbmfrom the system\"%(w);\n",
      "deltas = cn*math.log(T2/T1) \t\t\t#change in entropy \t\t\t#Btu/lbm*R\n",
      "print \"The change in enthalpy is %.2f Btu/lbm*R\"%(deltas);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Polytropic specific heatcn, is -0.06 Btu/lbm*R\n",
        "The heat transferred is 51.43 Btu/lbmto the system\n",
        "The work done is 205.53 Btu/lbmfrom the system\n",
        "The change in enthalpy is 0.05 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.33  Page No : 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given in problem 6.32,\n",
      "n = 1.3; \t\t\t#p*v**1.3 = constant\n",
      "k = 1.4; \t\t\t#k = cp/cv \t\t\t#ratio of specific heats\n",
      "cp = 0.24; \t\t\t#specific heat at constant pressure \t\t\t#Btu/lbm*R\n",
      "T2 = 600.; \t\t\t#absolute final temperature \t\t\t#unit:R\n",
      "T1 = 1500.; \t\t\t#absolute initial temperature \t\t\t#unir:R\n",
      "R = 53.3; \t\t\t#Unit:ft*lbf/lbm*R \t\t\t#constant of proportionality\n",
      "J = 778.; \t\t\t#conversion factor\n",
      "#Equation,\n",
      "# T1/T2 = ((p1/p2)**((n-1)/n));\n",
      "#rearranging,\n",
      "p1byp2 = math.exp(math.log(T1/T2)/((n-1)/n)); \t\t\t#The ratio of inlet to outlet pressure\n",
      "print \"The ratio of inlet to outlet pressure is %.2f\"%(p1byp2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ratio of inlet to outlet pressure is 53.02\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.34  Page No : 284"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#From the table at 1000 R:                     \t\t\t#From the table at 500 R:\n",
      "h2 = 240.98;                                       \n",
      "h1 = 119.48; \n",
      "#Btu/lbm \t\t\t#enthalpy                             \t\t\t#Btu/lbm \t\t\t#enthalpy\n",
      "u2 = 172.43;                                       \n",
      "u1 = 85.20; \n",
      "#Btu/lbm \t\t\t#internal energy                      \t\t\t#Btu/lbm \t\t\t#internal energy \n",
      "fy2 = 0.75042;                                     \n",
      "fy1 = 0.58233; \n",
      "#Btu/lbm*R                                      \t\t\t#Btu/lbm*R\n",
      "\n",
      "#The change in enthalpy is\n",
      "deltah = h2-h1; \t\t\t#Btu/lbm\n",
      "#The change in internal energy is\n",
      "deltau = u2-u1; \t\t\t#Btu/lbm\n",
      "print \"The change in enthalpy is %.2f Btu/lbm & the change in internal energy is %.2f Btu/lbm\"%(deltah,deltau);\n",
      "#Because in the constant-pressure process -R*math.log(p2/p1) is zero,\n",
      "deltas = fy2-fy1; \t\t\t#Btu/lbm*R \t\t\t#The entropy when air is heated at constant pressure\n",
      "print \"The entropy when air is heated at constant pressure is %.2f Btu/lbm/R\"%(deltas);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in enthalpy is 121.50 Btu/lbm & the change in internal energy is 87.23 Btu/lbm\n",
        "The entropy when air is heated at constant pressure is 0.17 Btu/lbm/R\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.35  Page No : 285"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#In this problem,the air expands from 5 atm absolute to 1 atm absolute from an initial temperature of 1000R,\n",
      "pr = 12.298; \t\t\t#relative pressure \t\t\t#unit:atm \n",
      "h = 240.98; \t\t\t#Btu/lbm \t\t\t#enthalpy \n",
      "pr = 12.298/5; \t\t\t#The value of the final relative pressure \t\t\t#unit:atm\n",
      "#Interpolation in the air table yields the following:\n",
      "#   T     pr\n",
      "#  620   2.249\n",
      "#        2.4596\n",
      "#  640   2.514\n",
      "T = 620+(((2.4596-2.249)/(2.514-2.249))*20); \t\t\t#the final temperature \t\t\t#unit:R\n",
      "print \"The absolute final temperature is %.2f R\"%(T);\n",
      "u1 = 172.43; \t\t\t#initial internal energy \t\t\t#Btu/lbm\n",
      "u2 = 108.51; \t\t\t#final internal energy \t\t\t#Btu/lbm\n",
      "work = u1-u2; \t\t\t#Btu/lbm The work done by air in an isentropic nonflow expansion \t\t\t#where the value of u2 is obtained by interpolation at T  temperature and the value of u1 is read from the air table at 1000 R. \n",
      "print \"The work done by air in an isentropic nonflow expansion is %.2f Btu/lbmout)\"%(work)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute final temperature is 635.89 R\n",
        "The work done by air in an isentropic nonflow expansion is 63.92 Btu/lbmout)\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.36  Page No : 288"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# given data\n",
      "T = 1000+460; \t\t\t#Fahrenheit temperature converted to absolute temperature\n",
      "#The velocity of sound in air at 1000 F is\n",
      "Va = 49.0*math.sqrt(T); \t\t\t#velocity \t\t\t#ft/s\n",
      "print \"The velocity of sound air at 1000 F is %.2f ft/s\"%(Va);\n",
      "#Hydrogen has a specific heat ratio of 1.41 and R = 766.53.Therefore,\n",
      "khydrogen = 1.41; \t\t\t#specific heats ratio for air\n",
      "kair = 1.40; \t\t\t#specific heats ratio for air\n",
      "Rhydrogen = 766.53; \t\t\t#gas constant \t\t\t#ft*lbf/lbm*R\n",
      "Rair = 53.36; \t\t\t#gas constant \t\t\t#ft*lbf/lbm*R\n",
      "# Vahydrogen/Vaair  =  math.sqrt((Rhydrogen*khydrogen)/(Rair*kair))\n",
      "#rearranging,\n",
      "Vahydrogen = Va*math.sqrt((Rhydrogen*khydrogen)/(Rair*kair)); \t\t\t#The velocity of sound in hydrogen at 1000 F \t\t\t#unit:ft/s\n",
      "print \"The velocity of sound in hydrogen at 1000 F is %.2f ft/s\"%(Vahydrogen);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of sound air at 1000 F is 1872.29 ft/s\n",
        "The velocity of sound in hydrogen at 1000 F is 7121.55 ft/s\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.37  Page No : 288"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# given data\n",
      "T = 200+460.; \t\t\t#Fahrenheit temperature converted to absolute temperature \t\t\t#unit:R\n",
      "V = 1500; \t\t\t#ft/s \t\t\t#the local velocity\n",
      "Va = 49.0*math.sqrt(T); \t\t\t#velocity of sound air at 200 F  \t\t\t#unit:ft/s\n",
      "print \"The velocity of sound air at 200 F is %.2f ft/s\"%(Va);\n",
      "M = V/Va; \t\t\t#The Mach number = the local velocity/velocity of sound \t\t\t#unitless\n",
      "print \"The Mach number is %.2f\"%(M);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of sound air at 200 F is 1258.83 ft/s\n",
        "The Mach number is 1.19\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.38  Page No : 290"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#data given\n",
      "V = 1000; \t\t\t#ft/s \t\t\t#the fluid velocity\n",
      "gc = 32.17; \t\t\t#Unit:(LBm*ft)/(LBf*s**2) \t\t\t#gc is constant of proportionality\n",
      "J = 778; \t\t\t#conversion factor\n",
      "h = 1204.4; \t\t\t#Btu/lbm \t\t\t#enthalpy of saturated steam\n",
      "#h0-h = V**2/(2*gc*J) \n",
      "h0 = h+((V**2)/(2*gc*J));  \t\t\t#Btu/lbm \t\t\t#h0 = stagnation enthalpy\n",
      "print \"The total enthalpy is %.2f Btu/lbm\"%(h0);\n",
      "#It will be noted for this problem that if the initial velocity had been 100ft/s,deltah would have been 0.2 Btu/lbm,and for most practical purpposes,the total      properties and those of the flowing fluid would have been essentially the same.Thus,for low-velocity fluids,the difference in total and steam properties can be      neglected.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total enthalpy is 1224.38 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.39  Page No : 297"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from numpy.linalg import inv\n",
      "\n",
      "# given data\n",
      "k = 1.4; \t\t\t#the specific heats ratio \t\t\t#k = cp/cv\n",
      "M = 1; \t\t\t#(table 6.5) \t\t\t#The Mach number = the local velocity/velocity of sound\n",
      "T0 = 800; \t\t\t#absolute temperature \t\t\t#unit:R\n",
      "gc = 32.17; \t\t\t#Unit:(LBm*ft)/(LBf*s**2) \t\t\t#gc is constant of proportionality\n",
      "R = 53.35; \t\t\t#gas constant \t\t\t#ft*lbf/lbm*R\n",
      "p0 = 300; \t\t\t#psia \t\t\t#pressure\n",
      "\n",
      "# * or \"star\" subscripts to conditions in which M = 1;\n",
      "# \"0\" subscript refers to isentropic stagnation\n",
      "#Refer to figure 6.26,\n",
      "#Tstar/T0 = 0.8333\n",
      "Tstar = T0*0.8333; \t\t\t#temperature when M = 1 \t\t\t#unit:R\n",
      "print \"If the mach number at the outlet is unity, temperature is %.2f R\"%(Tstar);\n",
      "Vat = math.sqrt(gc*R*Tstar*k); \t\t\t#ft/s \t\t\t#Vat = V2 \t\t\t#local velocity of sound\n",
      "print \"If the mach number at the outlet is unity, velocity is %.2f ft/s\"%(Vat)\n",
      "\n",
      "#For A/Astar = 2.035\n",
      "#The table yields\n",
      "M1 = 0.3; \t\t\t#mach number at inlet\n",
      "print \"At inlet, The mach number is %.2f\"%(M1)\n",
      "#pstar/p0 = 0.52828\n",
      "pstar = p0*0.52828;  \t\t\t#pressure when M = 1 \t\t\t#psia\n",
      "#also,\n",
      "#T1/T0 = 0.98232 and p1/p0 = 0.93947\n",
      "#Therefore,\n",
      "T1 = T0*0.982332; \t\t\t#unit:R \t\t\t#T1 = temperature at inlet\n",
      "print \"At inlet, The temperature is %.2f R\"%(T1);\n",
      "p1 = p0*0.93947; \t\t\t#psia \t\t\t#p1 = pressure at inlet\n",
      "print \"At inlet, The pressure is %.2f psia\"%(p1);\n",
      "#From the inlet conditions derived,\n",
      "Va1 = math.sqrt(gc*k*R*T1); \t\t\t#ft/s \t\t\t#V1 = velocity at inlet\n",
      "V1 = M1*Va1; \t\t\t#ft/s \t\t\t#velocity\n",
      "print \"At inlet, The velocity is %.2f ft/s\"%(V1);\n",
      "#The specific volume at inlet is found from the equation of state for an ideal gas:\n",
      "v = (R*T1)/(p1*144); \t\t\t#ft**3/lbm \t\t\t#1 ft**2 = 144 in**2(for conversion of unit) \t\t\t#specific volume\n",
      "rho = inv([[v]]); \t\t\t#inverse of specific volume \t\t\t#density\n",
      "A = 2.035; \t\t\t#area \t\t\t#ft**2\n",
      "m = rho*A*V1; \t\t\t#mass flow \t\t\t#unit:lbm/s\n",
      "print \"At inlet, The mass flow is %.2f lbm/s\"%(m);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "If the mach number at the outlet is unity, temperature is 666.64 R\n",
        "If the mach number at the outlet is unity, velocity is 1265.62 ft/s\n",
        "At inlet, The mach number is 0.30\n",
        "At inlet, The temperature is 785.87 R\n",
        "At inlet, The pressure is 281.84 psia\n",
        "At inlet, The velocity is 412.24 ft/s\n",
        "At inlet, The mass flow is 812.08 lbm/s\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.40  Page No : 299"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# * or \"star\" subscripts to conditions in which M = 1;\n",
      "# \"0\" subscript refers to isentropic stagnation\n",
      "#This problem will be solved by two methods(A and B)\n",
      "print \"Method A\"; \t\t\t#By equations:\n",
      "k = 1.4; \t\t\t#the specific heat ratio \t\t\t#k = cp/cv\n",
      "R = 53.3; \t\t\t#gas constant \t\t\t#ft*lbf/lbm*R\n",
      "M = 2.5; \t\t\t#mach number = the local velocity/velocity of sound\n",
      "print \"Solution for a\";\n",
      "# T/Tstar  =  (k+1)/(2*(1+((1/2)*(k-1)*M**2)))\n",
      "# Tstar/T0 = 2/(k+1)\n",
      "#Therefore,\n",
      "# (Tstar/T0)*(T/Tstar)  =  (T/T0) = 1/(1+((1/2)*(k-1)*M**2))\n",
      "T0 = 560; \t\t\t#absolute temperature or stagnation temperature \t\t\t#unit:R\n",
      "T = T0/(1+((1/2)*(k-1)*M**2)); \t\t\t#temperature at M = 2.5\n",
      "print \"The temperature is %.2f R\"%(T);\n",
      "print \"Solution for b\";\n",
      "p = 0.5; \t\t\t#static pressure \t\t\t#unit:psia\n",
      "# p0/p  =  (T0/T)**(k/(k-1))\n",
      "p0 = p*14.7*((T0/T)**(k/(k-1))); \t\t\t#pressure at M = 2.5 \t\t\t#unit:psia\n",
      "print \"The pressure is %.2f psia\"%(p0);\n",
      "print \"Solution for c\";\n",
      "gc = 32.17; \t\t\t#Unit:(LBm*ft)/(LBf*s**2) \t\t\t#gc is constant of proportionality\n",
      "Va = math.sqrt(gc*k*R*T); \t\t\t#ft/s \t\t\t#local velocity of sound\n",
      "V = M*Va; \t\t\t#valocity at M = 2.5 \t\t\t#unit:ft/s\n",
      "print \"The velocity is %.2f ft/s\"%(V);\n",
      "print \"Solution for d\";\n",
      "v = (R*T)/(p*14.7*144); \t\t\t#ft**3/lbm \t\t\t#1 ft**2 = 144 in**2 \t\t\t#specific volume at M = 2.5\n",
      "print \"The specific volume is %.2f ft**3/lbm\"%(v);\n",
      "print \"Solution for e\";\n",
      "#Mass velocity is definrd as the mass flow per unit area\n",
      "# m/A = (A*V)/(v*A) = V/v\n",
      "print \"The mass velocity is %.2f lbm/s*ft**2)\"%(V/v); \t\t\t#mass velocity at M = 2.5\n",
      "\n",
      "\n",
      "print \"Method B\"; \t\t\t#By the gas tables: \t\t\t#table 6.5 gives\n",
      "M = 2.5; \t\t\t#mach number = the local velocity/velocity of sound\n",
      "print \"Solution for a\";\n",
      "T0 = 560; \t\t\t#absolute temperature or stagnation temperature\n",
      "#T/T0 = 0.44444\n",
      "T = T0*0.44444; \t\t\t#temperature at M = 2.5\n",
      "print \"The temperature is %.2f R\"%(T)\n",
      "print \"Solution for b\";\n",
      "p = 0.5; \t\t\t#static pressure\n",
      "#p/p0 = 0.05853\n",
      "p0 = (p*14.7)/0.05853; \t\t\t#pressure at M = 2.5\n",
      "print \"The pressure is %.2f psia\"%(p0);\n",
      "print \"Solution for c\";\n",
      "print \"As before %.2f ft/s\"%(V)\n",
      "print \"Solution for d\";\n",
      "print \"As before %.2f ft**3/lbm\"%(v)\n",
      "print \"Solution for e\";\n",
      "print \"As before %.2f lbm/s*ft**1)\"%(V/v)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Method A\n",
        "Solution for a\n",
        "The temperature is 560.00 R\n",
        "Solution for b\n",
        "The pressure is 7.35 psia\n",
        "Solution for c\n",
        "The velocity is 2898.59 ft/s\n",
        "Solution for d\n",
        "The specific volume is 28.20 ft**3/lbm\n",
        "Solution for e\n",
        "The mass velocity is 102.78 lbm/s*ft**2)\n",
        "Method B\n",
        "Solution for a\n",
        "The temperature is 248.89 R\n",
        "Solution for b\n",
        "The pressure is 125.58 psia\n",
        "Solution for c\n",
        "As before 2898.59 ft/s\n",
        "Solution for d\n",
        "As before 28.20 ft**3/lbm\n",
        "Solution for e\n",
        "As before 102.78 lbm/s*ft**1)\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.41  Page No : 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#For Methane(CH4,MW = 16)\n",
      "p = 500; \t\t\t#evaluate specific volume at p pressure \t\t\t#Unit:psia\n",
      "pc = 674; \t\t\t#critical temperature \t\t\t#Unit:psia\n",
      "T = 50+460; \t\t\t#evaluate specific volume at T temperature \t\t\t#Unit:R\n",
      "Tc = 343; \t\t\t#critical temperature \t\t\t#Unit:R\n",
      "R = 1545./16; \t\t\t#gas constant R  =  1545/Molecular Weight \t\t\t#ft*lbf/lbm*R\n",
      "pr = p/pc; \t\t\t#reduced pressure \t\t\t#unit:psia\n",
      "Tr = T/Tc; \t\t\t#reduced temperature \t\t\t#unit:R\n",
      "#Reading figure 6.28 at these values gives\n",
      "Z = 0.93; \t\t\t#compressibility factor\n",
      "#Z = (p*v)/(R*T)\n",
      "v = Z*((R*T)/(p*144)); \t\t\t#ft**3/lbm \t\t\t#1 ft**2 = 144 in**2(for conversion of unit) \t\t\t#specific volume\n",
      "print \"Using the value of Z = 0.93,  the specific volume is %.2f ft**3/lbm\"%(v);\n",
      "#For ideal gas,\n",
      "v = (R*T)/(p*144); \t\t\t#ft**3/lbm \t\t\t#1 ft**2 = 144 in**2(for conversion of unit) \t\t\t#specific volume\n",
      "print \"For the ideal gas, the specific volume is %.2f ft**3/lbm\"%(v);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Using the value of Z = 0.93,  the specific volume is 0.64 ft**3/lbm\n",
        "For the ideal gas, the specific volume is 0.68 ft**3/lbm\n"
       ]
      }
     ],
     "prompt_number": 51
    }
   ],
   "metadata": {}
  }
 ]
}