{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 26 Appendix" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.1 Appendix" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The Position vector is -5.000000i+2.000000j+14.000000k\n", "The value of r is 15.000000*l i + 15.000000*m j + 15.000000*n k\n", "The unit vector in the direction of r is -0.333333i+0.133333j+0.933333k\n" ] } ], "source": [ "import math\n", "#Initilization of variables\n", "P=[-5,2,14] #Point co-ordinates\n", "#Calculations\n", "r=math.sqrt(P[0]**2+P[1]**2+P[2]**2) #Magnitude of the poistion vector\n", "#Direction cosines\n", "l=P[0]/r \n", "m=P[1]/r\n", "n=P[2]/r\n", "#Unit Vector calculations\n", "r_unit=[]\n", "r_unit[:]=[P[i]/r for i in range(0,3)]\n", "#Results\n", "print(\"The Position vector is %fi+%fj+%fk\"%(P[0],P[1],P[2]))\n", "print('The value of r is %f*l i + %f*m j + %f*n k'%(r,r,r))\n", "print(\"The unit vector in the direction of r is %fi+%fj+%fk\"%(r_unit[0],r_unit[1],r_unit[2]))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.2 Appendix" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The force in vector notation is -1.097643i-9.878783j-1.097643k\n", "Thetax=96.301726 degrees,Thetay=171.069858 degrees,Thetaz=96.301726 degrees\n" ] } ], "source": [ "#Initilizatin of variable\n", "F=10 #N\n", "P_1=[2,4,3] \n", "P_2=[1,-5,2]\n", "\n", "#Calculations\n", "d_x=P_2[0]-P_1[0]\n", "d_y=P_2[1]-P_1[1]\n", "d_z=P_2[2]-P_1[2]\n", "d=math.sqrt(d_x**2+d_y**2+d_z**2)\n", "Fx=(F/d)*d_x #N\n", "Fy=(F/d)*d_y #N\n", "Fz=(F/d)*d_z #N\n", "#Direction cosines\n", "l=Fx/F\n", "m=Fy/F\n", "n=Fz/F\n", "#Angles\n", "theta_x=math.degrees(math.acos(l)) #degrees\n", "theta_y=math.degrees(math.acos(m)) #degrees\n", "theta_z=math.degrees(math.acos(n)) #degrees\n", "\n", "#Result\n", "print(\"The force in vector notation is %fi%fj%fk\"%(Fx,Fy,Fz))\n", "print(\"Thetax=%f degrees,Thetay=%f degrees,Thetaz=%f degrees\"%(theta_x,theta_y,theta_z)) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.3 Appendix" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The force vector is -1059.997880i+2119.995760j+794.998410k N\n", "The angles are thetax=115.087329,thetay=32.005383 and thetaz=71.458022 degrees\n" ] } ], "source": [ "#initiliation of variables\n", "T=2500 #N\n", "#Co-ordinates\n", "Q=[40,0,-30]\n", "P=[0,80,0]\n", "\n", "#Calculations\n", "mag_QP=math.sqrt((P[0]-Q[0])**2+(P[1]-Q[1])**2+(P[2]-Q[2])**2) #Magnitude\n", "QP=[(P[0]-Q[0]),(P[1]-Q[1]),(P[2]-Q[2])] \n", "F=[]\n", "F[:]=[(T/mag_QP)*QP[i] for i in range(0,3)] #N\n", "thetax=(math.acos(F[0]/T)*180/math.pi) #degrees\n", "thetay=(math.acos(F[1]/T)*180/math.pi) #degrees\n", "thetaz=(math.acos(F[2]/T)*180/math.pi) #degrees\n", "\n", "#Result\n", "print(\"The force vector is %fi+%fj+%fk N\"%(F[0],F[1],F[2]))\n", "#Answer in the textbook is printed as 1600 which is incorrect\n", "print(\"The angles are thetax=%f,thetay=%f and thetaz=%f degrees\"%(thetax,thetay,thetaz))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.4 Appendix" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The unit vector is 0.635999i-0.212000j+0.741999k\n" ] } ], "source": [ "#initilization of variables\n", "A=[2,-1,1]\n", "B=[1,1,2]\n", "C=[3,-2,4]\n", "#Calculations\n", "R=[A[0]+B[0]+C[0],A[1]+B[1]+C[1],A[2]+B[2]+C[2]] #Resultant\n", "mag=math.sqrt(R[0]**2+R[1]**2+R[2]**2)\n", "#Unit vector\n", "U=[]\n", "U[:]=[R[i]/mag for i in range(0,3)] \n", "#Result\n", "print(\"The unit vector is %fi%fj+%fk\"%(U[0],U[1],U[2]))\n", "#Answer for (k) is incorrect in the textbook" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.5 Appendix" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The product of both the vectors is -7.000000\n", "The angle between them is 101.309932 degrees\n" ] } ], "source": [ "#initilization of variables\n", "A=[2,-6,-3]\n", "B=[4,3,-1] \n", "#Calculations\n", "AdotB=A[0]*B[0]+A[1]*B[1]+A[2]*B[2] \n", "magA=math.sqrt(A[0]**2+A[1]**2+A[2]**2) \n", "magB=math.sqrt(B[0]**2+B[1]**2+B[2]**2)\n", "theta=math.degrees(math.acos(AdotB/(magA*magB))) #degrees\n", "\n", "#Result\n", "print(\"The product of both the vectors is %f\"%AdotB)\n", "print(\"The angle between them is %f degrees\"%theta)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.6 Appendix" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The value of A.costheta is 1.000000\n" ] } ], "source": [ "#initilization of variables\n", "A=[4,-3,1]\n", "P=[2,3,-1]\n", "Q=[-2,-4,3]\n", "#Calculations\n", "B=[Q[0]-P[0],Q[1]-P[1],Q[2]-P[2]]\n", "AdotB=A[0]*B[0]+A[1]*B[1]+A[2]*B[2]\n", "magB=math.sqrt(B[0]**2+B[1]**2+B[2]**2)\n", "Acostheta=AdotB/magB\n", "#Result\n", "print(\"The value of A.costheta is %f\"%Acostheta)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.7 Appendix" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The work done is 135 units\n" ] } ], "source": [ "import numpy as np\n", "#Initilization of variables\n", "F=np.array([5,10,-15])\n", "a=np.array([1,0,3])\n", "b=np.array([3,-1,-6])\n", "#Calculations\n", "d=b-a\n", "work=F*d\n", "Work=work[0]+work[1]+work[2]\n", "#Result\n", "print(\"The work done is %d units\"%Work)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.8 Appendix" ] }, { "cell_type": "code", "execution_count": 35, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The cross prcoduct of the two vectors is 15.000000i -10.000000j+30.000000k\n", "The angle between the two is 78.690068 degrees\n" ] } ], "source": [ "#initilization of variables\n", "A=[2,-6,-3]\n", "B=[4,3,-1]\n", "#Calculations\n", "AcrossB=[A[1]*B[2]-B[1]*A[2],A[2]*B[0]-A[0]*B[2],A[0]*B[1]-A[1]*B[0]]\n", "mag=math.sqrt(AcrossB[0]**2+AcrossB[1]**2+AcrossB[2]**2)\n", "n=[AcrossB[i]/mag for i in range(0,3)]\n", "magA=math.sqrt(A[0]**2+A[1]**2+A[2]**2)\n", "magB=math.sqrt(B[0]**2+B[1]**2+B[2]**2)\n", "theta=math.degrees(math.asin(mag/(magA*magB)))\n", "#Result\n", "print(\"The cross prcoduct of the two vectors is %fi %fj+%fk\"%(AcrossB[0],AcrossB[1],AcrossB[2])) #the answer for j is wrong in textbook\n", "print(\"The angle between the two is %f degrees\"%theta)\n", "# Only 1 value for theta has been solved" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.9 Appendix" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The vector notation of velocity is 10.474459i -6.110101j -0.436436k\n", "The magnitude of the Velocity Vector is 12.134171\n" ] } ], "source": [ "# Initilization of Variable \n", "# Points As martices\n", "A=[0,1,2]\n", "B=[1,3,-2]\n", "P=[3,6,4]\n", "a_s=2 # Angular speed in rad/s\n", "\n", "# Calculations\n", "C=(B[0]-A[0],B[1]-A[1],B[2]-A[2])\n", "magC=(C[0]**2+C[1]**2+C[2]**2)**0.5 # Magnitude of the Vector C \n", "# Unit vector\n", "C_unit=(C[0]/magC,C[1]/magC,C[2]/magC) # Unit vector\n", "# Position Vector\n", "r=(P[0]-A[0],P[1]-A[1],P[2]-A[2])\n", "# Velocity Vector\n", "# Calculating the cross product as,\n", "V=(C[1]*r[2]-C[2]*r[1],C[2]*r[0]-C[0]*r[2],C[0]*r[1]-C[1]*r[0])\n", "# Vector notation\n", "V_n=[]\n", "V_n[:]=[(a_s/magC)*V[i] for i in range(0,3)]\n", "# Velocity Magnitude\n", "magV=math.sqrt(V[0]**2+V[1]**2+V[2]**2)\n", "v=(a_s/magC)*magV\n", "# Result\n", "print(\"The vector notation of velocity is %fi %fj %fk\"%(V_n[0],V_n[1],V_n[2]))\n", "print(\"The magnitude of the Velocity Vector is %f\"%v)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.10 Appendix" ] }, { "cell_type": "code", "execution_count": 39, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The Moment about point O is 9.000000i -1.000000j+32.000000k\n" ] } ], "source": [ "# Initilization of variables\n", "# Points as matrices\n", "O=[-2,3,5]\n", "P=[1,-2,4]\n", "Q=[5,2,3]\n", "F=[4,4,-1] # Force vector\n", "# Calculations\n", "# Positon vector , r_2 gives the same answer as r_1\n", "r_1=(P[0]-O[0],P[1]-O[1],P[2]-O[2])\n", "# Moment\n", "# Calculating the cross product\n", "M=(r_1[1]*F[2]-r_1[2]*F[1],r_1[2]*F[0]-r_1[0]*F[2],r_1[0]*F[1]-r_1[1]*F[0])\n", "# Results\n", "print('The Moment about point O is %fi %fj+%fk'%(M[0],M[1],M[2]))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.11 Appendix" ] }, { "cell_type": "code", "execution_count": 40, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The moment of the force is 2.000000i -7.000000j -2.000000k\n" ] } ], "source": [ "# Initilization of variables\n", "# Points as matrices\n", "P=[1,-1,2] # Point where force is applied\n", "O=[2,-1,3] # point where moment is to be found\n", "F=[3,2,-4] # Force vector\n", "# Calculations\n", "# Position vector of point P wrt O\n", "r=(P[0]-O[0],P[1]-O[1],P[2]-O[2])\n", "# Moment\n", "M=(r[1]*F[2]-r[2]*F[1],r[2]*F[0]-r[0]*F[2],r[0]*F[1]-r[1]*F[0])\n", "# Resuts\n", "print('The moment of the force is %fi %fj %fk'%(M[0],M[1],M[2]))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.12 Appendix" ] }, { "cell_type": "code", "execution_count": 45, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The moment is -68.000000i + 102.000000j + 0.000000 k\n" ] } ], "source": [ "# Initilization of variables\n", "f=22 # N \n", "# Points as matrices\n", "A=[4,-1,7]\n", "O=[1,-3,2]\n", "V=[9,6,-2] # Given vector\n", "# Calculations\n", "# Unit vector in the direction of the vector\n", "denom=math.sqrt(V[0]**2+V[1]**2+V[2]**2)\n", "v=[V[i]/denom for i in range(0,3)]\n", "# Force\n", "F=[f*v[i] for i in range(0,3)]\n", "# Position vector of point A wrt O\n", "r=(A[0]-O[0],A[1]-O[1],A[2]-O[2])\n", "# Moment\n", "M=(r[1]*F[2]-r[2]*F[1],r[2]*F[0]-r[0]*F[2],r[0]*F[1]-r[1]*F[0])\n", "# Results\n", "print('The moment is %fi + %fj + %f k'%(M[0],M[1],M[2]))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.13 Appendix" ] }, { "cell_type": "code", "execution_count": 48, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The components of the force is along u=3.301270 N,along v=-94.282032 N,along w=30.000000 N\n" ] } ], "source": [ "# Initilization of variables\n", "# Force Vector\n", "F=[50,-80,30]\n", "# from fig.13\n", "theta1=30 # angles by which the axis is rotated [ all in degrees]\n", "theta2=60\n", "theta3=90\n", "theta4=120\n", "theta5=0\n", "# Calculations\n", "# Unit vector in u-direction\n", "u_unit=(1*math.cos(theta1*math.pi/180),1*math.cos(theta2*math.pi/180),1*math.cos(theta3*math.pi/180))\n", "# Unit vector in v-direction\n", "v_unit=(1*math.cos(theta4*math.pi/180),1*math.cos(theta1*math.pi/180),1*math.cos(theta3*math.pi/180))\n", "# Unit vector in w-direction\n", "w_unit=(1*math.cos(theta3*math.pi/180),1*math.cos(theta3*math.pi/180),1*math.cos(theta5*math.pi/180))\n", "# Components of force\n", "# finding the dot product as\n", "u=F[0]*u_unit[0]+F[1]*u_unit[1]+F[2]*u_unit[2] # N\n", "v=F[0]*v_unit[0]+F[1]*v_unit[1]+F[2]*v_unit[2] # N\n", "w=F[0]*w_unit[0]+F[1]*w_unit[1]+F[2]*w_unit[2] # N\n", "# Results\n", "print('The components of the force is along u=%f N,along v=%f N,along w=%f N'%(u,v,w))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.14 Appendix" ] }, { "cell_type": "code", "execution_count": 64, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The moment of the force about point E is 0.000000i - 44.721360j + 22.360680k N.m\n", "The moment of force about axis AE is -44.721360 N.m\n" ] } ], "source": [ "# Initilization of variables\n", "f=100 # N # magnitude of force\n", "# Co-ordinates of corners of the box as matrices\n", "A=[0,0,0]\n", "B=[0.5,0,0]\n", "C=[0.5,0,1]\n", "D=[0,0,1]\n", "E=[0,0.5,0]\n", "F=[0.5,0.5,0]\n", "G=[0.5,0.5,1]\n", "H=[0,0.5,1]\n", "# Calculations\n", "# Force vector\n", "Fmag=f/math.sqrt((F[0]-C[0])**2+(F[1]-C[1])**2+(F[2]-C[2])**2)\n", "F=[Fmag*(F[i]-C[i]) for i in range(0,3)]\n", "# Position vector\n", "r_EC=(C[0]-E[0],C[1]-E[1],C[2]-E[2])\n", "# Moment about point E\n", "# Calculating the cross product\n", "M_E=((r_EC[1]*F[2]-r_EC[2]*F[1]),(r_EC[2]*F[0]-r_EC[0]*F[2]),(r_EC[0]*F[1]-r_EC[1]*F[0])) # N.m # The value taken for F is incorrect in textbook.\n", "# Unit vector\n", "n_AE=[(E[i]-A[i])/math.sqrt((E[0]-A[0])**2+(E[1]-A[1])**2+(E[2]-A[2])**2) for i in range(0,3)]\n", "# Moment of force about axis AE\n", "# finding the dot product\n", "M_AE=M_E[0]*n_AE[0]+M_E[1]*n_AE[1]+M_E[2]*n_AE[2] # N.m\n", "# Results\n", "print('The moment of the force about point E is %fi - %fj + %fk N.m'%M_E)\n", "print('The moment of force about axis AE is -%f N.m'%M_AE)\n", "# The value of M_AE & M_E is incorrect in the textbook.Incorrect value of force vector is taken in calculation of M_E\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.16 Appendix" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The point of application should be shifted to: x=3.800000 m and z=4.100000 m\n" ] } ], "source": [ "# Initilization of variables\n", "F=20 # kN # Force acting at O\n", "M_x=76 # kNm\n", "M_y=82 # kNm\n", "# Calculations\n", "x=M_x/F # m\n", "z=M_y/F # m\n", "# Results\n", "print('The point of application should be shifted to: x=%f m and z=%f m'%(x,z))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.17 Appendix" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tension in cable AD is 2282.996811 N\n", "Tension in cable AB is 2040.860785 N\n", "Tension in cable AC is 1588.382888 N\n" ] } ], "source": [ "import numpy\n", "# Initilization of variables\n", "W=5000 # N\n", "# Co-ordinates of various points\n", "A=[0,4.5,0]\n", "B=[2.8,0,0]\n", "C=[0,0,-2.4]\n", "D=[-2.6,0,1.8]\n", "# Calculations\n", "# Ref textbook for the values of tenion in the cable AB, AC & AD. The values consist of variables which cannot be defined here\n", "# We re-arrange and define the equations of equilibrium as matrices and solve them as,\n", "P=numpy.matrix('0.528,0.0,-0.472;0.0,0.47,-0.327;0.85,0.88,0.818')\n", "Q=numpy.matrix('0;0;5000')\n", "X=numpy.linalg.inv(P)*Q\n", "# Results\n", "print('Tension in cable AD is %f N'%X[2])\n", "print('Tension in cable AB is %f N'%X[0])\n", "print('Tension in cable AC is %f N'%X[1])\n", "#Ans for T_AB is incorrect in textbook.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.18 Appendix" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The reactions are: R_A=6.416667 kN ,R_C=3.892857 kN and R_B=-2.309524 kN\n" ] } ], "source": [ "# Initilization of variables\n", "P=5 # kN\n", "Q=3 # kN\n", "C=5 # kNm # couple\n", "# ref fig.20 # Notations have been assumed\n", "z1=1.5 # m\n", "z2=0.625 # m\n", "z3=0.5 # m\n", "x1=3.5 # m\n", "x2=0.625 # m\n", "# Calculations\n", "# sum M_x=0\n", "R_A=((P*z2)+(Q*z3)+C)/z1 # kN\n", "# M_z=0\n", "R_C=((Q*x1)+(P*x2))/x1 # kN\n", "# sum F_y=0\n", "R_B=P+Q-R_A-R_C # kN\n", "# Results\n", "print('The reactions are: R_A=%f kN ,R_C=%f kN and R_B=%f kN'%(R_A,R_C,R_B))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example 26.19 Appendix" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The components of reaction at A are: A_x=-1.562500 kN , A_y=-1.687500 kN and A_z=6.250000 kN\n", "The tensions in the cable are: T_FE=5.387931 kN and T_GD=3.810976 kN\n" ] } ], "source": [ "# Initilization of variables\n", "F=2 # kN\n", "W=1 # kN\n", "# Co-ordinates as matrices\n", "A=[0,0,0]\n", "C=[0,0,1.2]\n", "B=[0,0,2.5]\n", "D=[-1,1,0]\n", "E=[1,1,0]\n", "F=[0,0,1]\n", "G=[0,0,2]\n", "# Force vector\n", "f=[0,-2,0]\n", "# Weight vector\n", "w=[0,-1,0]\n", "# Calculations\n", "# we have 5 unknowns: A_x,A_y,A_z,T_FE & T_GD\n", "# we define and solve eqn's 1,2,3,4&5 using matrix as,\n", "P=numpy.matrix('1 0 0 0.58 -0.41;0 1 0 0.58 0.41;0 0 1 -0.58 -0.82;0 0 0 0.58 0.82;0 0 0 0.58 -0.82')\n", "Q=numpy.matrix('0;3;0;6.25;0')\n", "X=numpy.linalg.inv(P)*Q\n", "\n", "# Results\n", "print('The components of reaction at A are: A_x=%f kN , A_y=%f kN and A_z=%f kN'%(X[0],X[1],X[2]))\n", "print('The tensions in the cable are: T_FE=%f kN and T_GD=%f kN'%(X[3],X[4]))\n", "# The solution in the textbook is incorrect and yeilds singularity in matrix calculation." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.1" }, "widgets": { "state": {}, "version": "1.1.2" } }, "nbformat": 4, "nbformat_minor": 0 }