{
 "metadata": {
  "name": "",
  "signature": "sha256:28eceabccc986d95bd8fd4a32c3e228a185da4101f3a8dcc4e232e8945315e7d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12: Review of Centroids and Moments of Inertia "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2, page no. 833"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "A1 = 6*0.5                      # Partial Area in in2\n",
      "A2 = 20.8                       # from table E1 and E3\n",
      "A3 = 8.82                       # from table E1 and E3\n",
      "y1 = (18.47/2.0) + (0.5/2.0)    # Distance between centroid C1 and C2\n",
      "y2 = 0                          # Distance between centroid C2 and C2\n",
      "y3 = (18.47/2.0) + 0.649        # Distance between centroid C3 and C2\n",
      "\n",
      "#calculation\n",
      "A = A1 + A2 + A3                        # Area of entire cross section\n",
      "Qx = (y1*A1) + (y2*A2) - (y3*A3)        # First moment of entire cross section\n",
      "y_bar = Qx/A                            # Distance between x-axis and centroid of the cross section\n",
      "print \"The distance between x-axis and centroid of the cross section is \", round(-y_bar,2), \"inch\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance between x-axis and centroid of the cross section is  1.8 inch\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.5, page no. 840"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation\n",
      "A1 = 6*0.5                          # Partial Area in in2\n",
      "A2 = 20.8                           # from table E1 and E3\n",
      "A3 = 8.82                           # from table E1 and E3\n",
      "y1 = (18.47/2.0) + (0.5/2.0)        # Distance between centroid C1 and C2\n",
      "y2 = 0                              # Distance between centroid C2 and C2\n",
      "y3 = (18.47/2.0) + 0.649            # Distance between centroid C3 and C2\n",
      "\n",
      "#calculation\n",
      "A = A1 + A2 + A3                    # Area of entire cross section\n",
      "Qx = (y1*A1) + (y2*A2) - (y3*A3)    # First moment of entire cross section\n",
      "y_bar = Qx/A                        # Distance between x-axis and centroid of the cross section\n",
      "c_bar = -(y_bar)\n",
      "\n",
      "I1 = (6*0.5**3)/12.0                # Moment of inertia of A1 \n",
      "I2 = 1170                           # Moment of inertia of A2 from table E1\n",
      "I3 = 3.94                           # Moment of inertia of A3 from table E3\n",
      "Ic1 = I1 + (A1*(y1+c_bar)**2)       # Moment of inertia about C-C axis of area C1\n",
      "Ic2 = I2 + (A2*(y2+c_bar)**2)       # Moment of inertia about C-C axis of area C2\n",
      "Ic3 = I3 + (A3*(y3-c_bar)**2)       # Moment of inertia about C-C axis of area C3\n",
      "Ic = Ic1 + Ic2 + Ic3                # Moment of inertia about C-C axis of whole area\n",
      "print \"The moment of inertia of entire cross section area about its centroidal axis C-C\", round(Ic), \"in^4\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The moment of inertia of entire cross section area about its centroidal axis C-C 2200.0 in^4\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.7, page no. 851"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "import numpy\n",
      "\n",
      "#initialisation\n",
      "Ix = 29.29e06                   # Moment of inertia of crosssection about x-axis\n",
      "Iy = 5.667e06                   # Moment of inertia of crosssection about y-axis\n",
      "Ixy = -9.336e06                 # Moment of inertia of crosssection \n",
      "\n",
      "#calculation\n",
      "tp1 = (numpy.degrees(numpy.arctan((-(2*Ixy)/(Ix-Iy)))))/2.0  # Angle definig a Principle axix\n",
      "tp2 = 90 + tp1  \n",
      "print \"The Principle axis is inclined at an angle\", round(tp1,2), \"degree\"\n",
      "print \"Second angle of inclination of Principle axis is\", round(tp2,2), \"degree\"\n",
      "Ix1 = (Ix+Iy)/2.0 + ((Ix-Iy)/2.0)*math.cos(math.radians(tp1)) - Ixy*math.sin(math.radians(tp1))\n",
      "Ix2 = (Ix+Iy)/2.0 + ((Ix-Iy)/2.0)*math.cos(math.radians(tp2)) - Ixy*math.sin(math.radians(tp2))\n",
      "print \"Principle Moment of inertia corresponding to tp1\", round(Ix1), \"mm^4\"\n",
      "print \"Principle Moment of inertia corresponding to tp2\", round(Ix2), \"mm^4\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Principle axis is inclined at an angle 19.16 degree\n",
        "Second angle of inclination of Principle axis is 109.16 degree\n",
        "Principle Moment of inertia corresponding to tp1 31700001.0 mm^4\n",
        "Principle Moment of inertia corresponding to tp2 22420295.0 mm^4\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}