{
 "metadata": {
  "name": "",
  "signature": "sha256:48ea781a71227cd2ed588b90ba4f6ceb57773ac789c06adb226b03cd21058126"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER 1: HEATING AND EXPANSION OF GASES ENTROPY"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1 Page 1"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan\n",
      "p1=280#lb/in^2\n",
      "v=2#ft^3\n",
      "p2=20#lb/in^2\n",
      "v2=18.03#ft^3\n",
      "\n",
      "#calculation\n",
      "W=144*(p1*v-p2*v2)/(1.2-1)#ft/lb\n",
      "\n",
      "#result\n",
      "print\"The volume and work done during the expansion is\",round(W,2),\"ft/lb\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The volume and work done during the expansion is 143568.0 ft/lb\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2 Page 2"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan\n",
      "v=2#ft^3\n",
      "v2=20#ft^3\n",
      "p=100000#ft lb\n",
      "v2=10.41#lb/in^2\n",
      "v3=10#lb/in^2\n",
      "p1=1.3#lb\n",
      "p2=(v2*199.5)/9.95#lb/in^2\n",
      "\n",
      "#calculation\n",
      "P=(p2/v3-v2)#lb/in^2\n",
      "\n",
      "#result\n",
      "print\"The initial andfinal pressure is\",round(P,4),\"lb/in^2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The initial andfinal pressure is 10.4623 lb/in^2\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4 Page 3"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan\n",
      "Cp=0.24#lb/in^2\n",
      "Cv=0.18#ft^3\n",
      "p1=5#lb/in^2\n",
      "T1=20#Degree C\n",
      "T2=150#Degree C\n",
      "\n",
      "#CALCULATIONS\n",
      "W=p1*Cp*(T2-T1)#C.H.U\n",
      "H=p1*Cv*(T2-T1)#C.H.U\n",
      "Gamma=Cp/Cv#lb/in^2\n",
      "\n",
      "#RESULTS\n",
      "print\"the constant pressure is\",round(W,2),\"C.H.U\"\n",
      "print\"the constant volume the value of gas is\",round(Gamma,2),\"lb/in^2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the constant pressure is 156.0 C.H.U\n",
        "the constant volume the value of gas is 1.33 lb/in^2\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5 Page 4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan\n",
      "Gama=1.33#ft/lb\n",
      "p=100#lb/in^2\n",
      "p1=20#lb/in^2\n",
      "v2=10.05#ft^3\n",
      "v=3#ft/lb\n",
      "\n",
      "#CALCULATIONS\n",
      "W=144*(p*v-p1*v2)/0.33#ft lb\n",
      "\n",
      "#RESULTS\n",
      "print\"The work done is\",round(W,2),\"lb\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The work done is 43200.0 lb\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8 Page 5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan\n",
      "p=3.74#ft/lb\n",
      "p1=2.48#ft/lb\n",
      "v=5.70#ft lb\n",
      "Cv=0.21#ft/lb\n",
      "P=440.00#lb/in^2\n",
      "P1=160.00#lb/in^2\n",
      "P2=14.00#lb/in^2\n",
      "T=25.00#degree C\n",
      "T1=100.00#F\n",
      "vs=(pi*(p1)**2/4)*(p/1728.00)#ft^3\n",
      "vc=5.70#ft^3\n",
      "v1=4.70#ft^3\n",
      "v2=vs/v1#ft^3\n",
      "v3=0.01273#ft^3\n",
      "T2=298.00#F\n",
      "\n",
      "#CALCULATIONS\n",
      "W=(P2*144.00*v3)/(T2*T1)#lb\n",
      "T3=((P1*144.0*1.0)/(P2*144.0*7.0)*T2)#Degree C\n",
      "T4=(P*T3)/P1#Degree C\n",
      "H=W*Cv*(T4-T3)#C.H.U\n",
      "\n",
      "#RESULTS\n",
      "print\"The heat supplied during explosion is\",round(H,5),\"C.H.U\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat supplied during explosion is 0.15398 C.H.U\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.9 Page 6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan,log\n",
      "v=10.0#ft^3\n",
      "p=100.0#lb/in^2\n",
      "p1=18.0#lb/in^2\n",
      "v1=50.0#ft^3\n",
      "n=log(p/p1)/log(5)\n",
      "gama=1.40#air\n",
      "\n",
      "#CALCULATIONS\n",
      "W=(144.0*(p*v-p1*v1))/(n-1)#ft lb\n",
      "H=(gama-n)/(gama-1)*W#ft lb\n",
      "E=W-H#ft lb\n",
      "\n",
      "#RESULTS\n",
      "print\"The heat supplied and the change of internal energy\",round(E,2),\"ft lb\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat supplied and the change of internal energy 36000.0 ft lb\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.11 Page 7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan,log\n",
      "v=2.0#ft^3\n",
      "p=1100.0#lb/in^2\n",
      "t1=44.0#Degree C\n",
      "t2=15.0#Degree C\n",
      "p1=300.0#lb/in^2\n",
      "t3=3.0#Degree c\n",
      "Cv=0.17#ft/lb\n",
      "T=273.0#F\n",
      "R=96.0#ft lb\n",
      "p3=300.0#lb/in^2\n",
      "n=1.12#lb\n",
      "gama=1.404#lb\n",
      "W=((144*p*v)/(T+t1))/R#lb\n",
      "\n",
      "#CALCULATIONS\n",
      "Wc=W*Cv*(t1-t2)#C.H.U\n",
      "p2=p*(T+t2)/(T+t1)#lb /in^2\n",
      "A=(144*p3*v)/(R*276)#lb\n",
      "W1=(A/W)*v#ft^3\n",
      "H=((gama-n)/(gama-1))*(144*(p*0.65-p1*v)/(n-1))#ft lb\n",
      "H1=H/1400#C.H.U\n",
      "\n",
      "#RESULTS\n",
      "print\"the heat was lost by all the air in the vessel before leakage began\",round(Wc,4),\"C.H.U\"\n",
      "print\"the heat was lost or gainned leakage by the air\",round(H1,4),\"C.H.U\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the heat was lost by all the air in the vessel before leakage began 51.3218 C.H.U\n",
        "the heat was lost or gainned leakage by the air 69.2928 C.H.U\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.13 Page 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan,log\n",
      "h=0.218#ft^3\n",
      "h1=0.156#ft^3\n",
      "n=0.249#lb\n",
      "h2=0.178#lb\n",
      "c=0.208#lb\n",
      "c1=0.162#lb\n",
      "w1=1.0#ft^3\n",
      "p=150.0#lb/in^2\n",
      "T=100.0#Degree C\n",
      "T1=373.0#F\n",
      "Cp=(h*0.2312)+(n*0.3237)+(c*0.4451)#C.H.U/lb\n",
      "Cv=(h1*0.2312)+(h2*0.3237)+(c1*0.4451)#C.H.U//lb\n",
      "R=1400*(Cp-Cv)#ft lb units\n",
      "\n",
      "#CALCULATIONS\n",
      "W=(144*p*w1)/(R*T1)#lb\n",
      "\n",
      "#RESULTS\n",
      "print\"The characteristic constant of the gas is\",round(W,4),\"lb\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The characteristic constant of the gas is 0.7157 lb\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.20 Page 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan,log\n",
      "T=200.0#Degree C\n",
      "p=150.0#lb/in^2\n",
      "v=12.0#ft^3\n",
      "R=96.0#Lb\n",
      "T1=473.0#F\n",
      "T2=273.0#F\n",
      "j=1400.0#lb\n",
      "Cv=0.169#lb/in^2\n",
      "v1=(R*T1)/(p*144)#ft^3\n",
      "\n",
      "#CALCULATIONS\n",
      "Fhi=(R/j)*log(v/v1)+Cv*log(T2/T1)#rank\n",
      "\n",
      "#RESULTS\n",
      "print\"The change of entropy is\",round(Fhi,4),\"rank\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change of entropy is 0.0266 rank\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.22 Page 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan,log\n",
      "v=10.0#ft^3\n",
      "T=20.0#Degree C\n",
      "p=15.0#lb in^2\n",
      "p1=200.0#lb//in^2\n",
      "gama=1.41 #lb\n",
      "Cv=0.169#lb\n",
      "v2=1.153#ft^3\n",
      "j=1400.0#lb\n",
      "T1=293.0#F\n",
      "T2=451.0#F\n",
      "T1=((p1*v2)/(p*v))*T1#Degree C\n",
      "\n",
      "#CALCULATIONS\n",
      "R=Cv*j*(gama-1)\n",
      "W=0.816#lb\n",
      "Fhi=Cv*((gama-1.2)/(1.2-1))*log(T1/T2)*W#rnak\n",
      "\n",
      "#RESULTS\n",
      "print\"The change of entropy is\",round(Fhi,5),\"rank\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change of entropy is -0.00018 rank\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.23 Page 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan,log\n",
      "p=1.0#lb\n",
      "T=200.0#Degree C\n",
      "p1=15.0#lb/in^2\n",
      "v1=4.0#ft^3\n",
      "gama=1.41#lb\n",
      "Cv=0.169#lb\n",
      "J=1400.0#lb\n",
      "n=1.2\n",
      "T=473.0#F\n",
      "v2=16.1#ft^3\n",
      "T1=473.0#F\n",
      "\n",
      "#CALCULATIONS\n",
      "T2=(p1*v2)/(p*v1)*T1#Degree C\n",
      "R=Cv*J*(gama-p)#lb/in^2\n",
      "Fhi=0.1772*log(1.317)#rank\n",
      "\n",
      "#RESULTS\n",
      "print\"the change of entropy from intial condition is\",round(Fhi,5),\"rank\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the change of entropy from intial condition is 0.04879 rank\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.26 Page 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variable\n",
      "from math import pi,sqrt,acos,asin,atan,cos,sin,tan,log\n",
      "w=0.066#ft^3\n",
      "p=14.7#lb/in^2\n",
      "w1=14.2#lb/in^2\n",
      "w2=2780.0#lb/in^2\n",
      "g=0.038#lb\n",
      "a=28.9#lb\n",
      "R=w2/w1#for gas\n",
      "R1=93.0#for air\n",
      "T=273.0#F\n",
      "V=0.4245#ft^3\n",
      "\n",
      "#CALCULATIONS\n",
      "W=(p*144*w)/(T*R)#lb\n",
      "m=(g-W)#lb gas\n",
      "T2=(V+w)#ft^3\n",
      "\n",
      "#RESULTS\n",
      "print\"The volume of mixture is\",round(T2,4),\"ft^3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The volume of mixture is 0.4905 ft^3\n"
       ]
      }
     ],
     "prompt_number": 48
    }
   ],
   "metadata": {}
  }
 ]
}