{
 "metadata": {
  "name": "chapter5.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5: Equilibrium of Coplanar Force Systems."
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-1, Page no 58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "# From eqn's 1&2\n",
      "D=np.array([[6/sqrt(40),-4/sqrt(20)],[2/sqrt(40),2/sqrt(20)]])\n",
      "B=np.array([0,25]) #lb\n",
      "\n",
      "#Calculations\n",
      "\n",
      "X=np.linalg.solve(D,B)\n",
      "\n",
      "#Result\n",
      "\n",
      "print'The tension in  cable AB is',round(X[1],1),\"lb\"\n",
      "print'The tension in cable AC is',round(X[0],1),\"lb\"\n",
      "\n",
      "# The tensions in the cable AB & AC is off by 0.1 lb"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The tension in  cable AB is 33.5 lb\n",
        "The tension in cable AC is 31.6 lb\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-2, Page no 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "F1=100 #lb\n",
      "R=16 #in\n",
      "\n",
      "#Calculations\n",
      "theta=arcsin(14*R**-1)*(180/pi) #degrees\n",
      "# since theta=61 degrees,\n",
      "sin61=0.8746\n",
      "cos61=0.4848\n",
      "N=F1/sin61 #lb\n",
      "P=N*cos61 #lb\n",
      "\n",
      "#Result\n",
      "\n",
      "print'The value of normal reaction offered is',round(N,1),\"lb\"\n",
      "print'The push required is',round(P,1),\"lb\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of normal reaction offered is 114.3 lb\n",
        "The push required is 55.4 lb\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-3,Page no 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "L=20 #m\n",
      "M=1200 #kg\n",
      "g=9.81 #m/s**2\n",
      "H=10 #m\n",
      "\n",
      "#Calculations\n",
      "\n",
      "AB=sqrt(L**2-H**2) #Applying Pythagoras Theorem\n",
      "costheta=17.3/20\n",
      "F1=M*g*H/AB #N\n",
      "F2=M*g/costheta #N\n",
      "\n",
      "#Result\n",
      "\n",
      "print'Force F1 is',round(F1),\"N\"\n",
      "print'Force F2 is',round(F2),\"N\"\n",
      "\n",
      "#Decimal accuracy causes discrepancy in answers compared to the textbook answers\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Force F1 is 6797.0 N\n",
        "Force F2 is 13609.0 N\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-4, Page No 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "Fx=1000 #lb\n",
      "Fy=1000 #lb\n",
      "costheta=9*15**-1\n",
      "cosbeta=12*15**-1\n",
      "sintheta=4*5**-1\n",
      "sinbeta=3*5**-1\n",
      "\n",
      "#Calculations\n",
      "#Matrix solution\n",
      "A=np.array([[costheta,-cosbeta],[sintheta,sinbeta]]) \n",
      "B=np.array([-1000,1000])\n",
      "X=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The force in AB is',round(X[0]),\"lb compression\"\n",
      "print'The force in BC is',round(X[1]),\"lb compression\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force in AB is 200.0 lb compression\n",
        "The force in BC is 1400.0 lb compression\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-5, Page no 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "w=10 #lb/ft\n",
      "L=12 #ft\n",
      "# as theta=30 degrees,\n",
      "sin30=2**-1\n",
      "cos30=sqrt(3)*2**-1\n",
      "\n",
      "#Calculation\n",
      "#Matrix Calculations\n",
      "A=np.array([[cos30,-cos30],[sin30,sin30]]) \n",
      "B=np.array([0,120]) \n",
      "X=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The tension in the cable is,T=',round(X[0]),\"lb\"\n",
      "print'The reaction at B is,R',round(X[1]),\"lb\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The tension in the cable is,T= 120.0 lb\n",
        "The reaction at B is,R 120.0 lb\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-6,Page no 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "W1=40 #lb\n",
      "W2=30 #lb\n",
      "# as theta1=30 degrees,\n",
      "sin30=2**-1\n",
      "\n",
      "#Calculations\n",
      "#Summing the forces parallel to 30 degree plane\n",
      "T=W1*sin30\n",
      "theta=arcsin(T/W2)*(180/pi)\n",
      "\n",
      "#Result\n",
      "print'The tension in the cable is',round(T),\"lb\"\n",
      "print'The angle is',round(theta,1),\"degrees\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The tension in the cable is 20.0 lb\n",
        "The angle is 41.8 degrees\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-8,Page no 62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "F1=125 #N\n",
      "F2=200 #N\n",
      "F3=340 #N\n",
      "F4=180 #N\n",
      "x1=4 #m\n",
      "x2=3 #m\n",
      "x3=10 #m\n",
      "x4=15 #m\n",
      "x5=17 #m\n",
      "\n",
      "#Calculations\n",
      "Rb=(-F1*x1+F2*x2+F3*x3+F4*x4)/x5 #moment about point A\n",
      "Ra=(F1*(x1+x5)+F3*(x5-x3)+F2*(x5-x2)+F4*(x5-x4))/x5 #moment about point B\n",
      "\n",
      "#Result\n",
      "print'The reaction at A is',round(Ra),\"N\"\n",
      "print'The reaction at B is',round(Rb),\"N\"\n",
      "\n",
      "# The ans for B is off by 1 N"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reaction at A is 480.0 N\n",
        "The reaction at B is 364.0 N\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-9, Page no 63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "F1=1000 #lb\n",
      "F2=1200 #lb\n",
      "F3=2000 #lb\n",
      "x1=1 #ft\n",
      "x2=7 #ft\n",
      "x4=2 #ft\n",
      "x3=6 #ft\n",
      "\n",
      "#Calculation\n",
      "#Equilibrium equations\n",
      "Rn=(F3*(x1+x2+x3)+F2*(x1+x2)+F1*x1)/(x1+x3+x2+x4) #Moment about point M\n",
      "Rm=(F1*(x2+x3+x4)+F2*(x3+x4)+F3*x4)/(x1+x2+x3+x4) #Moment about point N\n",
      "\n",
      "#Result\n",
      "print'The reaction at M is',round(Rm),\"lb\"\n",
      "print'The reaction at N is',round(Rn),\"lb\"\n",
      "\n",
      "#Decimal Accuracy causes discrepancy in answers between computation and textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reaction at M is 1787.0 lb\n",
        "The reaction at N is 2412.0 lb\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-10, Page no 64"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "P=10 #kg\n",
      "g=9.81 #m/s**2\n",
      "\n",
      "#Calculations\n",
      "# equilibrium at fig b\n",
      "T1=P*g/2 #N\n",
      "# equilibrium at fig c\n",
      "T2=T1/2 #N\n",
      "#equilibrium at fig d\n",
      "P=T2\n",
      "\n",
      "#Result\n",
      "print'The force P is',round(P,1),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force P is 24.5 N\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-11, Page no 64"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "k=20 # lb/in\n",
      "w=20 # lb/ft\n",
      "x1=4 #ft\n",
      "x2=10 # ft\n",
      "x3=8 #ft\n",
      "x4=6 #ft\n",
      "x5=9 #ft\n",
      "F1=1920 #lb.rad\n",
      "F2=3360 #lb.rad\n",
      "\n",
      "#calculations\n",
      "theta=(w*x2*x5)*(F1*x3+F2*(x3+x4))**-1 #radians\n",
      "FB=F1*theta\n",
      "FC=F2*theta\n",
      "A=(w*x2)-FB-FC\n",
      "\n",
      "#Result\n",
      "print'The force in spring B is',round(FB,1),\"lb\"\n",
      "print'The force in spring C is',round(FC,1),\"lb\"\n",
      "print'The reaction at A is',round(A,1),\"lb up\"\n",
      "\n",
      " # The answer waries slightly due to decimal point discrepancy"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force in spring B is 55.4 lb\n",
        "The force in spring C is 96.9 lb\n",
        "The reaction at A is 47.7 lb up\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-12, Page no 65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "L=3.8 #m\n",
      "w=10 # kg/m\n",
      "P=1000 #N\n",
      "t=0.8 #m\n",
      "g=9.81 #m/s**2\n",
      "\n",
      "#Calculations\n",
      "Gf=L*w*g #N\n",
      "A=(P*L+Gf*L*0.5)/t #N Taking moment about point B\n",
      "B=(P*(L-t)+Gf*(0.5*L-t))/t #N Taking moment about point A\n",
      "\n",
      "#Result\n",
      "print'The reaction at point A is',round(A),\"N\"\n",
      "print'The reaction at point B is',round(B),\"N\"\n",
      "\n",
      "# The answers in the textbook are incorrect"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reaction at point A is 5635.0 N\n",
        "The reaction at point B is 4263.0 N\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-13, Page no 65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "Wa=400 #lb\n",
      "Wb=200 #lb\n",
      "# as theta=30 degrees,\n",
      "sin30=2**-1\n",
      "\n",
      "#Calculations\n",
      "Ta=Wa*sin30 #lb\n",
      "Tb=Wb*sin30 #lb\n",
      "#Taking moment about point O\n",
      "P=(Tb*12+Ta*6)/24 #lb\n",
      "\n",
      "#Result\n",
      "print'The value of Ta is',round(Ta,3),\"lb\"\n",
      "print'The value of Tb is',round(Tb,3),\"lb\"\n",
      "print'The value of P is',round(P,3),\"lb\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Ta is 200.0 lb\n",
        "The value of Tb is 100.0 lb\n",
        "The value of P is 100.0 lb\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-15, Page no 66"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "F=np.array([5,2,3,1.5]) #kN Forces are defined as a cloumn matrix\n",
      "theta=(pi*np.array([90,60,45,80]))/180 #degrees angles are also defined as a column matrix\n",
      "d=np.array([2,6,13,17]) #distances from point C of each force\n",
      "c=np.array([17,15,11,4]) #distance form point D of each force\n",
      "#Calculations\n",
      "\n",
      "#Summing horizontal forces\n",
      "Ch=F[1]*cos(theta[1])-F[2]*cos(theta[2])+F[3]*cos(theta[3]) #kN \"which indidcates that Ch acts to the left instead of the assumed\"\n",
      "#Taking moment about point C\n",
      "D=(F[0]*d[0]+F[1]*sin(theta[1])*d[1]+F[2]*sin(theta[2])*d[2]+F[3]*sin(theta[3])*d[3])/d[3] #kN\n",
      "#Taking moment about point D\n",
      "Cv=(F[0]*c[1]+F[1]*sin(theta[1])*c[2]+F[2]*sin(theta[2])*c[3])/c[1]\n",
      "#Result\n",
      "\n",
      "print'The values of Ch,D and Cv are:',round(Ch,2),\"kN ,\",round(D,1),\"kN\",'and',round(Cv,2),\"kN\"\n",
      "\n",
      "# The ans of Cv is incorrect in textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The values of Ch,D and Cv are: -0.86 kN , 4.3 kN and 6.84 kN\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-16, Page no 67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "w=100 #N/m\n",
      "F1=200 #N\n",
      "M=500 #N.m\n",
      "Lw=2 #m\n",
      "#Distance from point A\n",
      "d=np.array([1,2,3,4,5]) #m\n",
      "#Distance from point B\n",
      "b=np.array([5,4,3,2,1]) #m\n",
      "\n",
      "#Calculations\n",
      "#Taking moment aboout point A\n",
      "Rb=(w*Lw*d[0]+F1*d[2]-M)/d[3] #N\n",
      "#Taking moment about point B\n",
      "Ra=(w*Lw*b[2]+F1*b[4]+M)/b[1] #N\n",
      "\n",
      "#Result\n",
      "print'The value of reaction at A is',round(Ra),\"N\"\n",
      "print'The value of reaction at B is',round(Rb),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of reaction at A is 325.0 N\n",
        "The value of reaction at B is 75.0 N\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-18, Page no 68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "# The values of theta are=[60,60,45] degrees, therefore its values are as,\n",
      "costheta2=sqrt(2)**-1\n",
      "sintheta2=sqrt(2)**-1\n",
      "d=np.array([4.46,3.54,2]) #feet defined as a matrix\n",
      "F=400 #lb\n",
      "\n",
      "#Calculations\n",
      "#Taking moment about point A\n",
      "Re=(F*(8-d[1]))/8 #lb\n",
      "Ra=400-Re #lb here i have used the summation of forces in the vertical direction\n",
      "#Taking moment about point B\n",
      "Dv=(-F*3.644)*5.77**-1 #lb\n",
      "#Taking moment about point D\n",
      "Bv=(F*2.126)/5.77 #lb\n",
      "#Taking summation of forces in the vertical direction\n",
      "Cv=-223-Dv #lb\n",
      "#Taking moment about point D\n",
      "Ch=((223*d[2]*costheta2)-(Cv*5.173*costheta2))*(5.173*sintheta2)**-1 #lb\n",
      "#Taking summation of forces in the horizontal direction\n",
      "Dh=-Ch #lb\n",
      "#Taking sum of forces in horizontal direction\n",
      "Bh=-Dh #lb\n",
      "\n",
      "#Result\n",
      "print'The Floor reactions are'\n",
      "print'Ra=',round(Ra),\"lb up\"\n",
      "print'Re=',round(Re),\"lb up\"\n",
      "\n",
      "print'Pin reaction at C on CE are'\n",
      "print'Ch=',round(Ch,1),\"lb to right\"\n",
      "print'Cv=',round(Cv,1),\"lb up\"\n",
      "\n",
      "print'The pin reactions at B on AC are:'\n",
      "print'Bh=',round(Bh,1),\"lb to right\"\n",
      "print'Bv=',round(Bv,1),\"lb down\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Floor reactions are\n",
        "Ra= 177.0 lb up\n",
        "Re= 223.0 lb up\n",
        "Pin reaction at C on CE are\n",
        "Ch= 56.6 lb to right\n",
        "Cv= 29.6 lb up\n",
        "The pin reactions at B on AC are:\n",
        "Bh= 56.6 lb to right\n",
        "Bv= 147.4 lb down\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5-19, Page no 70"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "r=0.5 #m\n",
      "m=10 #kg\n",
      "g=9.81 #m/s**2\n",
      "# since theta=60 degrees,\n",
      "sin30=2**-1\n",
      "cos30=sqrt(3)*2**-1\n",
      "\n",
      "#Calculations\n",
      "#Due to symmetry the reaction will be shared by the structure\n",
      "A=m*g*r #N\n",
      "B=A #N\n",
      "#Vertical forces summed\n",
      "N1=m*g/(2*sin30) #N\n",
      "#Taking moment about point C\n",
      "T=(N1*0.866+B*sin30)*(1.5*cos30)**-1\n",
      "   \n",
      "#Result\n",
      "print'The value of N1 is',round(N1),\"N\"\n",
      "print'The value of T is',round(T,1),\"N\"\n",
      "\n",
      "# The ans for T is off by 0.1 N"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of N1 is 98.0 N\n",
        "The value of T is 84.3 N\n"
       ]
      }
     ],
     "prompt_number": 52
    }
   ],
   "metadata": {}
  }
 ]
}