{
 "metadata": {
  "name": "chapter4.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 : Centroid , Centre Of Mass And Centre Of Gravity"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4-8,Page No:100"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initilization of variables\n",
      "\n",
      "b1=20 #cm # width of top flange\n",
      "t1=5 #cm # thickness of top flange\n",
      "b2=5 #cm # width of web\n",
      "t2=15 #cm # thickness or height of the web\n",
      "b3=30 #cm # width of bottom flange\n",
      "t3=5 #cm # thickness of bottom flange\n",
      "\n",
      "# Calculations\n",
      "\n",
      "A1=b1*t1 #cm^2 # area of bottom flange\n",
      "A2=b2*t2 #cm^2 # area of the web\n",
      "A3=b3*t3 #cm^2 # area of top flange\n",
      "y1=t3+t2+(t1*0.5) #cm # y co-ordinate of the centroid of top flange\n",
      "y2=t3+(t2*0.5) #cm #  y co-ordinate of the centroid of the web\n",
      "y3=t3*0.5 #cm #  y co-ordinate of the centroid of the bottom flange\n",
      "y_c=((A1*y1)+(A2*y2)+(A3*y3))/(A1+A2+A3) #cm # where y_c is the centroid of the un-symmetrycal I-section\n",
      "\n",
      "# Results\n",
      "\n",
      "print\"The centroid of the un equal I-section is \",round(y_c,2),\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centroid of the un equal I-section is  10.96 cm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4-9,Page No:101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "\n",
      "# The given section is Z-section which is un-symmetrycal about both the axis\n",
      "\n",
      "b1=20 #cm # width of bottom flange \n",
      "t1=5 #cm # thickness of the bottom flange\n",
      "b2=2.5 #cm # thickness of the web of the flange\n",
      "t2=15 #cm # depth of the web\n",
      "b3=10 #cm # width of the top flange\n",
      "t3=2.5 #cm # thickness of the top flange\n",
      "\n",
      "# Calculations\n",
      "\n",
      "# Respective areas\n",
      "\n",
      "A1=b1*t1 # cm^2 # area of the bottom flange\n",
      "A2=b2*t2 # cm^2 # area of the web\n",
      "A3=b3*t3 # cm^2 # area of the top-flange\n",
      "\n",
      "# first we calculate the x co-ordinate of the centroid\n",
      "\n",
      "x1=b3-b2+(b1*0.5) #cm # for the bottom flange\n",
      "x2=b3-(b2*0.5) #cm # for the web\n",
      "x3=b3*0.5 #cm # for the top flange\n",
      "x_c=((A1*x1)+(A2*x2)+(A3*x3))/(A1+A2+A3) #cm\n",
      "\n",
      "# secondly we calculate the y co-ordinate of the centroid\n",
      "\n",
      "y1=t1*0.5 #cm # for the bottom flange\n",
      "y2=t1+(t2*0.5) #cm # for the web\n",
      "y3=t1+t2+(t3*0.5) #cm # for the top flange\n",
      "y_c=((A1*y1)+(A2*y2)+(A3*y3))/(A1+A2+A3) # cm\n",
      "\n",
      "# Results\n",
      "\n",
      "print\"The centroid of the cross-sectional area of a Z-section about x-axis is \",round(x_c,2),\"cm\"\n",
      "print\"The centroid of the cross-sectional area of a Z-section about y-axis is \",round(y_c,2),\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The centroid of the cross-sectional area of a Z-section about x-axis is  13.56 cm\n",
        "The centroid of the cross-sectional area of a Z-section about y-axis is  7.69 cm\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}