{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Buoyancy and Stability"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.4.1 Page no : 5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "#initialisation of variables\n",
      "ws= 64. \t\t\t#lbf/ft**3\n",
      "wi= 57. \t\t\t#lbf/ft**3\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "vabyvb= (ws/wi)-1\n",
      "vtbyva= (1./vabyvb)+1\n",
      "vabyvt= (1./vtbyva)*100\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  'percentage of total volume extended above the surface= %.1f per cent'%(vabyvt)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "percentage of total volume extended above the surface= 10.9 per cent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.4.2 page no :5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "p= 20. \t\t\t#lbf/in**2\n",
      "d1= 4. \t\t\t#in\n",
      "d2= 18. \t\t\t#in\n",
      "d3= 0.5 \t\t\t#in\n",
      "sw= 62.3 \t\t\t#lbf/ft**3\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "Fa= p*(math.pi/4)*d3**2\n",
      "Fb= (4/d2)*3.92\n",
      "V= 1.5*(Fb/sw)*1728\n",
      "r= (0.75*(V/math.pi))**(1/3.)\n",
      "d= 2*r\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  'diameter of the float= %.2f in'%(d)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "diameter of the float= 4.11 in\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.6.1 page no : 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \t\t\t\n",
      "\n",
      "#initialisation of variables\n",
      "delta_W= 4. \t\t\t#tonf\n",
      "x= 30. \t\t\t#ft\n",
      "W= 2000. \t\t\t#tonf\n",
      "O1=(0.015)\n",
      "O2= -0.015\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "O = O1-O2\n",
      "GM = (delta_W*x)/(W*O)\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  'metacentric height= %.f ft'%(GM)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "metacentric height= 2 ft\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.6.2 page no : 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "    \n",
      "#initialisation of variables\n",
      "ws= 1./35 \t\t\t#tonf/ft**3\n",
      "A= 10500. \t\t\t#ft**2\n",
      "wf= 1/36. \t\t\t#tonf/ft**3\n",
      "Wo= 7000. \t\t\t#tonf\n",
      "Wf= 6950.\t\t\t#tonf\n",
      "li= 300. \t\t\t#ft\n",
      "lh= 400. \t\t\t#ft\n",
      "l= 7200. \t\t\t#ft\n",
      "l1=50. \t\t\t    #ft\n",
      "l2= 10. \t\t\t#ft\n",
      "l3= 250. \t\t\t#ft\n",
      "l4= 40. \t\t\t#ft\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "Dod= (1./A)*((Wo/wf)-(Wf/ws))  #decrease of draught(ft)\n",
      "Ac= ws*A*Dod                   #additional cargo(tonf)\n",
      "x= (l1*l2+l3*l4)/(l+l3-l1*l2)\n",
      "do= (x/lh)*li\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  'change of draught= %.3f ft'%(Dod)\n",
      "print  '  Additional cargo=%.f tonf'%(Ac)\n",
      "print  '  change of trim=%.1f ft'%(do) \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "change of draught= 0.833 ft\n",
        "  Additional cargo=250 tonf\n",
        "  change of trim=1.1 ft\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.6.3 page no : 14\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "\n",
      "M= 500. \t\t\t#tonf ft/in\n",
      "D= 32. \t\t\t    #tonf/in\n",
      "l= 200. \t\t\t#ft\n",
      "L= 380. \t\t\t#ft\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "x= l+(M/D)*(L/l)\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  'length= %.1f ft aft'%(x)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "length= 229.7 ft aft\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.7.2 page no : 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "import math \n",
      "a= 6.\n",
      "b= -6.\n",
      "c= 1.\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "s1= (-b+math.sqrt(b**2-4*a*c))/(2*a)\n",
      "s2= (-b-math.sqrt(b**2-4*a*c))/(2*a)\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  'upper limit for specific gravity s= %.3f '%(s1)\n",
      "print  'lower limit for specific gravity s=%.3f tonf'%(s2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "upper limit for specific gravity s= 0.789 \n",
        "lower limit for specific gravity s=0.211 tonf\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.7.3 page no : 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "b= 350. \t\t\t#ft\n",
      "d= 12. \t\t\t#ft\n",
      "L= 46. \t\t\t#ft\n",
      "Ac1= 500.*80*12 \t\t\t#ft**3\n",
      "Ac2= 350.*12*9 \t\t\t#ft**3\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "Ic= (b*d**3)/12.\n",
      "A= b*d\n",
      "Io= Ic+A*L**2.\n",
      "I= 2*Io\n",
      "V= Ac1+2*Ac2\n",
      "BM= I/V\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  'print lacement of body= %.1f ft'%(BM)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "print lacement of body= 32.2 ft\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.8.1 page no : 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "W= 4500. \t\t#tonf\n",
      "b= 20. \t\t\t#length(ft)\n",
      "d= 8. \t\t\t#breadth(ft)\n",
      "s= 0.83         #specific gravity\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "I= int(b*d**3/12.)\n",
      "r= 3*s*I/(36*W)\n",
      "inc = r * 12      # inch\n",
      "\n",
      "#RESULTS\n",
      "print  'Reduction caused by three compartments= %.3f in.'%(inc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reduction caused by three compartments= 0.157 in.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.9.1 page no : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "\n",
      "import math \n",
      "Kg= 12. \t\t\t#ft\n",
      "g= 32.2 \t\t\t#ft/s**2\n",
      "GM= 2. \t\t\t#ft\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "T= 2.*math.pi*math.sqrt(Kg**2/(g*GM))\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  'periodic time of rolling of the ship= %.1f sec'%(T)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "periodic time of rolling of the ship= 9.4 sec\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}