{
 "metadata": {
  "name": "chapter6.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6: Equilibrium of Non Coplanar Force Systems "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-1, Page no 81"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "H=30 #ft\n",
      "F=150 #lb\n",
      "# Here theta1=10, theta2=30 & theta3=60 degrees. Thus the values are,\n",
      "sin10=0.1736\n",
      "cos10=0.9848\n",
      "sin30=2**-1\n",
      "cos30=sqrt(3)*2**-1\n",
      "sin60=sqrt(3)*2**-1\n",
      "cos60=2**-1\n",
      "\n",
      "#Calculations\n",
      "#Matrix solution of simultaneous equations\n",
      "X=np.array([[cos60*sin30, -cos60*sin30],[cos60*cos30, cos60*cos30]]) \n",
      "Y=np.array([[0],[F*cos10]]) \n",
      "R=np.linalg.solve(X,Y)\n",
      "#To find P,sum the forces vertically along the y-axis\n",
      "P=F*sin10+2*R[0]*sin60 #lb Compression\n",
      "\n",
      "#Result\n",
      "print'The value of A and B is',round(R[0]),\"lb (T)\"\n",
      "print'The value of P is',round(P),\"lb (C)\"\n",
      "\n",
      "# The value of P is off by 1 lb"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of A and B is 171.0 lb (T)\n",
        "The value of P is 321.0 lb (C)\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-2, Page no 82"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "#Initilization of variables\n",
      "F=150 #lb\n",
      "# Here theta1=10, theta2=30 & theta3=60 degrees. Thus the values are,\n",
      "sin10=0.1736\n",
      "cos10=0.9848\n",
      "sin30=2**-1\n",
      "cos30=sqrt(3)*2**-1\n",
      "sin60=sqrt(3)*2**-1\n",
      "cos60=2**-1\n",
      "\n",
      "#Calculations\n",
      "A=[-cos60*cos30,-sin60,cos60*sin30] \n",
      "B=[-cos60*cos60,-sin60,cos60*sin30]\n",
      "# 150lb force is actually a vector\n",
      "F_v=[F*cos10,F*sin10,0] #lb\n",
      "#Postion vector relative to C \n",
      "r=[0,30,0]\n",
      "# Moment about point C is zero\n",
      "#solution by matrix\n",
      "X=np.array([[7.5,-7.5],[13,13]]) \n",
      "Y=np.array([[0],[4470]]) \n",
      "R=np.linalg.solve(X,Y)\n",
      "A=R[0] #lb\n",
      "B=R[1] #lb\n",
      "#Summing forces in y direction\n",
      "Cy=0.866*A+0.866*B+25.9 #lb\n",
      "\n",
      "#Result\n",
      "print'The value of A and B is',round(A),\"lb\"\n",
      "print'The value of Cy is',round(Cy),\"lb\"\n",
      "\n",
      "# The answer may wary due to decimal point descripancy in computation"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of A and B is 172.0 lb\n",
        "The value of Cy is 324.0 lb\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-3, Page no 82"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initililization of variables\n",
      "m=6.12 #kg\n",
      "g=9.81 #m/s**2\n",
      "\n",
      "#Calculations\n",
      "AD=sqrt(3**2+2**2+6**2) \n",
      "AC=sqrt(4**2+2**2)\n",
      "AB=5\n",
      "#Sum of forces in the y direction\n",
      "T1=(m*g*AD)/6 #N\n",
      "#sum of forces in the x and z direction\n",
      "#Matrix solution of the folllowing simultaneous equations\n",
      "X=np.array([[4*4.47**-1,-3*5**-1],[-2*4.47**-1,4*5**-1]])\n",
      "Y=np.array([[T1*(3*7**-1)],[T1*(2*7**-1)]]) \n",
      "R=np.linalg.solve(X,Y)\n",
      "T2=R[0] #N\n",
      "T3=R[1] #N\n",
      "\n",
      "#Result\n",
      "print'The value of T1 is',round(T1),\"N\"\n",
      "print'The value of T2 is',round(T2,1),\"N\"\n",
      "print'The vaue of T3 is',round(T3),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of T1 is 70.0 N\n",
        "The value of T2 is 80.5 N\n",
        "The vaue of T3 is 70.0 N\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-4, Page no 83"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Intilization of variables\n",
      "\n",
      "F=np.array([0,60,0]) #Force defined as a matrix\n",
      "t1=np.array([-3*7**-1,6*7**-1,2*7**-1]) #Tension defined as a matrix\n",
      "t2=np.array([4*4.47**-1,0,-2*4.47**-1]) #tension defined as a mtrix\n",
      "t3=np.array([-3*5**-1,0,4*5**-1]) #Tension defined as a matrix\n",
      "\n",
      "#Calculations\n",
      "#Summation of forces in the y-direction\n",
      "T1=F[1]*(t1[1]**-1) #N\n",
      "#Summation of forces in the x-direction and z direction\n",
      "M1=np.array([[t2[0],t3[0]],[t2[2],t3[2]]])\n",
      "M2=np.array([[-1*t1[0]*T1],[t1[2]*T1]]) \n",
      "R=np.linalg.solve(M1,M2)\n",
      "\n",
      "#Result\n",
      "print'The tension in the strings are: T1=',round(T1),\"N\",',T2=',round(R[0],1),\"N\",'and T3=',round(R[1]),\"N respectively\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The tension in the strings are: T1= 70.0 N ,T2= 80.5 N and T3= 70.0 N respectively\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-5, Page no 84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "m=80 #kg\n",
      "g=9.81 # m/s**2\n",
      "#Co-ordinates of points in Meters\n",
      "A=np.array([1,3,0])\n",
      "B=np.array([3,3,-4])\n",
      "C=np.array([4,3,0])\n",
      "D=np.array([2,0,-1])\n",
      "\n",
      "#Calculations\n",
      "#Tension in DC will be\n",
      "a=np.array([[C[0]-D[0]],[C[1]-D[1]],[C[2]-D[2]]])\n",
      "h=((C[0]-D[0])**2+(C[1]-D[1])**2+(C[2]-D[2])**2)**0.5\n",
      "c=a*h**-1\n",
      "#Unit vector calculations\n",
      "e=np.array([[B[0]-A[0]],[B[1]-A[1]],[B[2]-A[2]]])\n",
      "v=((B[0]-A[0])**2+(B[1]-A[1])**2+(B[2]-A[2])**2)**0.5\n",
      "e_ab=e*v**-1\n",
      "#Position vector AD\n",
      "r_ad=np.array([[D[0]-A[0]],[D[1]-A[1]],[D[2]-A[2]]])\n",
      "#Moment Calculations\n",
      "O=np.array([[1,0,0],[1,-3,-1],[0,-m*g,0]])\n",
      "P=np.array([[0,1,0],[1,-3,-1],[0,-m*g,0]])\n",
      "Q=np.array([[0,0,1],[1,-3,-1],[0,-m*g,0]])\n",
      "C1=np.array([[1,0,0],[1,-3,-1],[2,3,1]])\n",
      "C2=np.array([[0,1,0],[1,-3,-1],[2,3,1]])\n",
      "C3=np.array([[0,0,1],[1,-3,-1],[2,3,1]])\n",
      "rxF1=np.array([[det(O),det(P),det(Q)]])\n",
      "rxF2=np.array([(det(C1)*h**-1),(det(C2)*h**-1),(det(C3)*h**-1)])\n",
      "#Final Moment calculations\n",
      "rxF=rxF1+rxF2 \n",
      "#Taking dot product\n",
      "dot1=e_ab*rxF\n",
      "dot2=e_ab*rxF2\n",
      "#equating dot product to zero to obtain C\n",
      "C=-(dot1[0,0]+dot1[2,2])/dot2[2,2]\n",
      "\n",
      "#Result \n",
      "print'The tension in CD is',round(C),\"N\"\n",
      "\n",
      "# The ans is off by 1 N due to Decimal point descrepancy. "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The tension in CD is 162.0 N\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-6, Page no 85"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "w=200 #lb\n",
      "Dh=4 #ft\n",
      "\n",
      "#Calculation\n",
      "theta=arctan(2*Dh**-1)*(180/pi) #degrees\n",
      "T=w/(3*cos(theta)) #lb\n",
      "\n",
      "#Result\n",
      "print'The Tension in each rope is',round(T,1),\"lb\"\n",
      "print'The angle is',round(theta,1),\"degrees\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Tension in each rope is 482.9 lb\n",
        "The angle is 26.6 degrees\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-7, Page no 85"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "F=np.array([100,0,0]) #N\n",
      "CE=5 #m\n",
      "BC=(34)**0.5 #m\n",
      "AC=(41)**0.5 #m\n",
      "\n",
      "#Calculations\n",
      "#solving as a matrix for system of linear equations\n",
      "A=np.array([[3*BC**-1,-4*AC**-1,0],[0,0,(6*4)*CE**-1],[-3*BC**-1,-3*AC**-1,-3*CE**-1]])\n",
      "B=np.array([[0],[F[0]*4],[-F[0]]])\n",
      "C=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The forces F1,F2 and F3 are as',round(C[0],1),\"N\",',',round(C[1],1),\"N\",'and',round(C[2],1),\"N\"\n",
      "print'Here F3 is compression assumed and rest are Tension'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forces F1,F2 and F3 are as 55.5 N , 45.7 N and 83.3 N\n",
        "Here F3 is compression assumed and rest are Tension\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-8, Page no 85"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "F=np.array([100,0,0]) #N\n",
      "CE=5 #m\n",
      "BC=(34)**0.5 #m\n",
      "AC=(41)**0.5 #m\n",
      "\n",
      "#Calculations\n",
      "#solving as a matrix for system of linear equations\n",
      "A=np.array([[3/BC,-4/AC,0],[-4/BC,-4/AC,4*CE**-1],[-3/BC,-3/AC,-3*CE**-1]])\n",
      "B=np.array([[0],[0],[-F[0]]])\n",
      "C=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The forces are: F1=',round(C[0],1),\"N\",',F2=',round(C[1],1),\"N\",'and F3=',round(C[2],1),\"N\"\n",
      "print'Here F3 is compression assumed and rest are Tension'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forces are: F1= 55.5 N ,F2= 45.7 N and F3= 83.3 N\n",
        "Here F3 is compression assumed and rest are Tension\n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-9, Page no 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "#here forces will be defines as matrices along with their co-ordinates\n",
      "#Force in N and co-ordinates in mm\n",
      "F1=[30,200,300] \n",
      "F2=[10,400,200]\n",
      "F3=[20,200,500]\n",
      "F4=[50,400,500]\n",
      "#Calculations\n",
      "#solving as system of linear equations\n",
      "A=np.array([[1,1,1],[-600,-600,0],[0,600,600]])\n",
      "B=np.array([[F1[0]+F2[0]+F3[0]+F4[0]],[-(F3[0]*F3[2]+F1[0]*F1[2]+F4[0]*F4[2]+F2[0]*F2[2])],[-(-F3[0]*F3[1]-F1[0]*F1[1]-F4[0]*F4[1]-F2[0]*F2[1])]])\n",
      "C=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The reactions are as R1=',round(C[0],1),\"N\",',R2=',round(C[1],1),\"N\",'and R3=',round(C[2],1),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reactions are as R1= 53.3 N ,R2= 23.3 N and R3= 33.3 N\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-10, Page no87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "m=1 #kg\n",
      "g=9.81 #m/s**2\n",
      "# As t1=45 degrees and t2=30 degrees\n",
      "cost1=sqrt(2)**-1\n",
      "cost2=sqrt(3)*2**-1\n",
      "\n",
      "#Calculations\n",
      "#Solving as system of linear equations\n",
      "A=np.array([[1,0,-cost1,0],[0,1,0,3*5**-1],[-5,g*m*cost1*cost2,0,0],[-1,0,0,4*5**-1]])\n",
      "B=np.array([[0],[g*m],[g*m*5*cost1*cost2],[0]])\n",
      "C=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The forces are: Nb=',round(C[0],1),',Nc=',round(C[1],1),',Tc=',round(C[2],1),'and Tb=',round(C[3],1),\"respectively\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forces are: Nb= 3.0 ,Nc= 7.5 ,Tc= 4.3 and Tb= 3.8 respectively\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-11, Page no 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "w=50 #lb wind load\n",
      "W=60 #lb weight of door\n",
      "\n",
      "#Calculations\n",
      "#Calculation as system of linear equations\n",
      "A=np.array([[0,0,33],[1,1,-1],[28,10,-28]])\n",
      "B=np.array([[50*18],[-50],[-50*24]])\n",
      "C=np.linalg.solve(A,B)\n",
      "P=C[2]*(cos(20*pi*180**-1))**-1\n",
      "D=np.array([[-28,-10],[1,1]])\n",
      "E=np.array([1080-(28*(P*sin((20*pi)*180**-1))),P*sin((20*pi)*180**-1)])\n",
      "F=np.linalg.solve(D,E)\n",
      "By=60\n",
      "\n",
      "#Result\n",
      "print'The forces are as follows:'\n",
      "print'Az=',round(C[0],1),\"lb\",',Bz=',round(C[1],1),\"lb\",',Pz=',round(C[2],1),\"lb\",',Ax=',round(F[0]),\"lb\",',Bx=',round(F[1]),\"lb\",'and By=',round(By),\"lb respectively.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forces are as follows:\n",
        "Az= -11.6 lb ,Bz= -11.1 lb ,Pz= 27.3 lb ,Ax= -50.0 lb ,Bx= 60.0 lb and By= 60.0 lb respectively.\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-12, Page no 89"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "m=1 #kg\n",
      "g=9.81 #m/s**2\n",
      "# Since t1=45 degrees and t2=30 degrees\n",
      "cost1=sqrt(2)**-1\n",
      "cost2=sqrt(3)*2**-1\n",
      "\n",
      "#Calculations\n",
      "#Solving as system of linear equations\n",
      "A=np.array([[1,0,-cost1,0],[0,1,0,3*5**-1],[-5,g*m*cost1*cost2,0,0],[-1,0,0,4*5**-1]])\n",
      "B=np.array([[0],[g*m],[g*m*5*cost1*cost2],[0]])\n",
      "C=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The forces are: Nb=',round(C[0],2),\"N\",',Nc=',round(C[1],2),\"N\",',Tc=',round(C[2],2),\"N\",'and Tb=',round(C[3],2),\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The forces are: Nb= 3.04 N ,Nc= 7.53 N ,Tc= 4.3 N and Tb= 3.8 N\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-13, Page no 89"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "l=200 #lb\n",
      "cos25=0.9063\n",
      "sin25=0.4226\n",
      "\n",
      "#Calculations\n",
      "P=l*5*12**-1 #lb\n",
      "#Solving as system of linear equations\n",
      "A=np.array([[0,-36,0,0],[0,0,0,36],[0,0,1,1],[1,1,0,0]])\n",
      "B=np.array([[-P*cos25*48],[l*20+P*sin25*48],[P*sin25+200],[P*cos25]])\n",
      "C=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The forces are: Az=',round(C[0],1),\"lb\",',Bz=',round(C[1]),\"lb\",',Ay=',round(C[2],1),\"lb\",'and By=',round(C[3]),\"lb\"\n",
      "\n",
      "# The answer for Az waries due to decimal point descrepancy"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forces are: Az= -25.2 lb ,Bz= 101.0 lb ,Ay= 77.2 lb and By= 158.0 lb\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-14, Page No 90"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "A=80 #lb\n",
      "B=40 #lb\n",
      "C=60 #lb\n",
      "l1=2 #in\n",
      "l2=4 #in\n",
      "l3=6 #in\n",
      "l4=9 #in\n",
      "l5=3 #in\n",
      "l6=7 #in\n",
      "\n",
      "#Calculations\n",
      "P=-(-A*l1+B*l2-C*l2)/l1\n",
      "By=-(A*l3+P*l3)/l4\n",
      "Ay=(-A*l5-P*l5)/l4\n",
      "Bz=-(-C*l1-B*l1)/l4\n",
      "Az=(C*l6+B*l6)/l4\n",
      "\n",
      "#Result\n",
      "print'The forces are:Ay=',round(Ay,1),\"lb\",',By=',round(By,1),\"lb\",',Az=',round(Az,1),\"lb forward\",'and Bz=',round(Bz,1),\"lb forward\"\n",
      "\n",
      "# The answers may wary due to rounding of the values"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The forces are:Ay= -67.0 lb ,By= -134.0 lb ,Az= 77.0 lb forward and Bz= 22.0 lb forward\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6-15, Page no 91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "W=138 #lb\n",
      "w=80 #lb\n",
      "\n",
      "#Calculations\n",
      "u=(3*3+4*4+6*6)**0.5\n",
      "a=np.array([-3*u**-1,4*u**-1,-6*u**-1])\n",
      "v=(3*3+3*3+3*3)**0.5\n",
      "c=np.array([3*v**-1,3*v**-1,-3*v**-1])\n",
      "P=np.array([[1,0,0],[0,0,8],[0,-W,0]])\n",
      "Q=np.array([[0,0,1],[0,0,8],[0,-W,0]])\n",
      "R=np.array([[1,0,0],[0,0,4],[0,-w,0]])\n",
      "S=np.array([[0,0,1],[0,0,4],[0,-w,0]])\n",
      "T=np.array([[1,0,0],[0,0,6],[a[0],a[1],a[2]]])\n",
      "U=np.array([[0,1,0],[0,0,6],[a[0],a[1],a[2]]])\n",
      "V=np.array([[1,0,0],[0,0,3],[c[0],c[1],c[2]]])\n",
      "Y=np.array([[0,1,0],[0,0,3],[c[0],c[1],c[2]]])\n",
      "#Solving for A and C\n",
      "MAT1=np.array([[det(T),det(V)],[det(U),det(Y)]])\n",
      "MAT2=np.array([[det(P)+det(R)],[0]])\n",
      "res=np.linalg.solve(-MAT1,MAT2)\n",
      "A=np.array([a[0]*res[0],a[1]*res[0],a[2]*res[0]])\n",
      "C=np.array([c[0]*res[1],c[1]*res[1],c[2]*res[1]])\n",
      "E=np.array([-(A[0]+C[0]),-(-w-W+A[1]+C[1]),-(A[2]+C[2])])\n",
      "\n",
      "#Result\n",
      "print'The force vectors are as follows:'\n",
      "print'A=',round(A[0]),\"i +\",round(A[1]),\"j \",round(A[2]),\"k\",\n",
      "print'and C=',round(C[0]),\"i +\",round(C[1]),\"j \",round(C[2]),\"k\"\n",
      "print'also,Ex=',round(E[0]),\"lb\",',Ey=',round(E[1]),\"lb\",'and Ez=',round(E[2]),\"lb\"\n",
      "#Decimal accuracy causes discrepancy in the answers\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force vectors are as follows:\n",
        "A= -102.0 i + 136.0 j  -203.0 k and C= 203.0 i + 203.0 j  -203.0 k\n",
        "also,Ex= -102.0 lb ,Ey= -121.0 lb and Ez= 407.0 lb\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}