{
 "metadata": {
  "name": "chapter 1 som.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1:Centre Of Gravity\n"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.1,Page No.8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of Variables\n",
      "\n",
      "#Rectangle-1\n",
      "a_1=37.5 #cm**2    \n",
      "y_1=26.25 #cm      \n",
      "\n",
      "#Rectangle-2\n",
      "a_2=50   #cm**2   \n",
      "y_2=15   #cm      \n",
      "\n",
      "#Rectangle-3\n",
      "a_3=150  #cm**2    \n",
      "y_3=2.5  #cm      \n",
      "\n",
      "\n",
      "#Calculation\n",
      "\n",
      "\n",
      "Y_bar=(a_1*y_1+a_2*y_2+a_3*y_3)*(a_1+a_2+a_3)**-1 #cm  \n",
      "\n",
      "#Result\n",
      "print\"The centroid of the section is\",round(Y_bar,2),\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centroid of the section is 8.88 cm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.2,Page No.9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "\n",
      "#Area-1\n",
      "a_1=6 #cm**2 \n",
      "x_1=3 #cm\n",
      "y_1=0.5 #cm\n",
      "\n",
      "#Area-2\n",
      "a_2=6 #cm**2\n",
      "x_2=2.671 #cm\n",
      "y_2=3 #cm\n",
      "\n",
      "#Area-3\n",
      "a_3=16 #cm**2\n",
      "x_3=1 #cm\n",
      "y_3=5 #cm\n",
      "\n",
      "\n",
      "#Calculation\n",
      "\n",
      "\n",
      "X_bar=(a_1*x_1+a_2*x_2+a_3*x_3)*(a_1+a_2+a_3)**-1 #cm\n",
      "Y_bar=(a_1*y_1+a_2*y_2+a_3*y_3)*(a_1+a_2+a_3)**-1 #cm\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"The centre of gravity of section is\",round(X_bar,2),\"cm\"\n",
      "print\"The centre of gravity of section is\",round(Y_bar,2),\"cm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centre of gravity of section is 1.79 cm\n",
        "The centre of gravity of section is 3.61 cm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.3,Page no.10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "\n",
      "#Area-1\n",
      "a_1=93.75 #cm**2 \n",
      "y_1=6.25 #cm\n",
      "\n",
      "#Area-2\n",
      "a_2=93.75 #cm**2 \n",
      "y_2=6.25 #cm\n",
      "\n",
      "#Area-3\n",
      "a_3=375 #cm**2   \n",
      "y_3=9.375 #cm\n",
      "\n",
      "#Area-4\n",
      "a_4=353.43 #cm**2\n",
      "y_4=6.366 #cm\n",
      "\n",
      "\n",
      "#Calculation\n",
      "\n",
      "Y_bar=(a_1*y_1+a_2*y_2+a_3*y_3-a_4*y_4)*(a_1+a_2+a_3-a_4)**-1 #cm\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"The centre of gravity lies at a distance of \",round(Y_bar,2),\"cm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centre of gravity lies at a distance of  11.66 cm\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.4,Page no.10\n",
      "\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "\n",
      "\n",
      "a_1=36*pi #cm**2  #Area of Quadrant of a circle\n",
      "x_1=16/pi #cm  \n",
      "y_1=16*pi**-1 #cm\n",
      "\n",
      "\n",
      "a_2=18*pi #cm**2  #Area of the semicircle\n",
      "x_2=6 #cm\n",
      "y_2=8*pi**-1 #cm\n",
      "\n",
      "\n",
      "#Calculation-1\n",
      "\n",
      "X_bar=(a_1*x_1-a_2*x_2)*(a_1-a_2)**-1 #cm\n",
      "\n",
      "#Calculation-2\n",
      "#To calculate Y_bar,taking AB as the Reference line\n",
      "\n",
      "Y_bar=(a_1*y_1-a_2*y_2)*(a_1-a_2)**-1 #cm\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The centre of gravity is \",round(X_bar,2),\"cm\"\n",
      "print\"The centre of gravity is\",round(Y_bar,2),\"cm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centre of gravity is  4.19 cm\n",
        "The centre of gravity is 7.64 cm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.5,Page no.11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "\n",
      "#Circle-1 \n",
      "a_1=100*pi #cm**2\n",
      "x_1=10 #cm\n",
      "    \n",
      "#Square-2 \n",
      "a_2=50 #cm**2\n",
      "x_2=15 #cm\n",
      "    \n",
      "#Calculation\n",
      "\n",
      "X_bar=(a_1*x_1-a_2*x_2)*(a_1-a_2)**-1 #cm\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"The centre of gravity is\",round(X_bar,2),\"cm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centre of gravity is 9.05 cm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.6,Page no.12\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#intilization of variables \n",
      "\n",
      "#Rectangle-1\n",
      "a_1=51200 #mm**2 \n",
      "x_1=160 #mm\n",
      "y_1=80 #mm\n",
      "\n",
      "#Triangle-2\n",
      "a_2=6400 #mm**2\n",
      "x_2=80*3**-1 #mm\n",
      "y_2=320*3**-1 #mm\n",
      "\n",
      "#Semicircle-3\n",
      "a_3=1250*pi #mm**2\n",
      "x_3=210 #mm\n",
      "y_3=(160-(4*50-(3*pi)**-1)) #mm\n",
      "\n",
      "\n",
      "#Calculation\n",
      "\n",
      "X_bar=(a_1*x_1-a_2*x_2-a_3*x_3)*(a_1-a_2-a_3)**-1 #mm\n",
      "Y_bar=(a_1*y_1-a_2*y_2-a_3*y_3)*(a_1-a_2-a_3)**-1 #mm\n",
      "\n",
      "#Result\n",
      "print\"The centroid of the given area is\",round(X_bar,2),\"mm\"\n",
      "print\"The centroid of the given area is\",round(Y_bar,2),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centroid of the given area is 176.07 mm\n",
        "The centroid of the given area is 87.34 mm\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.8,Page no.12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "\n",
      "\n",
      "alpha=pi/2 #degree #In case of semicircle\n",
      "\n",
      "#Semicircle-1\n",
      "r_1=20 #cm #radius of semicircle \n",
      "y_1=4*r_1*(3*pi)**-1 #cm #distance from the base\n",
      "a_1=(pi*r_1**2)*2**-1 #cm**2 #area of semicircle\n",
      "\n",
      "#Semicircle-2\n",
      "r_2=16 #cm   #radius of semicircle\n",
      "y_2=4*r_2*(3*pi)**-1 #cm #distance from the base\n",
      "a_2=(pi*r_2**2)*2**-1 #cm**2 #area of semicircle\n",
      "\n",
      "#Calculations\n",
      "\n",
      "\n",
      "Y_bar=(a_1*y_1-a_2*y_2)*(a_1-a_2)**-1 #cm #centroid\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"The centroid of the area is \",round(Y_bar,2),\"cm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centroid of the area is  11.51 cm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem no1.12,Page no.16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "\n",
      "#Right Circular Cyclinder\n",
      "#m_1=(16*pi*h*rho_1) #gm \n",
      "#y_1=4+h*2**-1 #cm\n",
      "\n",
      "#Hemisphere\n",
      "#m_2=256*pi*rho_1 #gm \n",
      "y_2=2.5 #cm \n",
      "\n",
      "Y_bar=4 #cm\n",
      "r=4 #cm\n",
      "\n",
      "#Calculation\n",
      "\n",
      "#Y_bar=(m_1*y_1+m_2*y_2)*(m_1+m_2)**-1 #cm #Centroid\n",
      "h=(402.114*25.132**-1)**0.5\n",
      "\n",
      "#Result\n",
      "print\"The value of h is\",round(h,2),\"cm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of h is 4.0 cm\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}