{
 "metadata": {
  "name": "",
  "signature": "sha256:6614da64c21b5a021bafa936588cfa8061044b57a7af33fe7a25f2c248f44683"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 : Equilibrium of rigid bodies"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1  Page No : 166"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy.linalg import norm\n",
      "\n",
      "# Calculations and Results\n",
      "#Determination of B\n",
      "#At equillibrium +sum(M_A) = 0\n",
      "#B*1.5m-(9.81kN)(2 m)-(23.5 kN)(6 m) = 0, B assumed to be in +ve X direction\n",
      "B = (9.81*2+23.5*6)/1.5\t\t\t#kN\n",
      "print \"B = %.2f kN  +ve sign shows reaction is directed as assumed \"%(B);\n",
      "#Determination of Ax\n",
      "#Sum Fx = 0\n",
      "#Ax+B = 0\n",
      "Ax = -B;\t\t\t#kN\n",
      "print \"Ax = %.2f kN\"%(Ax);\n",
      "#Determination of Ay\n",
      "#Sum Fy = 0\n",
      "#Ay-9.81 kN-23.5kN = 0\n",
      "Ay = 9.81+23.5;\t\t\t#kN\n",
      "print \"Ay = %.2f kN\"%(Ay);\n",
      "A = [Ax,Ay];\t\t\t#kN Adding component\n",
      "A = norm(A);\t\t\t#Magnitude of force A\n",
      "theta = math.atan(Ay/Ax);\t\t\t#radians\n",
      "theta = theta*180/math.pi;\t\t\t#degrees, conversion into degrees\n",
      "print \"Reaction at A is A = %.2f kN making angle %.2f degrees  with + ve x axis \"%(A,theta);\n",
      "#Slight variation in the answer because of roundoff error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "B = 107.08 kN  +ve sign shows reaction is directed as assumed \n",
        "Ax = -107.08 kN\n",
        "Ay = 33.31 kN\n",
        "Reaction at A is A = 112.14 kN making angle -17.28 degrees  with + ve x axis \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2  Page No : 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given Data\n",
      "#At equillibrium equations are +-> sum Fx = 0, +sum(M_A) = 0, +sum(M_B) = 0\n",
      "#Sum Fx = 0 gives\n",
      "Bx = 0;\t\t\t#kN\n",
      "\n",
      "# Calculations and Results\n",
      "print \"Bx = %.0f kN \"%(Bx);\n",
      "#+sum(M_A) = 0 gives -(70kN)(0.9m)+By(2.7m)-(27kN)(3.3m)-(27kN)(3.9m) = 0, B assumed to be in +ve Y direction\n",
      "By = (70*0.9+27*3.3+27*3.9)/2.7\t\t\t#kN\n",
      "print \"By = %.2f kN  +ve sign shows reaction is directed as assumed \"%(By);\n",
      "\n",
      "#+sum(M_B) = 0 gives -A(2.7m)+(70kN)(1.8m)-(27kN)(0.6m)-(27kN)(1.2m) = 0, A assumed to be in +ve Y direction\n",
      "A = (70*1.8-27*0.6-27*1.2)/2.7\t\t\t#kN\n",
      "print \"A = %.2f kN  +ve sign shows reaction is directed as assumed \"%(A);\n",
      "#Answer print layed in KN\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bx = 0 kN \n",
        "By = 95.33 kN  +ve sign shows reaction is directed as assumed \n",
        "A = 28.67 kN  +ve sign shows reaction is directed as assumed \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3  Page No : 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given Data\n",
      "#Take x axis parallel to track and Y axis perpendicular to track\n",
      "W = 25.;\t\t\t#kN\n",
      "# Resolving weight\n",
      "Wx = W*math.cos(25*math.pi/180);\t\t\t#kN\n",
      "Wy = -W*math.sin(25*math.pi/180);\t\t\t#kN\n",
      "#At equillibrium equations are +-> sum Fx = 0, +sum(M_A) = 0, +sum(M_B) = 0\n",
      "\n",
      "# Calculations and Results\n",
      "#+sum(M_A) = 0 gives -(10.5kN)(625 mm)-(22.65 kN)(150 mm)+ R2(1250 mm) = 0, R2 assumed to be in +ve Y direction\n",
      "R2 = (10.5*625+22.65*150.)/1250;\t\t\t#kN\n",
      "print \"R2 = %.0f kN  +ve sign shows reaction is directed as assumed \"%(R2);\n",
      "\n",
      "#+sum(M_B) = 0 gives (10.5kN)(625 mm)-(22.65 kN)(150 mm)+ R1(1250 mm) = 0, R1 assumed to be in +ve Y direction\n",
      "R1 = (10.5*625-22.65*150)/1250;\t\t\t#kN\n",
      "print \"R1 = %.1f kN  +ve sign shows reaction is directed as assumed \"%(R1);\n",
      "\n",
      "#Sum Fx = 0 gives, 22.65 N-T = 0\n",
      "T = 22.65;\t\t\t#kN\n",
      "print \"T = %.2f kN  +ve sign shows reaction is directed as assumed \"%(T);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R2 = 8 kN  +ve sign shows reaction is directed as assumed \n",
        "R1 = 2.5 kN  +ve sign shows reaction is directed as assumed \n",
        "T = 22.65 kN  +ve sign shows reaction is directed as assumed \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4  Page No : 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given Data\n",
      "Ax = 4.5\t\t\t#in m\n",
      "Ay = 6.\t\t\t#in m\n",
      "\n",
      "# Calculations and Results\n",
      "DF = math.sqrt((Ax**2)+(Ay**2))\n",
      "F = 150.\t\t\t#in KN\n",
      "Ex = -(Ax/DF)*F\n",
      "print \"Ex = %.2f kN \"%(Ex);\n",
      "Ey = ((Ay/DF)*F)+(4*20)\n",
      "print \"Ey = %.2f kN \"%(Ey);\n",
      "\n",
      "M_E = -((20*7.2)+(20*5.4)+(20*3.6)+(20*1.8)-((Ay/DF)*F*Ax))\n",
      "print \"M_E = %.0f kN  +ve sign shows reaction is directed as assumed \"%(M_E);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ex = -90.00 kN \n",
        "Ey = 200.00 kN \n",
        "M_E = 180 kN  +ve sign shows reaction is directed as assumed \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5  Page No : 169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import arange\n",
      "\n",
      "# Given Data\n",
      "#At equillibrium  +sum(Mo) = 0,\n",
      "#s = r*theta;\n",
      "#F = k*s = k*r*theta;\n",
      "k = 45.;\t\t\t#N/mm\n",
      "r = 75.;\t\t\t#mm\n",
      "W = 1800.;\t\t\t#N\n",
      "l = 200.;\t\t\t#mm\n",
      "\n",
      "\n",
      "# Calculations and Results\n",
      "# trial and error \n",
      "print \"Probable answers by trial and error method are \";\n",
      "for i in arange(0,0.1+math.pi/2,.1): \t\t\t# from 0 to 90 degrees\n",
      "    difference = (math.sin(i)-k*r**2*(i)/(W*l));\n",
      "    if difference<0.01:   \t\t\t# Approximation\n",
      "        theta = i;\n",
      "        theta = theta*180/math.pi;\t\t\t#Degrees , conversion into degrees\n",
      "        print \"Theta = %.2f degrees\"%(theta); \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Probable answers by trial and error method are \n",
        "Theta = 0.00 degrees\n",
        "Theta = 80.21 degrees\n",
        "Theta = 85.94 degrees\n",
        "Theta = 91.67 degrees\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6  Page No : 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given Data\n",
      "m = 10.;\t\t\t#kg mass of joist\n",
      "g = 9.81;\t\t\t#m/s**2 gravitational acceleration\n",
      "W = m*g;\t\t\t#N\n",
      "AB = 4.;\t\t\t#m\n",
      "\n",
      "# Calculations\n",
      "# Three force body\n",
      "BF = AB*math.cos(45*math.pi/180);\t\t\t#m\n",
      "AF = BF;\t\t\t#m\n",
      "\n",
      "AE = 1./2*AF;\t\t\t#m\n",
      "EF = AE;\t\t\t#m\n",
      "CD = AE;\t\t\t#m\n",
      "BD = CD/math.tan((45.+25)*math.pi/180);\t\t\t#m\n",
      "DF = BF-BD;\t\t\t#m\n",
      "CE = DF;\t\t\t#m\n",
      "alpha = math.atan(CE/AE);\t\t\t#radians\n",
      "alpha = alpha*180/math.pi;\t\t\t#degrees\n",
      "\n",
      "#From geometry\n",
      "\n",
      "G = 90-alpha;\t\t\t#degrees\n",
      "B = alpha-(90-(45+25));\t\t\t#degrees\n",
      "C = 180-(G+B);\t\t\t#Degrees\n",
      "\n",
      "#Force triangle\n",
      "#T/math.sin(G) = R/math.sin(C) = W/math.sin(B)..... math.sine law\n",
      "\n",
      "T = W/math.sin(B*math.pi/180)*math.sin(G*math.pi/180);\t\t\t#N\n",
      "R = W/math.sin(B*math.pi/180)*math.sin(C*math.pi/180);\t\t\t#N\n",
      "\n",
      "# Results\n",
      "print \"Tension in cable T =  %.1f N \\\n",
      "\\nReaction At A is  R =  %.1f N with angle alpha =  %.1f degrees with +ve X axis\"%(T,R,alpha); \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Tension in cable T =  82.1 N \n",
        "Reaction At A is  R =  147.9 N with angle alpha =  58.6 degrees with +ve X axis\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7  Page No : 194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given Data\n",
      "m1 = 80.;\t\t\t#kg mass of man\n",
      "m2 = 20.;\t\t\t#kg, mass of ladder\n",
      "m = m1+m2;\t\t\t#kg\n",
      "g = 9.81;\t\t\t#m/s**2 gravitational acceleration\n",
      "W = -m*g;\t\t\t#N, j\n",
      "\n",
      "# Calculations and Results\n",
      "C = -0.6*W/3;\t\t\t#N\n",
      "Bz = -0.6*C/1.2;\t\t\t#N\n",
      "By = -0.9*W/1.2;\t\t\t#N\n",
      "\n",
      "print \" Reaction At B is B =  %.0f) N j +%.1f N)k\"%(By,Bz);\n",
      "print \" Reaction At C is C =  %.2f) N k\"%(C);  \n",
      "Ay = -W-By;\t\t\t#N\n",
      "Az = -C-Bz;\t\t\t#N\n",
      "\n",
      "print \" Reaction At A is A =  %.0f) N j +%.1f N)k \"%(Ay,Az); "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Reaction At B is B =  736) N j +-98.1 N)k\n",
        " Reaction At C is C =  196.20) N k\n",
        " Reaction At A is A =  245) N j +-98.1 N)k \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8  Page No : 0"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy.linalg import solve\n",
      "\n",
      "# Given Data\n",
      "W = -1200.;\t\t\t#N,j  Weight \n",
      "BD = [-2.4,1.2,-2.4];\t\t\t#m, Vector BD\n",
      "EC = [-1.8,0.9,0.6];\t\t\t#m, Vector EC\n",
      "#T_BD = norm(T_BD)*BD/norm(BD);\t\t\t# m, vector of tension in BD\n",
      "#T_EC = norm(T_EC)*EC/norm(EC);\t\t\t# m, vector of tension in EC\n",
      "# Applying equillibrium conditions we get\n",
      "# Sum_F = 0, and Sum(M_A) = 0 and setting co-efficient equal to zero\n",
      "A = [[0.8,0.771],[1.6,-0.514]];\t\t\t#MAtrix of co-efficient\n",
      "b = [[-1440],[0]];\t\t\t#matrix b\n",
      "\n",
      "# Calculations and Results\n",
      "x = solve(A,b);\t\t\t# solution matrix\n",
      "T_BD = x[0];\t\t\t# N,Tension in BD\n",
      "T_EC = x[1];\t\t\t#N, Tension in EC\n",
      "print \"T_BD =  %.0f N and T_EC =  %.0f N \"%(x[0],x[1]);\n",
      "\n",
      "Ax = 2./3*T_BD+6./7*T_EC;\t\t\t#N, x component of reaction at A\n",
      "Ay = -(1./3*T_BD+3./7*T_EC+W);\t\t\t#N, Y component of rection at A\n",
      "Az = 2./3*T_BD-2./7*T_EC;\t\t\t#N, z component of reaction at A\n",
      "print \"Reaction at A is A = %.0f N)i +%.0f N)j +%.1f N)k \"%(Ax,Ay,Az);\n",
      "#Answe in Newton instead of lbs\n",
      "#1lbs = 4.44N\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T_BD =  -450 N and T_EC =  -1401 N \n",
        "Reaction at A is A = -1501 N)i +1950 N)j +100.2 N)k \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9  Page No : 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy.linalg import norm\n",
      "from numpy import array\n",
      "\n",
      "# Given Data\n",
      "#Free body diagram\n",
      "m = 30.\t\t\t#in kg\n",
      "g = 9.81\t\t\t#in m/s2\n",
      "w = -m*g\t\t\t#in J\n",
      "\n",
      "# Calculations and Results\n",
      "DC = array([-480, 240, -160])\t\t\t#in mm\n",
      "X = norm(DC)\n",
      "T = DC/X\n",
      "print (\"Tension in the vector form = \")\n",
      "print (T)\n",
      "#Equilibrium equations\n",
      "#From equation 2, setting unit vector = 0\n",
      "Ax = 49\t\t\t#in N\n",
      "Ay = 73.5\t\t\t#in N\n",
      "A = [Ax, Ay]\n",
      "y = norm(A)\n",
      "print (\"Tension in the vector form in N = \")\n",
      "print (y)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Tension in the vector form = \n",
        "[-0.85714286  0.42857143 -0.28571429]\n",
        "Tension in the vector form in N = \n",
        "88.3360062489\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10  Page No : 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import array\n",
      "#page 197\n",
      "\n",
      "# Given Data\n",
      "Tmin = 300.\t\t\t#lb\n",
      "AC = array([12, 12, 0])\n",
      "w = array([[0],[-450],[0]])\n",
      "x1 = AC*w\n",
      "print (x1)\n",
      "x = x1#array([0, 0, x1])\n",
      "\n",
      "# Calculations\n",
      "lambda1 = array([2./3, 2./3, -1./3])*-x1#array([[0],[0],[-x1]])\n",
      "y = x*lambda1\n",
      "print (y)\n",
      "\n",
      "#Location of G\n",
      "#EG and Tmin are having same direction, so their component should be in proportion\n",
      "x = -1.8/Tmin*Tmin+1.8;\t\t\t#m, X co-ordinate of G\n",
      "y = -1.8/Tmin*Tmin+3.6;\t\t\t#m, Y co-ordinate of G\n",
      "\n",
      "# Results\n",
      "print \"Co-ordinates of G are x = %.0f m and y =  %.1f m\"%(x,y);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[[    0     0     0]\n",
        " [-5400 -5400     0]\n",
        " [    0     0     0]]\n",
        "[[        0.         0.        -0.]\n",
        " [-19440000. -19440000.        -0.]\n",
        " [        0.         0.        -0.]]\n",
        "Co-ordinates of G are x = 0 m and y =  1.8 m\n"
       ]
      }
     ],
     "prompt_number": 19
    }
   ],
   "metadata": {}
  }
 ]
}