{
 "metadata": {
  "name": "",
  "signature": "sha256:b1d2399b6b4acd9a65f6af74a5e09d523ac3468105509cc56b7fc106dd581d3b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 : Equilibrium of Floating Bodies"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1 Page No : 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "l = 4.\n",
      "w = 2.\n",
      "sg = 0.75\n",
      "z = 9810.\n",
      "d = 0.5\n",
      "\n",
      "# Calculations \n",
      "v = l*w*d\n",
      "wg = v*z*sg\n",
      "s = 24000.\n",
      "V = ((z*v)-wg)/s\n",
      "V1 = (v*z-wg)/(s-z)\n",
      "\n",
      "# Results \n",
      "print \"volume in m3 when block is completely in water\",V,\"m**3\"\n",
      "print \"volume in m3 when block and concrete completely under water\",round(V1,5),\"m**3\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "volume in m3 when block is completely in water 0.40875 m**3\n",
        "volume in m3 when block and concrete completely under water 0.69133 m**3\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2 Page No : 42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "d = 1\n",
      "s = 0.75\n",
      "w = 9810\n",
      "\n",
      "# Calculations \n",
      "a = math.pi*d*d/4\n",
      "h = d*0.5\n",
      "p = w*h*s \t\t\t# intensity of pressure on at horizontal interface\n",
      "v = p*a  \t\t\t#vertical upward force\n",
      "w1 = w*s*a*d/3 \t\t\t# weight of oil in upper hemisphere\n",
      "vf = v-w1  \t\t\t# net vertical upward force\n",
      "\n",
      "# Results \n",
      "print \"minimum weight of upper hemisphere in N\",round(vf,4),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "minimum weight of upper hemisphere in N 963.0945 N\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3 Page No : 42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "w = 90.\n",
      "\n",
      "# Calculations \n",
      "# By archemde's principle\n",
      "# weight of water print alced  =  weight of sphere\n",
      "z = 9810\n",
      "v = w/z\n",
      "d = (v*12/3.142)**0.33333\n",
      "\n",
      "# Results \n",
      "print \"external diameter of hollow of sphere in m\",round(d,4),\"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "external diameter of hollow of sphere in m 0.3272 m\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4 Page No : 43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "s1 = 13.6\n",
      "s2 = 7.8\n",
      "s3 = 1.\n",
      "\n",
      "# Calculations \n",
      "# by archimede principle\n",
      "# weight of body  =  weight of liquid print laced\n",
      "# s2 = s1*x+s3*(1-x) \n",
      "x = (s2-s3)/(s1-s3)\n",
      "\n",
      "# Results \n",
      "print \"fraction of steel below surface of mercury\",round(x,2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fraction of steel below surface of mercury 0.54\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.5 Page No : 43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "w = 9810.\n",
      "do = 1.25\n",
      "a = math.pi*do*do*0.25\n",
      "\n",
      "# Calculations \n",
      "f1 = w*a*1\n",
      "f2 = w*a*3 \t\t\t# buoyancy force of 3m lenght of pipe\n",
      "di = 1.2\n",
      "s = 9.8\n",
      "wg = w*s*3*((1.25**2)-(1.2**2))*0.25*math.pi\n",
      "fa = f2-wg\n",
      "\n",
      "# Results \n",
      "print \"buoyancy force in N/m\",round(f1,3),\"N/m\"\n",
      "print \"upward force on anchor\",fa,\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "buoyancy force in N/m 12038.681 N/m\n",
        "upward force on anchor 8367.36499746 N\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.6 Page No : 44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "a = 0.25\n",
      "s1 = 11.5\n",
      "s2 = 1.\n",
      "z = 9810.\n",
      "v1 = a*a*a*0.5\n",
      "wc = v1*z\n",
      "h = 0.016\n",
      "\n",
      "# Calculations \n",
      "# by archimede's principle\n",
      "v2 = (a*0.5+h)*a*a \t\t\t# volume of cube submergerd\n",
      "v = (v2-v1)/(s1-s2)\n",
      "wl = v*s1*z\n",
      "\n",
      "# Results \n",
      "print \"weight of lead attached\",round(wl,3),\"N\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "weight of lead attached 10.744 N\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.7 Page No : 45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "s1 = 19.3\n",
      "s2 = 9.\n",
      "x = 14./24\n",
      "\n",
      "# Calculations \n",
      "wg = x*10\n",
      "wc = (1-x)*10\n",
      "vg = wg/s1\n",
      "vc = wc/s2\n",
      "vt = vg+vc\n",
      "\n",
      "# Results \n",
      "print \"volume of 10gm,14 carat gold in cm3\",round(vt,3),\"cc\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "volume of 10gm,14 carat gold in cm3 0.765 cc\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.8 Page No : 46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "h1 = 0.05\n",
      "h2 = 0.015\n",
      "s = 41./40\n",
      "l = h1/(s-1)\n",
      "w1 = 25\n",
      "\n",
      "# Calculations \n",
      "# applying bakance in vertical direction\n",
      "w = w1*(l+h1)/(h2)\n",
      "\n",
      "# Results \n",
      "print \"weight of ship in in N\",round(w,3),\"kN\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "weight of ship in in N 3416.667 kN\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.9 Page No : 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "w = 700.\n",
      "w1 = 20000.\n",
      "d = 0.5\n",
      "h = 1.\n",
      "wd = 250.\n",
      "z = 9810.\n",
      "\n",
      "# Calculations \n",
      "f = z*3.142*d*d*2*0.25/3\n",
      "n = (w*4+w1)/(f-250)\n",
      "n1 = round(n)\n",
      "\n",
      "# Results \n",
      "print \"number of drums\",n1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "number of drums 22.0\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.10 Page No : 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "a = 0.12\n",
      "l = 1.8\n",
      "s = 0.7\n",
      "z = 9810.\n",
      "wp = s*a*a*l*z\n",
      "v = a*a*(l-0.2)\n",
      "w = v*z\n",
      "t = w-wp\n",
      "sp = 110000.\n",
      "\n",
      "# Calculations \n",
      "# applying equilibrium balance\n",
      "w = t/(1-(9810/sp)) \n",
      "\n",
      "# Results \n",
      "print \"weight of lead in N\",round(w,3),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "weight of lead in N 52.733 N\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.11 Page No : 48"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "d = 4.\n",
      "h = 4.\n",
      "s = 0.6\n",
      "s1 = 1.\n",
      "\n",
      "# Calculations \n",
      "h1 = s*h/s1\n",
      "v = 3.142*d*d*0.25*h1\n",
      "x = h1/2\n",
      "cog = h/2\n",
      "h2 = cog-x\n",
      "a = 3.142*d*d*d*d/64\n",
      "bm = a/v\n",
      "mh = bm-h2\n",
      "\n",
      "# Results \n",
      "print \"metacentric height in m,negative sign indicte that cylinder is in unstable equilibrium\",round(mh,4),\"m\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "metacentric height in m,negative sign indicte that cylinder is in unstable equilibrium -0.3833 m\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.12 Page No : 49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "d = 4.\n",
      "s1 = 0.6\n",
      "s2 = 0.9\n",
      "l = 1.\n",
      "\n",
      "# Calculations \n",
      "h = s1*l/s2\n",
      "cob = h/2\n",
      "cog = l/2\n",
      "dcog = cog-cob\n",
      "i = 3.142*d*d*d*d/64\n",
      "v = 3.142*0.25*d*d*h\n",
      "bm = i/v\n",
      "bm = dcog\n",
      "l = (6*1.5)**0.5\n",
      "\n",
      "# Results \n",
      "print \"maximium lenght of cylinder in m\",l,\"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximium lenght of cylinder in m 3.0 m\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.13 Page No : 51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "s = 2.\n",
      "w = 340.\n",
      "v = 0.5*s*s*s\n",
      "z = 9810.\n",
      "\n",
      "# Calculations \n",
      "w1 = z*4\n",
      "gb = s/4-s/8\n",
      "i = s*s*s*s/(12)\n",
      "v = 4\n",
      "bm = i/v\n",
      "gm = bm+gb\n",
      "p = w/(w1*gm)\n",
      "theta = math.degrees(math.atan(p))\n",
      "\n",
      "# Results \n",
      "print \"angle through which cube will tilt in minutes\",round((theta*60),3)\n",
      "\n",
      "\n",
      "# note : rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "angle through which cube will tilt in minutes 51.059\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.14 Page No : 51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "l = 60.\n",
      "b = 9.\n",
      "w = 16.*1000000\n",
      "w1 = 160.*1000\n",
      "y = 6.\n",
      "q = 3.\n",
      "sp = 10104.\n",
      "\n",
      "# Calculations \n",
      "i = 0.75*l*b*b*b/12\n",
      "v = w/sp\n",
      "bm = i/v\n",
      "gm = (w1*y)/(w*(math.tan(math.radians(q))))\n",
      "mcd = 2-bm\n",
      "cogd = gm+mcd\n",
      "\n",
      "# Results \n",
      "print \"metacentric height %.3f m \"%gm\n",
      "print \"position of centre of gravity below the water line %.3f m\"%cogd\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "metacentric height 1.145 m \n",
        "position of centre of gravity below the water line 1.419 m\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.15 Page No : 53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "w = 450000.\n",
      "y = 5.5\n",
      "w1 = 80.*1000000\n",
      "q = 3.\n",
      "\n",
      "# Calculations \n",
      "gm = (w*y)/(w1*math.tan(math.radians(q)))\n",
      "p = 12.5*1000\n",
      "n = 120.\n",
      "T = (p*60000)/(2*math.pi*n)\n",
      "z = T/(w1*gm)\n",
      "theta = math.degrees(math.atan(z))\n",
      "\n",
      "# Results \n",
      "print \"angle of heel in degree %.4f\"%theta\n",
      "\n",
      "# note : rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "angle of heel in degree 1.2066\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}