{
 "metadata": {
  "name": "EHP-1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": "Matter and Energy"
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.1, Page 17"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.2 #ft/s^2\nm=500.0 #lb\nrate=10.0 #ft/s^2\n\n#calculations\nF1=m/g *rate\nms=m/g\nF2=ms*rate\n\n#results\nprint \"Force in case 1 in lbf\",round(F1,3)\nprint \"Force in case 2 in lbf\",round(F2,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Force in case 1 in lbf 155.28\nForce in case 2 in lbf 155.28\n"
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.2,Page 18"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.2 #ft/s^2\ng2=32.0 #ft/s^2\nrate=10 #ft/s^2\nw1=500 #lbf\n\n#calculations\nfd1=w1*g2/g\nF=fd1/g2 *rate\nms=w1/g\nF2=ms*rate\n#results\nprint  \"Net weight of body in case 1 in lbf\",round(F,3)\nprint \"Force in case 2 in lbf\",round(F2,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Net weight of body in case 1 in lbf 155.28\nForce in case 2 in lbf 155.28\n"
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.3, Page 19"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.174 #ft/s^2\nm=500.0 #lbm\nrate=10.0 #ft/s^2\n\n#calculations\nF=1/g *m*rate\n\n#results\nprint \"Force required in lbf\",round(F,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Force required in lbf 155.405\n"
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.4, Page 21"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng1=32.174 #ft/s^2\ngc=g1\ng2=30 #ft/s^2\nm=100 #lbm\n\n#calculations\nw1=g1/gc *m\nw2=g2/gc *m\n\n#results\nprint \"Weight in case 1 in lbf\",round(w1,3)\nprint \" Weight in case 2 in lbf\",round(w2,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Weight in case 1 in lbf 100.0\n Weight in case 2 in lbf 93.243\n"
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.5,Page 22"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\nge=32.174 #ft/s^2\ngm=5.47 #ft/s^2\nwe=50 #lbm\n\n#calculations\nwm=we*gm/ge\n\n#results\nprint \"In case a, it will weigh the same, weight  in lbm\",round(we,2)\nprint \" In case b, weight in lbf\",round(wm,2)\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "In case a, it will weigh the same, weight  in lbm 50.0\n In case b, weight in lbf 8.5\n"
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.6,Page 31"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.2 #ft/s^2\np1=100 #psig\np2=29.0 #in of Hg\n\n#calculations\nBP=p2*0.491\nAP=BP+p1\n\n#results\nprint \"Absolute pressure in psia\",round(AP,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Absolute pressure in psia 114.239\n"
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.7,Page 32"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.2 #ft/s^2\nPb=29.5 #in of Hg\nPv=10 #in of Hg\n\n#calculations\nAP=(Pb-Pv)*0.491\n\n#results\nprint \"Absoulte pressure in psia\",round(AP,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Absoulte pressure in psia 9.575\n"
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.8,Page 38"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.2 #ft/s^2\nv1=1 #cu ft\np1=100 #psia\n\n#calculations\nv2=2*v1\nW=144*p1*(v2-v1)\n\n#results\nprint \"Work done in ft-lb\",round(W,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Work done in ft-lb 14400.0\n"
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.9,Page 39"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.2 #ft/s^2\nv1=1 #cu ft\np1= 100.0 #psia\np2=50.0 #psia\nv2=3.0 #cu ft\n\n#calculations\npa=(p1+p2)/2\nW=pa*(v2-v1)*144\n\n#results\nprint \"Work done in ft-lb\",round(W,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Work done in ft-lb 21600.0\n"
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.10,Page 40"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.2 #ft/s^2\np1=100.0 #psia\np2=25.0 #psia\nv2=2.0 #cu ft\n\n#calculations\nW=p1*144*v2 - p2*144*v2\n\n#results\nprint \"Work done in ft-lb\",round(W,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Work done in ft-lb 21600.0\n"
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.11,Page 41"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "# Initialization of Variable\nfrom math import pi\nfrom math import atan\ng=32.2 #ft/s^2\nn=100 #rpm\np1=100 #psia\np2=25 #psia\nv2=2 #cu ft\n\n#calculations\nW=p1*144*v2 - p2*144*v2\nHp=W*n/33000\n\n#results\nprint round(Hp,3),\"Horsepower developed in hp\"",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "65.0 Horsepower developed in hp\n"
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1.12,Page 46"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#initialisation of variable\nP=50.0 #hp\nm=30.0 #lb\nE=19000.0 #Btu/lb\n\n#calculations\neta= P*2545/(m*E) *100 #efficiency\n\n#results\nprint \"Efficiency in percent\",round(eta,3)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Efficiency in percent 22.325\n"
      }
     ],
     "prompt_number": 12
    }
   ],
   "metadata": {}
  }
 ]
}