{
 "metadata": {
  "name": "",
  "signature": "sha256:479142d4049abdadf07bf1d76656a8c86c874f2a835275461f9e38f39f10cbd5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Hydrostatics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.1 Page no : 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "h1 = 2 \t\t\t#in\n",
      "h2 = 2 \t\t\t#in\n",
      "wn = 13.6 \t\t\t#g/cc\n",
      "w = 1 \t\t\t#g/cc\n",
      "W = 62.4 \t\t\t#lbs/ft**3\n",
      "\n",
      "#CALCULATIONS\n",
      "ha = ((h2*wn/w)-h1)/12\n",
      "pa = ha*W/144\n",
      "\n",
      "#RESULTS\n",
      "print  'Pressure of water = %.2f lb/sq in '%(pa)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure of water = 0.91 lb/sq in \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.2 page no : 11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "a = 6 \t\t\t#ft\n",
      "h = 2 \t\t\t#ft\n",
      "sm = 13.6\n",
      "sw = 1\n",
      "sl =0.8\n",
      "\n",
      "#CALCULATIONS\n",
      "dh = h*(sm-sw)+a\n",
      "h1 = (dh-a)/(sl-1)\n",
      "\n",
      "#RESULTS\n",
      "print  'pressure difference in ft of water = %.1f ft of water '%(dh)\n",
      "print  'reading of mercury = %.f ft of liquid '%(h1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "pressure difference in ft of water = 31.2 ft of water \n",
        "reading of mercury = -126 ft of liquid \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.3 page no : 11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "sm = 13.6\n",
      "so = 0.9\n",
      "sw =1\n",
      "hb = 8 \t\t\t#ft\n",
      "hc = 7.5 \t\t\t#ft\n",
      "hd = 1.75 \t\t\t#ft\n",
      "\n",
      "#CALCULATIONS\n",
      "pa = (sm-so)*sw\n",
      "pc = pa - hb*so\n",
      "pd = pa+so*2-sm*2.5-hc\n",
      "pb = hb+hd+pd\n",
      "\n",
      "#RESULTS\n",
      "print  'pressure at A = %.2f ft of water '%(pa)\n",
      "print  'pressure at B = %.2f ft of water '%(pb)\n",
      "print  'pressure at C = %.2f ft of water '%(pc)\n",
      "print  'pressure at D = %.2f ft of water '%(pd)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "pressure at A = 12.70 ft of water \n",
        "pressure at B = -17.25 ft of water \n",
        "pressure at C = 5.50 ft of water \n",
        "pressure at D = -27.00 ft of water \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.4 page no : 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "lm = 2 \t\t\t#ft\n",
      "lw = 5 \t\t\t#ft\n",
      "lo = 8 \t\t\t#ft\n",
      "so = 0.75\n",
      "p = 40 \t\t\t#lb/in**2\n",
      "w = 62.4 \t\t\t#lbs/ft**3\n",
      "sm = 13.6\n",
      "#CALCULATIONS\n",
      "h = p*144/w\n",
      "Pd = (h-lm*sm)\n",
      "Pc = Pd-lw\n",
      "Pb = Pc-lo*so\n",
      "Pg = Pb*w/144\n",
      "#RESULTS\n",
      "print  'Reading of the pressure guage at the top of tank  = %.1f lb/in**2 '%(Pg)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reading of the pressure guage at the top of tank  = 23.4 lb/in**2 \n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.5 page no : 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "h = 42 \t\t\t#in\n",
      "w = 62.4 \t\t\t#lbs/ft**3\n",
      "#RESULTS\n",
      "D = h*w/(144*12)\n",
      "#CALCULATIONS\n",
      "print  'Depth of point  = %.1f lb/in**2 '%(D)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depth of point  = 1.5 lb/in**2 \n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.6 pageno : 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "h = 200 \t\t\t#ft\n",
      "w = 62.4 \t\t\t#lbs/ft**3\n",
      "#RESULTS\n",
      "D = h*w/(144)\n",
      "#CALCULATIONS\n",
      "print  'Depth of point  = %.1f lb/in**2 '%(D)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depth of point  = 86.7 lb/in**2 \n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.7 pageno :15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "w = 62.4 \t\t\t#lbs/ft**3\n",
      "l = 2 \t\t\t#ft\n",
      "b = 3 \t\t\t#ft\n",
      "h = 10 \t\t\t#ft\n",
      "#CALCULATIONS\n",
      "P = w*l*b*h\n",
      "#RESULTS\n",
      "print  'Total pressure  = %.f lb '%(P)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total pressure  = 3744 lb \n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.8 page no : 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "l = 2. \t\t\t#ft\n",
      "b = 3. \t\t\t#ft\n",
      "a = 60. \t\t\t#degrees\n",
      "h = 8. \t\t\t#ft\n",
      "w = 62.4 \t\t\t#lbs/ft**3\n",
      "#CALCULATIONS\n",
      "x = h+(b/l)*math.cos(math.radians(a))\n",
      "P = w*l*b*x\n",
      "#RESULTS\n",
      "print  'total pressure  = %.f lb '%(P)\n",
      "\n",
      "\n",
      "# Note : Answer is different in book please calculate manually using calculator."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "total pressure  = 3276 lb \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.9 page no : 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "l = 2. \t\t\t#ft\n",
      "b = 3. \t\t\t#ft\n",
      "h = 8. \t\t\t#ft\n",
      "w = 62.4 \t\t\t#lbs/ft**3\n",
      "#CALCULATIONS\n",
      "P = w*l*b*(h+(b/2))\n",
      "#RESULTS\n",
      "print  'total pressure  = %.f lb '%(P)\n",
      "\n",
      "# Note : Answer is different in book please calculate manually using calculator."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "total pressure  = 3557 lb \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.10 pageno : 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "l = 6. \t\t\t#ft\n",
      "b = 4. \t\t\t#ft\n",
      "w = 62.4 \t\t\t#lbs/ft**3\n",
      "h = 10. \t\t\t#ft\n",
      "\n",
      "#CALCULATIONS\n",
      "P = w*l*b*(b/2)\n",
      "hn = (b/2)+(l*b**3/(12*l*b*(b/2)))\n",
      "P1 = w*(h+(b/2))*l*b\n",
      "h1 = (h+(b/2))+(l*b**3/(12*l*b*(h+(b/2))))\n",
      "\n",
      "#RESULTS\n",
      "print \"Total pressure  = %d lb\"%(P1)\n",
      "print \"Depth  = %.2f ft\"%(hn)\n",
      "print 'pressure in ft in case 2 = %.3f ft '%(h1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total pressure  = 17971 lb\n",
        "Depth  = 2.67 ft\n",
        "pressure in ft in case 2 = 12.111 ft \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.11 page no : 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "sp = 0.87\n",
      "d = 12. \t\t\t#ft\n",
      "W = 62.4 \t\t\t#lb/ft**3\n",
      "Wa = 30. \t\t\t#lb/in**2\n",
      "\n",
      "#CALCULATIONS\n",
      "A = math.pi*d**2/4\n",
      "w = W*sp\n",
      "x = Wa*144/(w)\n",
      "P = round(w*A*x,-3)\n",
      "h = x+(A*d**2/16/(A*x))\n",
      "\n",
      "#RESULTS\n",
      "print  'force exerted by the oil upon the gate  = %.f lb '%(P)\n",
      "print  ' position of centre of pressure  = %.3f ft '%(h)\n",
      "\n",
      "# Note : Answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "force exerted by the oil upon the gate  = 489000 lb \n",
        " position of centre of pressure  = 79.689 ft \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.12 page no : 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "import math \n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "a = 60. \t\t\t#degrees\n",
      "l = 18. \t\t\t#ft\n",
      "b =  4. \t\t\t#ft\n",
      "W = 8000. \t\t\t#lb\n",
      "\n",
      "#CALCULATIONS\n",
      "P = w*b/(math.sin(math.radians(a))*2)\n",
      "h = ((b/(12*(math.sin(math.radians(a)))**3))*(math.sin(math.radians(a)))**2/(b/(math.sin(math.radians(a))*2)))+0.5\n",
      "h1 = (1-h)/math.sin(math.radians(a))\n",
      "x = ((l*W)/(h1*P))**(1./3)\n",
      "\n",
      "#RESULTS\n",
      "print  'Level of water  = %.2f ft '%(x)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Level of water  = 13.74 ft \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.13 page no : 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "l = 12 \t\t\t#ft\n",
      "b = 6 \t\t\t#ft\n",
      "h = 5.196 \t\t\t#ft\n",
      "a = 60 \t\t\t#degrees\n",
      "a1 = 45 \t\t\t#degrees\n",
      "\n",
      "#CALCULATIONS\n",
      "P = w*l*b*h/2\n",
      "h1 = ((l*b**3*(math.sin(math.radians(a)))**2/12)/(l*b*(h/2)))+(h/2)\n",
      "R = round(P*(b-(h1/math.cos(math.radians(a/2))))/((b*math.sin(math.radians(a1)))/2),-2)\n",
      "\n",
      "#RESULTS\n",
      "print  'Total comression in the promp CD  = %.f lb '%(R)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total comression in the promp CD  = 11000 lb \n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.14 page no : 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "h = 4. \t\t\t#ft\n",
      "b = 6. \t\t\t#ft\n",
      "sg = 1.45\n",
      "h1 = 5. \t\t\t#ft\n",
      "a = 90. \t\t\t#degrees\n",
      "\n",
      "#CALCULATIONS\n",
      "P1 = w*sg*h*b*(h1+(h/2))\n",
      "P2 = w*h*b*(h/2)\n",
      "Pr = P1-P2\n",
      "hup = ((b*h**3/12)*(math.sin(math.radians(a)))**2/(h*b*(h1+(h/2))))+(h1+(h/2))\n",
      "x1 = h+h1-hup\n",
      "hd = h*2/3\n",
      "x2 = h-hd\n",
      "x = (P1*x1-P2*x2)/Pr\n",
      "d = h1+h-x\n",
      "F = Pr*x/4\n",
      "\n",
      "#RESULTS\n",
      "print  'P resultant  = %.f lb '%(Pr)\n",
      "print  'depth of centre of pressure  = %.3f ft '%(d)\n",
      "print  'force F required to act horizontally at the top of gate  = %.f lb '%(F)\n",
      "\n",
      "\n",
      "# Note : The answer given in texxtbook is wrong. Please check using a calculator.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "P resultant  = 12205 lb \n",
        "depth of centre of pressure  = 7.074 ft \n",
        "force F required to act horizontally at the top of gate  = 5878 lb \n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.15 page no : 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "w = 15. \t\t\t#ft\n",
      "D = 15. \t\t\t#ft\n",
      "W = 62.4 \t\t\t#lb/ft**3\n",
      "a = 120. \t\t\t#degrees\n",
      "h1 = 15. \t\t\t#ft\n",
      "h2 = 4. \t\t\t#/ft\n",
      "h3 = 18. \t\t\t#ft\n",
      "\n",
      "#CALCULATIONS\n",
      "Pu = round(w*D*W*w/2,-3)\n",
      "hu = ((w*D**3/12)/(w**2*D/2))+w/2\n",
      "Pd = W*h2*w*h2/2-8\n",
      "hd = ((w*h2**3/12)/(h2*h1*(h2/2)))+(h2/2)\n",
      "P = Pu-Pd\n",
      "h = (Pu*(h1-hu)-Pd*(h2-hd))/P\n",
      "F = P/(2*math.sin(math.radians(a/4)))\n",
      "RT = round(F*(h3-(h1/10)-h)/(h3-(h1/5)),-3)\n",
      "RB =F-RT\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print 'Resultant water pressure on each gate : %d lb'%P\n",
      "print 'Height of c.p from bottom %.2f ft'%h\n",
      "print  'RB  = %.f lb '%(RB)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resultant water pressure on each gate : 97520 lb\n",
        "Height of c.p from bottom 5.28 ft\n",
        "RB  = 24520 lb \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.16 page no : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "import math \n",
      "h = 42. \t\t\t#ft\n",
      "w = 25. \t\t\t#ft\n",
      "d = 8. \t\t\t#ft\n",
      "W = 150. \t\t\t#lb/ft**3\n",
      "w1 = 62.4 \t\t\t#lb/ft**3\n",
      "\n",
      "#CALCULATIONS\n",
      "W1 = W*(h*d+(h*(w-d)/2))\n",
      "P = round(w1*h*(h/2),-3)\n",
      "R = round(math.sqrt(W1**2+P**2)-100,-2)\n",
      "o = math.tan(math.radians(P/W1))\n",
      "AE = round((d*h*(d/2)+(w-d)*h*(d+(w-d)/3)/2)/(d*h+h*(w-d)/2),2)\n",
      "EF = round(14*P/W1,2)\n",
      "AF = EF+AE\n",
      "AH = w/2\n",
      "e = round(AF-AH,1)\n",
      "BS = round(W1*e*AH/(w**3/12),-1)\n",
      "DS = W1/w-3\n",
      "Smax = BS+DS\n",
      "Smin = DS-BS\n",
      "u = w1 * h\n",
      "#RESULTS\n",
      "print \"Resultant thrust R = %d lb\"%R\n",
      "print  'S max  = %.f lb/sq ft '%(Smax)\n",
      "print  ' S min  = %.f lb/sq ft '%(Smin)\n",
      "print 'Normal stress on vertical plane at the base due to water pressure and is uniform = %d lb/sq ft'%u"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resultant thrust R = 117500 lb\n",
        "S max  = 8045 lb/sq ft \n",
        " S min  = 265 lb/sq ft \n",
        "Normal stress on vertical plane at the base due to water pressure and is uniform = 2620 lb/sq ft\n"
       ]
      }
     ],
     "prompt_number": 86
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.17 page no :  27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "W = 145. \t\t\t#lb/cu ft\n",
      "M = 500. \t\t\t#lb\n",
      "W1 = 64. \t\t\t#lb/cu ft\n",
      "\n",
      "#CALCULATIONS\n",
      "dW = W-W1\n",
      "V = M/dW\n",
      "\n",
      "#RESULTS\n",
      "print  'Volume of concrete  = %.1f cu ft '%(V)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume of concrete  = 6.2 cu ft \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.18 page no : 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "W = 10000. \t\t\t#tons\n",
      "A = 15000. \t\t\t#ft**2\n",
      "d = 15. \t\t\t#ft\n",
      "Dsw = 64. \t\t\t#lb/ft**3\n",
      "Dw = 62.4 \t\t\t#lb/ft**3\n",
      "\n",
      "#CALCULATIONS\n",
      "Vsw = 2240./Dsw\n",
      "Vw = 2240./Dw\n",
      "dV = Vw-Vsw\n",
      "V1 = W*dV\n",
      "h = W/A\n",
      "h1 = d+h\n",
      "\n",
      "#RESULTS\n",
      "print  'Depth necessary to just float the ship in river  = %.2f ft '%(h1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depth necessary to just float the ship in river  = 15.67 ft \n"
       ]
      }
     ],
     "prompt_number": 87
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.19 page no : 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# find Rightening moment\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "W = 5000. \t\t\t#tons\n",
      "w = 10. \t\t\t#tons\n",
      "d = 30. \t\t\t#ft\n",
      "x = 5.5 \t\t\t#in\n",
      "l = 10. \t\t\t#ft\n",
      "a = 15. \t\t\t#degrees\n",
      "\n",
      "#CALCULATIONS\n",
      "GM = round((w*d)*l/(W*(x/12)),1)\n",
      "M = round(GM*math.sin(math.radians(a))*W,-1)\n",
      "\n",
      "#RESULTS\n",
      "print 'Metacentric Height = %.1f ft'%GM\n",
      "print  'Rightening moment  = %.f lb '%(M)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Metacentric Height = 1.3 ft\n",
        "Rightening moment  = 1680 lb \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.20 page no : 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "import numpy\n",
      "\n",
      "#initialisation of variables\n",
      "l = 5. \t\t\t#ft\n",
      "h = 20. \t\t\t#in\n",
      "n = 1./15\n",
      "AG = 50. \t\t\t#in\n",
      "x = 30. \t\t\t#in\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "#CALCULATIONS\n",
      "AG1 = round(AG/(1+n),1)\n",
      "G1G2 = round(n*x/(1+n),2)\n",
      "W = l**2*w*(l/2)\n",
      "h1 = 32. \t\t\t#in\n",
      "BK = h1/2\n",
      "GK = 10. \t\t\t#in\n",
      "G1K = (AG+GK)-AG1\n",
      "BG1 = BK-G1K\n",
      "BM = (l**4./12)*2.*12/(l**3*BK*n)\n",
      "G1M = BM+BG1\n",
      "o  = G1G2/G1M\n",
      "\n",
      "#RESULTS\n",
      "print 'AG1 = %.1f in.'%AG1\n",
      "print 'G1G2 = %.2f in.'%G1G2\n",
      "print  'angle through which the cube will tilt  = %.3f in '%(o)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "AG1 = 46.9 in.\n",
        "G1G2 = 1.88 in.\n",
        "angle through which the cube will tilt  = 0.153 in \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}