{
 "metadata": {
  "name": "",
  "signature": "sha256:2df55062ff2333a87c8624b14338bf6cf25e04a49f7bd6f183057766f3ec7b9a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 : Center of Gravity"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1 Page No : 50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "W = 3000. \t\t\t#lb\n",
      "L = 10.   \t\t\t#ft\n",
      "Wf1 = 1200. \t\t\t#lb\n",
      "Wf2 = 1500. \t\t\t#lb\n",
      "angle = 30. \t\t\t#degrees\n",
      "\t\t\t\n",
      "# Calculations\n",
      "d1 = Wf1*math.cos(angle)*L/W\n",
      "d2 = Wf2*L/W\n",
      "xbc = d1/math.cos(angle)\n",
      "xab = d2-xbc\n",
      "y = xab/math.tan(math.radians(angle))\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'x  = %.2f ft'%(d2)\n",
      "print  'y = %.2f ft'%(y)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "x  = 5.00 ft\n",
        "y = 1.73 ft\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2 Page No : 51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "W4 = 3. \t\t\t#lb\n",
      "W3 = 5. \t\t\t#lb\n",
      "W2 = 2. \t\t\t#lb\n",
      "W1 = 6. \t\t\t#lb\n",
      "x1 = 10. \t\t\t#in\n",
      "x2 = 4. \t\t\t#in\n",
      "z = 5. \t\t\t#in\n",
      "\t\t\t\n",
      "# Calculations\n",
      "W = W1+W2+W3+W4\n",
      "x = (W1*0+W2*0+W3*x2+W4*x1)/W\n",
      "z = (W1*z+W2*0+W3*0+W4*0)/W\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'x  = %.2f in'%(x)\n",
      "print  'z = %.2f in'%(z)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "x  = 3.12 in\n",
        "z = 1.88 in\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3 Page No : 52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "import math \n",
      "# Variables\n",
      "W1 = 3. \t\t\t#lb\n",
      "W2 = 5. \t\t\t#lb\n",
      "x1 = 8. \t\t\t#in\n",
      "x2 = 7. \t\t\t#in\n",
      "y1 = 2. \t\t\t#in\n",
      "y2 = 5. \t\t\t#in\n",
      "z1 = 6. \t\t\t#in\n",
      "z2 = 4. \t\t\t#in\n",
      "\t\t\t\n",
      "# Calculations\n",
      "W = W1+W2\n",
      "x = (W1*x1+W2*x2)/W\n",
      "y = (W1*y1+W2*y2)/W\n",
      "z = (W1*z1+W2*z2)/W\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'x  = %.2f in'%(x)\n",
      "print  'y = %.2f in'%(y)\n",
      "print  'z = %.2f in'%(z)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "x  = 7.38 in\n",
        "y = 3.88 in\n",
        "z = 4.75 in\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4 Page No : 54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables\n",
      "L = 9.   \t\t\t#in\n",
      "B = 16. \t\t\t#in\n",
      "B1 = 6. \t\t\t#in\n",
      "d = 2. \t    \t\t#in\n",
      "\t\t\t\n",
      "# Calculations\n",
      "x = ((L*(B-B1)*(L/2)+(1./2)*L*B1*(L/3)-(math.pi/4)*d**2*(L/2)))/(L*(B-B1)+(1./2)*L*B1-(math.pi/4)*d**2)\n",
      "y =  ((L*(B-B1)*((B-B1)/2)+(1./2)*L*B1*(B1/3+(B-B1))-(math.pi/4)*d**2*((B-B1)/2)))/(L*(B-B1)+(1./2)*L*B1-(math.pi/4)*d**2)\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'x  = %.2f in to the right of y-axis'%(x)\n",
      "print  'y = %.2f in above x axis'%(y)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "x  = 4.14 in to the right of y-axis\n",
        "y = 6.66 in above x axis\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5 Page No : 57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\t\t\n",
      "# Variables\n",
      "Gt = 0.25 \t\t\t#in\n",
      "St = 0.25 \t\t\t#in\n",
      "Gw = 3.5 \t\t\t#lb/sq ft\n",
      "Sw = 10. \t\t\t#lb/sq ft\n",
      "Sb = 36. \t\t\t#in\n",
      "Sb1 = 18. \t\t\t#in\n",
      "Sb2 = 12. \t\t\t#in\n",
      "Sb3 = 6. \t\t\t#in\n",
      "Sy1 = 6. \t\t\t#in\n",
      "Sy2 = 12. \t\t\t#in\n",
      "Sy3 = 6. \t\t\t#in\n",
      "Gb = 1. \t\t\t#ft\n",
      "Sh = 24. \t\t\t#in\n",
      "Gh = 1. \t\t\t#ft\n",
      "\t\t\t\n",
      "# Calculations\n",
      "W = ((Sb*Sh)/(12*12)-(Gh*Gb))*Sw+(Gh*Gb)*Gw\n",
      "x = ((Sb*Sh)*Sw*(Sb/24)/(12*12)-(Gh*Gb)*Sw*((Sb1+(Sb2/2))/12)+(Gh*Gb)*Gw*((Sb1+(Sb2/2))/12))/W\n",
      "\t\t\t\n",
      "# Results\n",
      "print  'centre of gravity  = %.2f ft to the right of y-axis'%(x)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "centre of gravity  = 1.44 ft to the right of y-axis\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}