summaryrefslogtreecommitdiff
path: root/Engineering_Mechanics_by_Tayal_A.K./chapter19_5.ipynb
blob: ca13c8e874eba4c55416dfef676f2ae423623304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
{
 "metadata": {
  "name": "chapter19.ipynb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 19: Relative Motion"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.19-1,Page no:503"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initilization of variables\n",
      "\n",
      "v_t=10 # m/s # velocity of the train\n",
      "v_s=5 # m/s # velocity of the stone\n",
      "\n",
      "# Calculations\n",
      "\n",
      "# Let v_r be the relative velocity, which is given as, (from triangle law)\n",
      "v_r=(v_t**2+v_s**2)**0.5 # m/s\n",
      "# The direction ofthe stone is,\n",
      "theta=arctan(v_s*v_t**-1)*(180/pi) # degree\n",
      "\n",
      "# Results\n",
      "\n",
      "print\"The velocity at which the stone appears to hit the person travelling in the train is \",round(v_r,1),\"m\"\n",
      "print\"The direction of the stone is \",round(theta,2),\"degree\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity at which the stone appears to hit the person travelling in the train is  11.2 m\n",
        "The direction of the stone is  26.57 degree\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.19-2,Page No:504"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initilization of variables\n",
      "\n",
      "v_A=5 # m/s # speed of ship A\n",
      "v_B=2.5 # m/s # speed of ship B\n",
      "theta=135 # degree # angle between the two ships\n",
      "\n",
      "# Calculations\n",
      "\n",
      "# Here,\n",
      "OA=v_A # m/s\n",
      "OB=v_B # m/s\n",
      "\n",
      "# The magnitude of relative velocity is given by cosine law as,\n",
      "AB=((OA**2)+(OB**2)-(2*OA*OB*cos(theta*(pi/180))))**0.5 # m/s\n",
      "\n",
      "# where AB gives the relative velocity of ship B with respect to ship A\n",
      "# Applying sine law to find the direction, Let alpha be the direction of the reative velocity, then\n",
      "alpha=arcsin((OB*sin(theta*(pi/180)))/(AB))*(180/pi) # degree\n",
      "\n",
      "# Results\n",
      "\n",
      "print\"The magnitude of relative velocity of ship B with respect to ship A is \",round(AB,2),\"m/s\"\n",
      "print\"The direction of the relative velocity is \",round(alpha,2),\"degree\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnitude of relative velocity of ship B with respect to ship A is  6.99 m/s\n",
        "The direction of the relative velocity is  14.64 degree\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.19-3,Page No:505"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "# Initilization of variables\n",
      "\n",
      "v_c=20 # km/hr # speed at which the cyclist is riding to west\n",
      "theta_1=45 # degree # angle made by rain with the cyclist when he rides at 20 km/hr\n",
      "V_c=12 # km/hr # changed speed\n",
      "theta_2=30 # degree # changed angle when the cyclist rides at 12 km/hr\n",
      "\n",
      "# Calculations\n",
      "\n",
      "# Solving eq'ns 1 & 2 simultaneously to get the values of components(v_R_x & v_R_y) of absolute velocity v_R. We use matrix to solve eqn's 1 & 2.\n",
      "A=np.array([[1 ,1],[1, 0.577]])\n",
      "B=np.array([20,12])\n",
      "C=np.linalg.solve(A,B) # km/hr\n",
      "\n",
      "# The X component of relative velocity (v_R_x) is C(1)\n",
      "# The Y component of relative velocity (v_R_y) is C(2)\n",
      "\n",
      "# Calculations\n",
      "\n",
      "# Relative velocity (v_R) is given as,\n",
      "v_R=((C[0])**2+(C[1])**2)**0.5 # km/hr\n",
      "# And the direction of absolute velocity of rain is theta, is given as\n",
      "theta=arctan(C[1]/C[0])*(180/pi) # degree\n",
      "\n",
      "# Results \n",
      "\n",
      "print\"The magnitude of absolute velocity is \",round(v_R,2),\"km/hr\"\n",
      "print\"The direction of absolute velocity is \",round(theta,1),\"degree\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnitude of absolute velocity is  18.94 km/hr\n",
        "The direction of absolute velocity is  86.7 degree\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19.19-4,Page No:508"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initiization of variables\n",
      "\n",
      "a=1 # m/s^2 # acceleration of car A\n",
      "u_B=36*1000*3600**-1 # m/s # velocity of car B\n",
      "u=0 # m/s # initial velocity of car A\n",
      "d=32.5 # m # position of car A from north of crossing\n",
      "t=5 # seconds\n",
      "\n",
      "# Calculations\n",
      "\n",
      "# CAR A: Absolute motion using eq'n v=u+at we have,\n",
      "v=u+(a*t) # m/s\n",
      "# Now distance travelled by car A after 5 seconds is given by, s_A=u*t+(1/2)*a*t^2\n",
      "s_A=(u*t)+((0.5)*a*t**2)\n",
      "# Now, let the position of car A after 5 seconds be y_A\n",
      "y_A=d-s_A # m # \n",
      "\n",
      "# CAR B:\n",
      "# let a_B be the acceleration of car B\n",
      "a_B=0 # m/s\n",
      "# Now position of car B is s_B\n",
      "s_B=(u_B*t)+((0.5)*a_B*t**2) # m\n",
      "x_B=s_B # m\n",
      "\n",
      "# Let the Relative position of car A with respect to car B be BA & its direction be theta, then from fig. 19.9(b)\n",
      "OA=y_A\n",
      "OB=x_B\n",
      "BA=(OA**2+OB**2)**0.5 # m\n",
      "theta=arctan(OA/OB)*(180/pi) # degree\n",
      "\n",
      "# Let the relative velocity of car A w.r.t. the car B be v_AB & the angle be phi. Then from fig 19.9(c). Consider small alphabets\n",
      "oa=v\n",
      "ob=u_B\n",
      "v_AB=(oa**2+ob**2)**0.5 # m/s\n",
      "phi=arctan(oa/ob)*(180/pi) # degree\n",
      "\n",
      "# Let the relative acceleration of car A w.r.t. car B be a_A/B.Then,\n",
      "a_AB=a-a_B # m/s^2\n",
      "\n",
      "# Results\n",
      "\n",
      "print\"The relative position of car A relative to car B is \",round(BA,1),\"m\"\n",
      "print\"The direction of car A w.r.t car B is \",round(theta,1),\"degree\"\n",
      "print\"The velocity of car A relative to car B is \",round(v_AB,1),\"m/s\"\n",
      "print\"The direction of car A w.r.t (for relative velocity)is \",round(phi,1),\"degree\"\n",
      "print\"The acceleration of car A relative to car B is \",round(a_AB,1),\"m/s^2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The relative position of car A relative to car B is  53.9 m\n",
        "The direction of car A w.r.t car B is  21.8 degree\n",
        "The velocity of car A relative to car B is  11.2 m/s\n",
        "The direction of car A w.r.t (for relative velocity)is  26.6 degree\n",
        "The acceleration of car A relative to car B is  1.0 m/s^2\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}