{
 "metadata": {
  "name": "",
  "signature": "sha256:85f0dfde049627c0712f822039c348c948a05a921a2085135b06fb18242d0e33"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : Analysis of structures"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1  Page No : 294"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Entire truss\n",
      "#Applying sum(M_C) = 0\n",
      "\n",
      "# Given Data\n",
      "E = (10.*12+5*6)/3;\t\t\t#kN\n",
      "#Applying sum Fx = 0\n",
      "Cx = 0.\n",
      "#Applying sumFy = 0\n",
      "Cy = 10.+5-E;\t\t\t#kN\n",
      "\n",
      "# Calculations\n",
      "#At joint A\n",
      "#By proportion 10kN/4 = F_AB/3 = F_AD/5\n",
      "F_AB = 10./4*3;\t\t\t#kN, force in member AB\n",
      "F_DA = 10./4*5;\t\t\t#kN, force in member AD\n",
      "\n",
      "#At joint D\n",
      "F_DB = F_DA;\t\t\t#kN, force in member DB\n",
      "F_DE = 2*3./5*F_DA;\t\t\t#kN, force in member DE\n",
      "\n",
      "#At joint B\n",
      "#applying sumFy = 0\n",
      "F_BE = 5./4*(-5-4./5*F_DB);\t\t\t#kN, force in member BE\n",
      "#Applying sumFx = 0\n",
      "F_BC = F_AB+3./5*F_DB-3./5*F_BE;\t\t\t#kN, force in member BC\n",
      "#At joint E\n",
      "#Applying sumFx = 0\n",
      "F_EC = -5./3*(F_DE-3./5*F_BE);\t\t\t#kN, Force in member EC\n",
      "\n",
      "# Results\n",
      "print \"The forces in member of truss are  F_AB =  %.1f kN T  \\\n",
      "\\nF_AD =  %.1f kN C,  \\\n",
      "\\nF_DB =  %.1f kN T  \\\n",
      "\\nF_DE =  %.0f kN C  \\\n",
      "\\nF_BE =  %.2f kN   \\\n",
      "\\nF_BC =  %.2f kN  \\\n",
      "\\nF_EC =  %.2f kN \"%(F_AB,F_DA,F_DB,F_DE,F_BE,F_BC,F_EC);\n",
      "#Variation in answe because of round off\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forces in member of truss are  F_AB =  7.5 kN T  \n",
        "F_AD =  12.5 kN C,  \n",
        "F_DB =  12.5 kN T  \n",
        "F_DE =  15 kN C  \n",
        "F_BE =  -18.75 kN   \n",
        "F_BC =  26.25 kN  \n",
        "F_EC =  -43.75 kN \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2  Page No : 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given Data\n",
      "#Entire truss\n",
      "v1 = 140.;\t\t\t#kn, verical force 1\n",
      "v2 = 140.;\t\t\t#kN, Vertical force 2\n",
      "h = 80.;\t\t\t#kN , Horizontal force\n",
      "#Applying sum(M_B) = 0\n",
      "J = (v1*4+v2*12+h*5)/16;\t\t\t#kN\n",
      "\n",
      "\n",
      "# Calculations and Results\n",
      "#Applying sum Fx = 0\n",
      "Bx = -h;\t\t\t#kN, negative sign shows it is along negative x axis\n",
      "\n",
      "#Applying sumFy = 0\n",
      "\n",
      "By = v1+v2-J;\t\t\t#kN\n",
      "\n",
      "#Force in member EF\n",
      "#Applying sumFy = 0\n",
      "F_EF = By-v2;\t\t\t#kN, Force in member EF\n",
      "print \"Force in member EF is %.0f kN  Negative sign shows member is in compression \"%(F_EF);\n",
      "\n",
      "#Force in member GI\n",
      "F_GI = (-J*4-Bx*5)/5;\t\t\t#kN Force in member GI\n",
      "print \"Force in member GI is %.0f kN  Negative sign shows member is in compression \"%(F_GI);\n",
      "#Answer difference is because of rounding off variables\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force in member EF is -25 kN  Negative sign shows member is in compression \n",
        "Force in member GI is -52 kN  Negative sign shows member is in compression \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3  Page No : 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given Data\n",
      "#Entire truss\n",
      "vB = 1.;\t\t\t#kN, verical force at B\n",
      "vD = 1.;\t\t\t#kN, verical force at D\n",
      "vF = 1.;\t\t\t#kN, verical force at F\n",
      "vH = 1.;\t\t\t#kN, verical force at H\n",
      "vJ = 1.;\t\t\t#kN, verical force at J\n",
      "vC = 5.;\t\t\t#kN, verical force at C\n",
      "vE = 5.;\t\t\t#kN, verical force at E\n",
      "vG = 5.;\t\t\t#kN, verical force at G\n",
      "h = 8.;\t\t\t#m, height\n",
      "v = 5.;\t\t\t#m, horizontal dismath.tance between successive node\n",
      "\n",
      "A = 12.50;\t\t\t#kN, reaction at A\n",
      "L = 7.50;\t\t\t#kN, reaction at L\n",
      "\n",
      "# Calculations and Results\n",
      "alpha = math.atan(h/3./v);\t\t\t# rad, angle made by inclined members with  X axis\n",
      "#alpha = alpha/math.pi*180;\t\t\t# Conversion of angle into degrees\n",
      "\n",
      "#Force in member GI\n",
      "#Applying sum(M_H) = 0\n",
      "F_GI = (L*2*v-vJ*v)/(2*v*math.tan(alpha));\t\t\t#kN Force in member GI\n",
      "print \"Force in member GI is %.2f kN  \"%(F_GI);\n",
      "\n",
      "#Force in member FH\n",
      "#Applying sum(M_G) = 0\n",
      "F_FH = (L*3*v-vH*v-vJ*2*v)/(-h*math.cos(alpha));\t\t\t#kN, Force in member FH\n",
      "print \"Force in member FH is %.2f kN  Negative sign shows member is in compression \"%(F_FH);\n",
      "\n",
      "#Force in member GH\n",
      "be = math.atan(v/(2*v*math.tan(alpha)));\t\t\t#rad, as math.tan(be) = GI/HI\n",
      "#Applying sum(M_L) = 0\n",
      "F_GH = (-vH*v-vJ*2*v)/(3*v*math.cos(be));\t\t\t#kN, Force in member FH\n",
      "print \"Force in member GH is %.3f kN  Negative sign shows member is in compression \"%(F_GH);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force in member GI is 13.12 kN  \n",
        "Force in member FH is -13.81 kN  Negative sign shows member is in compression \n",
        "Force in member GH is -1.371 kN  Negative sign shows member is in compression \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4  Page No : 319"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Entire truss\n",
      "#Applying sum(Fy) = 0\n",
      "\n",
      "# Given Data\n",
      "Ay = 480.;\t\t\t#N, Y component of reaction at A\n",
      "#Applying sum(M_A) = 0\n",
      "B = 480*100./160;\t\t\t#N,  reaction at B\n",
      "#Applying sum(Fx) = 0\n",
      "Ax = -300.;\t\t\t#N, X component of reaction at A\n",
      "\n",
      "# Calculations and Results\n",
      "alpha = math.atan(80./150);\t\t\t#radian\n",
      "#Free body member BCD\n",
      "#Applying sum(M_C) = 0\n",
      "F_DE = (-480*100.-B*60)/(math.sin(alpha)*250);\t\t\t#N,  Force in link DE\n",
      "print \"Force in link DE is F_DE = %.0f N Negative sign shows force is compressive\"%(F_DE);\n",
      "#Applying sum(Fx) = 0\n",
      "Cx = F_DE*math.cos(alpha)-B;\t\t\t#N, X component of force exerted at C\n",
      "#Applying sum(Fy) = 0\n",
      "Cy = F_DE*math.sin(alpha)+Ay;\t\t\t#N, Y component of force exerted at C\n",
      "print \"Components of force exerted at C is Cx = %.0f N and Cy = %.0f N \"%(Cx,Cy);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force in link DE is F_DE = -561 N Negative sign shows force is compressive\n",
        "Components of force exerted at C is Cx = -795 N and Cy = 216 N \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5  Page No : 320"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Given Data\n",
      "P = 18.;\t\t\t#kN, Force applied at D\n",
      "AF = 3.6;\t\t\t#m, Length AF\n",
      "EF = 2.;\t\t\t#m, Length EF\n",
      "ED = 2.;\t\t\t#m, Length ED\n",
      "DC = 2.;\t\t\t#m, Length DC\n",
      "#Entire frame\n",
      "\n",
      "# Calculations and Results\n",
      "#Applying sum(M_F) = 0\n",
      "Ay = -P*(EF+ED)/AF;\t\t\t#kN, Y component of reaction at A\n",
      "\n",
      "#Applying sum(Fx) = 0\n",
      "Ax = -P;\t\t\t#kN, X component of reaction at A\n",
      "#Applying sum(Fy) = 0\n",
      "F = -Ay;\t\t\t#kN,  reaction at B\n",
      "\n",
      "print \"Components of force exerted at A is Ax = %.0f kN and Ay = %.0f kN \"%(Ax,Ay);\n",
      "print \"Force exerted at F is F = %.0f kN \"%(F);\n",
      "#Free body member BE\n",
      "#Applying sum(Fx) = 0\n",
      "#B = E, and as it is 2 force member\n",
      "By = 0;\n",
      "Ey = 0;\n",
      "\n",
      "#Member ABC\n",
      "#Applying sum(Fy) = 0\n",
      "Cy = -Ay;\t\t\t#kN, Y component of force exerted at C\n",
      "#Applying sum(M_C) = 0\n",
      "B = (Ay*AF-Ax*(DC+ED+EF))/(ED+DC);\t\t\t#kN,  Force in link DE\n",
      "print \"Force exerted at B is B = %.0f kN  \"%(B);\n",
      "#Applying sum(Fx) = 0\n",
      "Cx = -Ax-B;\t\t\t#kN, X component of force exerted at C\n",
      "\n",
      "print \"Components of force exerted at C is Cx = %.0f kN and Cy = %.0f kN \"%(Cx,Cy);\n",
      "print \"Negative signs shows forces are in negative direction\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Components of force exerted at A is Ax = -18 kN and Ay = -20 kN \n",
        "Force exerted at F is F = 20 kN \n",
        "Force exerted at B is B = 9 kN  \n",
        "Components of force exerted at C is Cx = 9 kN and Cy = 20 kN \n",
        "Negative signs shows forces are in negative direction\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6  Page No : 320"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy.linalg import solve\n",
      "\n",
      "# Given Data\n",
      "P = 3.;\t\t\t#kN, Horizontal Force applied at A\n",
      "AB = 1.;\t\t\t#m, perpendicular dismath.tance between A and B\n",
      "BD = 1.;\t\t\t#m, perpendicular dismath.tance between D and B\n",
      "CD = 1.;\t\t\t#m, perpendicular dismath.tance between C and D\n",
      "FC = 1.;\t\t\t#m, perpendicular dismath.tance between C and F\n",
      "EF = 2.4;\t\t\t#m, perpendicular dismath.tance between E and F\n",
      "#Entire frame\n",
      "\n",
      "# Calculations\n",
      "#Applying sum(M_E) = 0\n",
      "Fy = P*(AB+BD+CD+FC)/EF;\t\t\t#kN, Y component of reaction at F\n",
      "\n",
      "\n",
      "#Applying sum(Fy) = 0\n",
      "Ey = -Fy;\t\t\t#kN, Y component of  reaction at E\n",
      "\n",
      "#Free body member ACE\n",
      "#Applying sum(Fy) = 0, and sum(M_E) = 0 we get 2 equation\n",
      "A = [[-AB/math.sqrt(AB**2+EF**2) ,CD/math.sqrt(CD**2+EF**2) ] , [ -EF/math.sqrt(AB**2+EF**2)*(AB+BD+CD+FC) , -EF/math.sqrt(CD**2+EF**2)]];\t\t\t# Matrix of coefficients\n",
      "B = [[Ey],[-P*(AB+BD+CD+FC)]];\t\t\t# Matrix B\n",
      "X = solve(A,B);\t\t\t#kN Solution matrix\n",
      "F_AB = X[0];\t\t\t#kN, Forec inmember AB\n",
      "F_CD = X[1];\t\t\t#kN, Forec inmember CD\n",
      "Ex = -P-EF/math.sqrt(AB**2+EF**2)*F_AB-EF/math.sqrt(CD**2+EF**2)*F_CD;\t\t\t#kN, X component of force exerted at E\n",
      "#Free body : Entire frame\n",
      "#Applying sum(F_X) = 0\n",
      "Fx = -P-Ex;\t\t\t#kN, X component of force exetered at F\n",
      "print \"Components of force exerted at F is Fx = %.1f kN and Fy = %.0f kN \"%(Fx,Fy);\n",
      "print \"Force in member AB is F_AB = %.1f kN \"%(F_AB);\n",
      "print \"Force in member CD is F_CD = %.1f kN \"%(F_CD);\n",
      "print \"Components of force exerted at E is Ex = %.1f kN and Ey = %.1f kN \"%(Ex,Ey);\n",
      "\n",
      "print \"Negative signs shows forces are in negative direction\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Components of force exerted at F is Fx = -2.4 kN and Fy = 5 kN \n",
        "Force in member AB is F_AB = 5.2 kN \n",
        "Force in member CD is F_CD = -7.8 kN \n",
        "Components of force exerted at E is Ex = -0.6 kN and Ey = -5.0 kN \n",
        "Negative signs shows forces are in negative direction\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}