{
 "metadata": {
  "name": "chapter14.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14: Kinematics of a Rigid Body in Plane Motion"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-2, Page no 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "d=500 #mm\n",
      "wo=0 #rpm\n",
      "w=300 #rpm\n",
      "t=20 #s\n",
      "t1=2 #s\n",
      "\n",
      "#Calculations\n",
      "alpha=(2*pi*(60**-1)*(w-wo))/t #rad/s**2\n",
      "w1=wo+alpha*t1 #rad/s\n",
      "v=(d*(2*1000)**-1)*w1 #m/s\n",
      "a_n=(d*(2*1000)**-1)*w1**2 #m/s**2\n",
      "a_t=(d*(2*1000)**-1)*alpha #m/s**2\n",
      "a=(a_n**2+a_t**2)**0.5 #m/s**2\n",
      "theta=arccos(a_n/a)*(180/pi) #degrees\n",
      "\n",
      "#Result\n",
      "print'The computed values are:'\n",
      "print'alpha=',round(alpha,2),\"rad/s**2\"\n",
      "print'w1=',round(w1,2),\"rad/s\"\n",
      "print'v=',round(v,3),\"m/s\"\n",
      "print'a=',round(a,2),\"m/s**2\"\n",
      "print'theta=',round(theta,1),\"degrees\"\n",
      "\n",
      "# The answers may wary in decimal points."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The computed values are:\n",
        "alpha= 1.57 rad/s**2\n",
        "w1= 3.14 rad/s\n",
        "v= 0.785 m/s\n",
        "a= 2.5 m/s**2\n",
        "theta= 9.0 degrees\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-3, Page no 266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "s_BC=2 #m\n",
      "s_C=2.5 #m\n",
      "\n",
      "#Calculations\n",
      "s_B=(s_BC**2+s_C**2)**0.5 #m\n",
      "theta=arctan(s_BC*s_C**-1)*(180/pi) #degrees\n",
      "\n",
      "#Result\n",
      "print'The absolute displacement is',round(s_B,1),\"m\",'and the angle made by the vector is',round(theta,1),\"degrees.\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absolute displacement is 3.2 m and the angle made by the vector is 38.7 degrees.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-4, Page no 266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Initilization of variables\n",
      "V_A=20 #mi/h\n",
      "V_B=70 #mi/h\n",
      "# as theta1=60 degrees,\n",
      "sintheta1=sqrt(3)*2**-1\n",
      "costheta1=2**-1\n",
      "# also phi=45 degrees, thus\n",
      "sinphi=sqrt(2)**-1\n",
      "cosphi=sqrt(2)**-1\n",
      "\n",
      "#Result\n",
      "#Vector's in matrix form\n",
      "v_A=np.array([-V_A*cosphi,V_A*sinphi]) #mi/h\n",
      "v_B=np.array([V_B*costheta1,V_B*sintheta1]) #mi/h\n",
      "a=v_A[0]+v_B[0] #mi/h\n",
      "b=v_A[1]+v_B[1] #mi/h\n",
      "v_ab=(a**2+b**2)**0.5 #mi/h\n",
      "theta=arctan(b/a)*(180/pi) #degrees\n",
      "#The relative velocity v_ba is just different in sign while the magnitude stays the same\n",
      "\n",
      "#Resul\n",
      "print'The relative velocity is',round(v_ab,1),\"mi/h\",'making an angle',round(theta,1),\"degrees\"\n",
      "\n",
      "# The ans may wary due to decimal point descrepancy."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The relative velocity is 77.6 mi/h making an angle 74.4 degrees\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-9, Page no 271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "l=2.5 #m\n",
      "v_A=4 #m/s\n",
      "a_A=5 #m/s**2\n",
      "theta=30 #degrees\n",
      "\n",
      "#Calculations\n",
      "#Vector triangle yields v_a.b=2.93 m/s\n",
      "v_ab=2.93 #m/s\n",
      "w=v_ab*l**-1 #rad/s (clockwise)\n",
      "#Ploygon yields alpha_a/b=2.75 m/s**2\n",
      "alpha_ab=2.75 #m/s**2\n",
      "alpha=alpha_ab*l**-1 #rad/s**2 (counterclockwise)\n",
      "\n",
      "#Result\n",
      "print'The value of angular velocity is',round(w,2),\"rad/s\"\n",
      "print'The value of angular acceleration is',round(alpha,1),\"rad/s**2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of angular velocity is 1.17 rad/s\n",
        "The value of angular acceleration is 1.1 rad/s**2\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-10, Page no 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "w=(2*pi*120)/60 #rad/s\n",
      "l=24 #in\n",
      "l_c=4 #in\n",
      "# as th=30 degrees,\n",
      "sinth=2**-1\n",
      "\n",
      "#Calculations\n",
      "v=(l_c*12**-1)*w #ft/s\n",
      "betaa=arcsin((l_c*sinth)/l)*(180/pi) #degrees\n",
      "# betaa yeilds 4.8 degrees, thus value of cosbetaa is,\n",
      "cosbetaa=0.996\n",
      "theta=60-betaa #degrees\n",
      "# here theta yeilds 55.2 degrees, thus value of costheta is,\n",
      "costheta=0.57\n",
      "#Component of velocity along connecting rod is \n",
      "v1=v*costheta #ft/s\n",
      "v_p=v1/cosbetaa #ft/s\n",
      "\n",
      "#Result\n",
      "print'The absoulte velocity is',round(v_p,2),\"ft/s\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absoulte velocity is 2.4 ft/s\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-13, Page no 274"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "v_pc=3.68 #ft/s\n",
      "l=2 #ft\n",
      "\n",
      "#Calculations\n",
      "w=v_pc/l #rad/s counterclockwise\n",
      "\n",
      "#Result\n",
      "print'The angular velocity is',round(w,2),\"rad/s\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angular velocity is 1.84 rad/s\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-14, Page no 274"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#This problem is a combination of numerical and graphical solution\n",
      "#The program only deals with the numerical solution parts the rest can be verified by graphical solution\n",
      "#Initilization of variables\n",
      "r=4*12**-1 #ft\n",
      "w=4*pi #rad/s\n",
      "l=2 #ft\n",
      "w2=1.84 #rad/s\n",
      "\n",
      "#Calculations\n",
      "ac_n=r*w**2 #ft/s**2\n",
      "a_pc_n=l*w2**2 #ft/s**2\n",
      "\n",
      "#Result\n",
      "print'The  value of ac_n is',round(ac_n,1),\"ft/s**2\"\n",
      "print'The value of a_pc_n is',round(a_pc_n,2),\"ft/s**2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The  value of ac_n is 52.6 ft/s**2\n",
        "The value of a_pc_n is 6.77 ft/s**2\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-15, Page no 275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "w_bc=10 #rad/s\n",
      "AB=250 #mm\n",
      "BC=150 #mm\n",
      "AC=179 #mm\n",
      "AD=200 #mm\n",
      "# as theta1=45 degrees,\n",
      "sintheta1=(2**0.5)**-1\n",
      "costheta1=(2**0.5)**-1\n",
      "\n",
      "#Calculations\n",
      "v_c=(BC*1000**-1)*w_bc #m/s\n",
      "AC=((AB**2+BC**2)-(2*AB*BC*costheta1))**0.5 #m\n",
      "betaa=arcsin((BC*sintheta1)/AC)*(180/pi) #degrees\n",
      "gammaa=arcsin((AB*sintheta1)/AC)*(180/pi)#degrees answer in the textbook is incorrect\n",
      "ang=60-betaa #degrees\n",
      "# ang yeilds 23.7 degrees, thus\n",
      "sinang=0.40056\n",
      "cosang=0.916\n",
      "CD=sqrt(AD**2+AC**2-(2*AD*AC*cosang)) #mm\n",
      "D=arcsin((AC*sinang)/CD)*(180/pi) #degrees\n",
      "# D yeilds 63.2 degrees,thus\n",
      "sinD=0.8925\n",
      "theta=arcsin((AD*sinD)/AC)*(180/pi) #degrees\n",
      "n=360-(theta+gammaa+90) #degrees\n",
      "# n yeilds 101.8 degrees, thus \n",
      "cosn=-0.2045\n",
      "v_cd=v_c*cosn #m/s\n",
      "delta=180-(90+D) #degrees\n",
      "# Delts yeilds 26.8 degrees, thus\n",
      "cosdelta=0.8925\n",
      "v_D=v_cd/cosdelta #m/s\n",
      "w_AD=v_D/(AD*1000**-1) #rad/s\n",
      "\n",
      "#Result\n",
      "print'The angular Velocity of AD is',round(w_AD,2),\"rad/s clockwise.\" #Negative sign indicates clockwise orientation \n",
      "#Answer in the textbook is incorrect\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angular Velocity of AD is -1.72 rad/s clockwise.\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-18, Page No 277"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "# as theta1=73.9 degrees,theta2=60 degrees and theta3=46.1 degrees\n",
      "sintheta1=0.96\n",
      "sintheta2=sqrt(3)*2**-1\n",
      "sintheta3=0.72\n",
      "V=900 #mm/s\n",
      "\n",
      "#Calculations\n",
      "BC=((350*350)+(86.6*86.6))**0.5 #mm\n",
      "CD=400 #mm\n",
      "v_cb=(V*sintheta2)/(sintheta1) #mm/s\n",
      "v_c=((V*sintheta3))/(sintheta1) #mm/s\n",
      "w_dc=v_c/CD #rad/s\n",
      "w_bc=v_cb/BC #rad/s\n",
      "\n",
      "#Result\n",
      "print'The angular velocities are: w_dc=',round(w_dc,2),\"rad/s\",'and w_bc=',round(w_bc,2),\"rad/s\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angular velocities are: w_dc= 1.69 rad/s and w_bc= 2.25 rad/s\n"
       ]
      }
     ],
     "prompt_number": 78
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-19, Page No 278"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Calculations\n",
      "#After equating the i and j terms we obtain simplified equations\n",
      "#Solving by matrix method\n",
      "A=np.array([[346,86.7],[200,-350]])\n",
      "B=np.array([[-3700],[-1790]]) \n",
      "C=np.linalg.solve(A,B)\n",
      "\n",
      "#Result\n",
      "print'The angular accelerations are alpha_DC=',round(C[0],3),\"rad/s**2\",'and alpha_BC=',round(C[1],2),\"rad/s**2\" \n",
      "#The signs only indicate that the originally assumed orientations are incorrect and are opposite to those assumed\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angular accelerations are alpha_DC= -10.475 rad/s**2 and alpha_BC= -0.87 rad/s**2\n"
       ]
      }
     ],
     "prompt_number": 80
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-20, Page No 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "d=3 #m\n",
      "w=8 #rad/s (clockwise)\n",
      "alpha=4 #rad/s**2 (counterclockwise)\n",
      "r=d*2**-1 #m\n",
      "\n",
      "#Calculations\n",
      "vo=r*w #m/s\n",
      "ao=r*alpha #m/s**2\n",
      "#Here OB is r\n",
      "OB=r #m\n",
      "v_bo=OB*w #m/s\n",
      "v_B=v_bo+vo #m/s\n",
      "#Also\n",
      "a_bo=r*alpha #m/s**2 (directed left)\n",
      "a_bo_n=r*w**2 #m/s**2\n",
      "a_h=ao+a_bo #m/s**2\n",
      "a_v=a_bo_n #m/s**2\n",
      "a_B=((a_h**2)+(a_v**2))**0.5 #m/s**2\n",
      "phi=arctan(a_h/a_v)*(180/pi) #degrees\n",
      "\n",
      "#Result\n",
      "print'The linear velocity at B is',round(v_B),\"m/s\",'and the acceleration is',round(a_B,1),\"m/s**2\",'making an angle of',round(phi,2),\"degrees with horizontal\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The linear velocity at B is 24.0 m/s and the acceleration is 96.7 m/s**2 making an angle of 7.13 degrees with horizontal\n"
       ]
      }
     ],
     "prompt_number": 96
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-21, Page No 281"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "OA=0.6 #m\n",
      "w=8 #rad/s\n",
      "# as theta=30 degrees,\n",
      "sintheta=2**-1\n",
      "costheta=(3**0.5)*2**-1\n",
      "v_O=12 #m/s\n",
      "alpha=4 #rad/s**2\n",
      "a_O=6 #m/s**2\n",
      "\n",
      "#Calculations\n",
      "#Velocity Calculations\n",
      "v_AO=OA*w #m/s\n",
      "v_Ah=v_AO*sintheta+v_O #m/s horizontal component\n",
      "v_Av=v_AO*costheta #m/s\n",
      "v_A=((v_Ah**2)+(v_Av**2))**0.5 #m/s\n",
      "phi=arctan(v_Av/v_Ah)*(180/pi) #degrees\n",
      "#Acceleration Calculations\n",
      "a_AOt=OA*alpha #m/s**2\n",
      "a_AOn=OA*w**2 #m/s**2\n",
      "a_Ah=-a_O-a_AOn*costheta-a_AOt*sintheta #m/s**2\n",
      "a_Av=-a_AOn*sintheta+a_AOt*costheta #m/s**2\n",
      "a_A=((a_Ah**2)+(a_Av**2))**0.5 #m/s**2\n",
      "phi2=arctan(a_Av*a_Ah**-1)*(180/pi) #degrees\n",
      "\n",
      "#Result\n",
      "print'The velocity is',round(v_A),\"m/s\",'making an angle of',round(phi,1),\"degrees with horizontal.\"\n",
      "print'The acceleration is',round(a_A),\"m/s**2\",'making an angle of',round(phi2,1),\"degrees with horizontal\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity is 15.0 m/s making an angle of 16.1 degrees with horizontal.\n",
        "The acceleration is 44.0 m/s**2 making an angle of 22.9 degrees with horizontal\n"
       ]
      }
     ],
     "prompt_number": 100
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-22, Page No 282"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "AL=5 #ft\n",
      "d=10 #ft displacement\n",
      "\n",
      "#Calculations\n",
      "theta=d/AL #radians\n",
      "s_o=3*theta#ft\n",
      "\n",
      "#Result\n",
      "print'The displacement So is',round(s_o),\"ft\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement So is 6.0 ft\n"
       ]
      }
     ],
     "prompt_number": 101
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-23, Page No 283"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "#Speed and acceleration at the center\n",
      "v=12 #in/s\n",
      "a=18 #in/s**2\n",
      "\n",
      "#Calculations\n",
      "v_D=((a+v*0.5)*a**-1)*v #in/s\n",
      "#Speed at point F\n",
      "v_F=((v/2)*v**-1)*v_D #in/s\n",
      "#Acceleration at D\n",
      "a_D=(24/a)*a #in/s**2\n",
      "#Acceleration at F\n",
      "a_F=((v/2)*v**-1)*24 #in/s**2\n",
      "\n",
      "#Result\n",
      "print'The velocity and acceleration of weight A are',round(v_F),\"in/s\",'and',round(a_F),\"in/s**2 respectively.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity and acceleration of weight A are 8.0 in/s and 12.0 in/s**2 respectively.\n"
       ]
      }
     ],
     "prompt_number": 103
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-24, Page No 283"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Calculations\n",
      "#Speed and acceleration of D\n",
      "sD=((18-6)*18**-1)*12 #in/s\n",
      "aD=(12*18**-1)*18 #in/s**2\n",
      "#Speed and acceleration of F\n",
      "sF=(6*12**-1)*8 #in/s\n",
      "aF=(6*12**-1)*12 #in/s^2\n",
      "\n",
      "#Result\n",
      "print'The velocity and acceleration of weight A are',round(sF),\"in/s\",'and',round(aF),\"in/s**2 respectively.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity and acceleration of weight A are 4.0 in/s and 6.0 in/s**2 respectively.\n"
       ]
      }
     ],
     "prompt_number": 104
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14.14-26, Page No 284"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Initilization of variables\n",
      "v_BG=300 #mm/s\n",
      "v_G=300 #mm/s\n",
      "a_BGt=500 #mm/s**2\n",
      "a_BGn=3600#mm/s**2\n",
      "a_Gh=500 #mm/s**2\n",
      "a_Bv=1800 #mm/s**2\n",
      "\n",
      "#Calculations\n",
      "w=((75-25)/25)*6 #rad/s\n",
      "alpha=((75-25)/25)*10 #rad/s**2\n",
      "v_B=(v_BG**2+v_G**2)**0.5 #mm/s\n",
      "a_v=a_Bv-a_BGt #mm/s**2\n",
      "a_h=a_BGn-a_Gh #mm/s**2\n",
      "a_B=(a_v**2+a_h**2)**0.5 #mm/s**2\n",
      "\n",
      "#Result \n",
      "print'The velocity and acceleration of point B are',round(v_B),\"mm/s\",'and',round(a_B),\"mm/s**2 respectively.\"\n",
      "\n",
      "# The ans for a_B is incorrectin textbook."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity and acceleration of point B are 424.0 mm/s and 3362.0 mm/s**2 respectively.\n"
       ]
      }
     ],
     "prompt_number": 106
    }
   ],
   "metadata": {}
  }
 ]
}