{
 "metadata": {
  "name": "",
  "signature": "sha256:82344ff688f3e86a09716345a8eb43cec4a8aadc2157f526516e21d9f1e84d30"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Hydrostatics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2 Page No : 5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "w= 62.4     #lb/ft**3\n",
      "A= 18.       #ft**2\n",
      "x= 6.        # height ft\n",
      "kg= 6.\n",
      "y= 2.        #ft hinges\n",
      "y1= 5.       #ft\n",
      "\n",
      "#CALCULATIONS\n",
      "F= w*A*x\n",
      "F1= F/2\n",
      "Ft= (F*y-F1*(y1/2))/y1\n",
      "Fb= F1-Ft\n",
      "\n",
      "#RESULTS\n",
      "print  'Force exerted on the bolt = %.f lb'%(F1)\n",
      "print  ' Force exerted on the hinge = %.f lb'%(Ft)\n",
      "print  ' Force exerted on the bolt = %.f lb'%(Fb)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force exerted on the bolt = 3370 lb\n",
        " Force exerted on the hinge = 1011 lb\n",
        " Force exerted on the bolt = 2359 lb\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3 Page No : 6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "h1= 11.54 \t#ft\n",
      "h2= 16.33 \t#ft\n",
      "w= 62.4 \t#lb/ft**3\n",
      "x1= 7.69 \t#ft\n",
      "x2= 14.09 \t#ft\n",
      "x3= 18.23 \t#ft\n",
      "\n",
      "#CALCULATIONS\n",
      "Ft= round(w*h1**2/2)\n",
      "\n",
      "#RESULTS\n",
      "print  'h1 = %.2f ft'%(h1)\n",
      "print  ' h2 = %.2f ft'%(h2)\n",
      "print  ' h1+ = %.2f ft'%(x1)\n",
      "print  ' h2+ = %.2f ft'%(x2)\n",
      "print  ' h3+ = %.2f ft'%(x3)\n",
      "print  ' Thrust force = %.f lb/ft run'%(round(Ft,-1))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "h1 = 11.54 ft\n",
        " h2 = 16.33 ft\n",
        " h1+ = 7.69 ft\n",
        " h2+ = 14.09 ft\n",
        " h3+ = 18.23 ft\n",
        " Thrust force = 4160 lb/ft run\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4 Page No : 8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "spo= 0.9    # gravity\n",
      "h= 3.    \t#ft depth\n",
      "d= 2. \t    #ft depth of water\n",
      "w= 62.4 \t#lb/ft**3\n",
      "H= 0.71 \t#ft\n",
      "\n",
      "#CALCULATIONS\n",
      "do= spo*w\n",
      "de= w*d\n",
      "bc= do*h\n",
      "Pt= (bc*(h/2)+bc*d+de*(d/2))*(h+d)\n",
      "y= (bc*(h/2)+bc*d+de*(d/2)*(d/3))*(h+d)/Pt+H\n",
      "\n",
      "#RESULTS\n",
      "print \"Total pressure = %d lb\"%(Pt)\n",
      "print  ' position of centre of pressure above the base = %.2f ft position of centre of pressure above the axis '%(y)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total pressure = 3572 lb\n",
        " position of centre of pressure above the base = 1.65 ft position of centre of pressure above the axis \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5 Page No : 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "a= 30. \t#degrees\n",
      "b= 30. \t#degrees\n",
      "h= 20. \t#ft width of lock\n",
      "h1= 10. \t#ft   water level\n",
      "h2= 15. \t#ft   water level\n",
      "h3= 16. \t#ft   high\n",
      "w= 62.4 \t#lb/ft**3\n",
      "h4= 10./3 \t#ft\n",
      "\n",
      "#CALCULATIONS\n",
      "Rt= (1./h3)*((w*(h*h2**2*(h2/3)/(2*math.sqrt(3))))-(w*(h*h1**2*h4/(2*math.sqrt(3)))))\n",
      "R= ((w*(h*h2**2/(2*math.sqrt(3))))-(w*(h*h1**2/(2*math.sqrt(3)))))\n",
      "Rb= R-Rt\n",
      "\n",
      "#RESULTS\n",
      "print  'Force at the hinge = %.f lb '%(Rt)\n",
      "print  ' Force at the hinge = %.f lb '%(Rb)\n",
      "\n",
      "# Note : Round off error in textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force at the hinge = 17826 lb \n",
        " Force at the hinge = 27208 lb \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6 Page No : 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "\n",
      "#initialisation of variables\n",
      "x= 32. \t    #ft\n",
      "h= 60.  \t#ft   depth\n",
      "w= 62.4 \t#lb/ft**3\n",
      "AE= 20. \t#ft\n",
      "\n",
      "#CALCULATIONS\n",
      "Vabc= 2*x*h/3\n",
      "vc= Vabc*w\n",
      "Tab= w*h**2/2\n",
      "Rt= math.sqrt(vc**2+Tab**2)/2240\n",
      "A= math.degrees(math.atan(vc/Tab))\n",
      "AD= x-AE+AE*(1/(math.tan(math.radians(A))))\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print \"resulmath.tant thrust = %.1f tons\"%(Rt)\n",
      "print \" Angle = %.2f degrees\"%(A)\n",
      "print  ' AD = %.1f ft '%(AD)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "resulmath.tant thrust = 61.5 tons\n",
        " Angle = 35.42 degrees\n",
        " AD = 40.1 ft \n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7 Page No : 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "wdc= 3*math.sqrt(3) \t#ft\n",
      "wdo= math.sqrt(3)\n",
      "ac= 30.  \t#degrees\n",
      "ao= 60. \t#degrees\n",
      "hob= 3. \t#ft\n",
      "haf= 2.6 \t#ft\n",
      "hfc= 3. \t#ft\n",
      "w= 62.4 \t#lb/ft**3\n",
      "V= 5.63 \t#ft**3\n",
      "h= 4.3   \t#ft\n",
      "y= 3.6 \t    #ft\n",
      "\n",
      "#CALCULATIONS\n",
      "W1= int(wdc*hfc*w/2)\n",
      "Hbc= round(w*hob*(hob/2))\n",
      "W2= int(V*w)\n",
      "W3= int(w*haf*h)\n",
      "Vt= W1+W2\n",
      "Vht= Hbc+W3\n",
      "Rt= int(math.sqrt(Vt**2+Vht**2))\n",
      "A= math.degrees(math.atan(Vht/Vt))\n",
      "x= (W1*(wdo-(hob/2))+Hbc*y)/Rt\n",
      "OP= x/math.sin(math.radians(A))\n",
      "AP= hob+OP\n",
      "\n",
      "#RESULTS\n",
      "print \"Resultant thrust = %d lb\"%(Rt)\n",
      "print \" Angle = %.2f degrees \"%(A)\n",
      "print  ' Distance from A till horizontal thrust = %.3f ft '%(AP)\n",
      "\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resultant thrust = 1287 lb\n",
        " Angle = 49.44 degrees \n",
        " Distance from A till horizontal thrust = 4.150 ft \n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8 Page No : 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "r= 96.      # T air\n",
      "T= 10.5 \t#C\n",
      "K1= 288. \t#C temperature gound level\n",
      "K2= 0.0015 \t#C**-1  temperature gradient\n",
      "h= 3000. \t#ft height\n",
      "P1= 14.69\n",
      "\n",
      "#CALCULATIONS\n",
      "P2= P1*10**(((1/(r*K2))*math.log10((K1-K2*h)/K1)))\n",
      "w= P2*144/(r*(273+T))\n",
      "\n",
      "#RESULTS\n",
      "print  'Density = %.4f lb/ft**3 '%(w)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Density = 0.0697 lb/ft**3 \n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.9 Page No : 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "Hb= 20. \t#in ratio\n",
      "Ha= 1.   \t#in ratio\n",
      "a= 20. \t    #degrees\n",
      "\n",
      "#CALCULATIONS\n",
      "hb= Hb*math.sin(math.radians(a))\n",
      "dh= hb+Ha\n",
      "dP= dh/(12*2.309)\n",
      "\n",
      "#RESULTS\n",
      "print  'Pressure difference between tapping points = %.3f lb/in**2 '%(dP)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure difference between tapping points = 0.283 lb/in**2 \n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.10 Page No : 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "P= 180. \t#ln/in**2  pressure\n",
      "r= 53.      #T air\n",
      "T= 60.   \t#F temperature of air\n",
      "w= 62.4 \t#lb/ft**3\n",
      "h= 12. \t    #in water level\n",
      "\n",
      "#CALCULATIONS\n",
      "R= P*144/(r*(460+T))\n",
      "dP= 12*(1-(R/w))\n",
      "Pab= dP/(12*2.309)\n",
      "\n",
      "#RESULTS\n",
      "print  'Difference in water level = %.2f in of water '%(dP)\n",
      "print \" Pressure difference = %.3f lb/in**2\"%(Pab)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Difference in water level = 11.82 in of water \n",
        " Pressure difference = 0.427 lb/in**2\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}