summaryrefslogtreecommitdiff
path: root/Engineering_Physics_Aruldhas/Chapter1_1.ipynb
blob: 7872d7ab4bed16309a0bb0b598d9efe1dd2af79f (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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
{
 "metadata": {
  "name": "",
  "signature": "sha256:381979e560591138195a6149a5aa889c9c7e2cfe41c7a482a0ea4bbe4c24f150"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "1: Oscillations and Waves"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.1, Page number 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#import modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "S=4;    #SHM described by a particle(cm)\n",
      "x=0;    #mean position\n",
      "v=12;   #velocity at mean position(cm/s)\n",
      "\n",
      "#Calculation\n",
      "A=S/2;    #amplitude of motion(cm)\n",
      "omega=v/A;    #angular frequency(sec-1)\n",
      "T=(2*math.pi)/omega;    #time period(sec)\n",
      "T=math.ceil(T*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"time period of motion is\",T, \"sec\"\n",
      "print \"time period of motion is pi/3 sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "time period of motion is 1.048 sec\n",
        "time period of motion is pi/3 sec\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.2, Page number 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#import modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T=0.1;    #time period(sec)\n",
      "A=4;    #amplitude of motion(cm)\n",
      "x=0.2;    #distance from mean position(cm)\n",
      "\n",
      "#Calculation\n",
      "omega=(2*math.pi)/T;    #angular frequency(sec-1)\n",
      "a=(omega**2)*x;     #acceleration(cm/sec^2)\n",
      "a=math.ceil(a*10**2)/10**2;   #rounding off to 2 decimals\n",
      "#maximum velocity is when particle is in the mean position\n",
      "v_max=omega*A;    #maximum velocity(cm/sec)\n",
      "v_max=math.ceil(v_max*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"acceleration is\",a, \"cm/sec^2\"\n",
      "print \"maximum velocity is\",v_max, \"cm/sec\"\n",
      "\n",
      "#answers given in the book are wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "acceleration is 789.57 cm/sec^2\n",
        "maximum velocity is 251.33 cm/sec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.3, Page number 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#import modules\n",
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Variable declaration\n",
      "A1 = 40;    #First amplitude of oscillation(cm)\n",
      "An_plus_1 = 4;    #Amplitude after 100 oscillations(cm)\n",
      "n = 100;    #Number of oscillations\n",
      "T = 2.5;    #Time period of oscillations(s)\n",
      "\n",
      "#Calculation\n",
      "t = T/4;    #Time taken to reach the first amplitude from the mean position(s)\n",
      "#Now A1 = x0*math.exp(-lambda*t) and An_plus_1 = x0*math.exp(-lambda*(t+nT))\n",
      "#A1/An_plus_1 = math.exp(n*lambda*T)\n",
      "x=A1/An_plus_1;\n",
      "lamda=np.log(x)/(n*T);    #Damping constant(per sec)\n",
      "lamda=lamda*10**2;\n",
      "lamda=math.ceil(lamda*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"Damping constant is\",lamda,\"*10**-2 per sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Damping constant is 0.922 *10**-2 per sec\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.4, Page number 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#import modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "x1 = 3;    #First position of the particle(cm)\n",
      "x2 = 4;    #Second position of the particle(cm)\n",
      "v1 = 16;   #Velocity of particle executing SHM at 1st position(cm/s)\n",
      "v2 = 12;   #Velocity of particle executing SHM at 2nd position (cm/s)\n",
      "\n",
      "#Calculation\n",
      "#As v = omega*sqrt(A**2 - x**2) so\n",
      "#(v1/v2)**2=(A**2 - x1**2)/(A**2 - x2**2)\n",
      "#RHS gives (A**2-9)/(A**2-16)\n",
      "#(v2**2)*(A**2 - x1**2)=(v1**2)*(A**2 - x2**2), on solving we get\n",
      "A=math.sqrt((((v1**2)*(x2**2))-((v2**2)*(x1**2)))/((v1**2)-(v2**2)));    #amplitude in cm\n",
      "omega=v1/math.sqrt(A**2-x1**2);    #Angular speed of the particle(per sec)\n",
      "T=2*math.pi/omega;    #Time period of oscillation(sec)\n",
      "T=math.ceil(T*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"The amplitude of SHM is\",A, \"cm\"\n",
      "print \"The time period of oscillation is\",T, \"sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amplitude of SHM is 5.0 cm\n",
        "The time period of oscillation is 1.571 sec\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.5, Page number 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#import modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "m = 0.3;    #Mass attached to the string(kg)\n",
      "g = 9.8;    #Acceleration due to gravity(m/sec**2)\n",
      "x = 0.15;   #Stretchness produced in the spring(m)\n",
      "s = 0.1;    #spring is stretched and released(m)\n",
      "\n",
      "#Calculation\n",
      "F = m*g;    #Restoring force acting on the mass(N)\n",
      "k = F/x;    #Spring constant(N/m)\n",
      "A = s;     #amplitude equals to the spring stretched and released\n",
      "omega = math.sqrt(k/m);    #Angular frequency of oscillation(rad per sec)\n",
      "v0 = omega*A;    #Maximum velocity during the oscillations(m/s)\n",
      "v0=math.ceil(v0*100)/100;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"The spring constant is\",k, \"N/m\"\n",
      "print \"The amplitude of oscillation is\",A, \"m\"\n",
      "print \"The maximum velocity during oscillations is\",v0, \"m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The spring constant is 19.6 N/m\n",
        "The amplitude of oscillation is 0.1 m\n",
        "The maximum velocity during oscillations is 0.81 m/s\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.6, Page number 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#import modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "lambda1 = 400;    #Lower limit of wavelength of visible region(nm)\n",
      "lambda2 = 700;    #Upper limit of wavelength of visible region(nm)\n",
      "c = 3*10**8;    #Speed of light in vacuum(m/s)\n",
      "\n",
      "#Calculation\n",
      "lambda1 = lambda1*10**-9     #Lower limit of wavelength(m) \n",
      "lambda2 = lambda2*10**-9     #upper limit of wavelength(m) \n",
      "new_1 = c/lambda1;    #Upper limit of frequency of visible region(m)\n",
      "new_2 = c/lambda2;    #Lower limit of frequency of visible region(m)\n",
      "\n",
      "#Result\n",
      "print \"The frequency equivalent of 400 nm is\",new_1, \"Hz\"\n",
      "print \"The frequency equivalent of 700 nm is\",new_2, \"Hz\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The frequency equivalent of 400 nm is 7.5e+14 Hz\n",
        "The frequency equivalent of 700 nm is 4.28571428571e+14 Hz\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.7, Page number 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "#Comparing the standard equation u(x,t) = A*sin(2*%pi(x/lambda-t/T)) with the given equation, we get\n",
      "A = 1.5*10**-3;    #Amplitude of the sound wave(m)\n",
      "lamda = 8;    #Wavelength of the sound wave(m)\n",
      "T = 1/40;     #Time period of the sound wave(s)\n",
      "\n",
      "#Calculation\n",
      "A = A*10**3;\n",
      "new = 1/T;     #Frequency of the sound wave(Hz)\n",
      "v = new*lamda;    #Velocity of the sound wave(m/s)\n",
      "T=math.ceil(T*100)/100;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"The amplitude of the sound wave is\",A,\"*10**-3 m\"\n",
      "print \"The wavelength of the sound wave is\",lamda, \"m\"\n",
      "print \"The time period of the sound wave is\",T, \"s\"\n",
      "print \"The frequency of the sound wave is\",new, \"Hz\"\n",
      "print \"The velocity of the sound wave is\",v, \"m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amplitude of the sound wave is 1.5 *10**-3 m\n",
        "The wavelength of the sound wave is 8 m\n",
        "The time period of the sound wave is 0.03 s\n",
        "The frequency of the sound wave is 40.0 Hz\n",
        "The velocity of the sound wave is 320.0 m/s\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.8, Page number 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "A = 2;    #Amplitude of the wave(cm)\n",
      "T = 0.5;   #Time period of the wave(sec)\n",
      "v = 200;    #Wave velocity(cm/s)\n",
      "\n",
      "#Calculation\n",
      "f = 1/T;   #Frequency of the wave(Hz)\n",
      "lamda = v/f;  #Wavelength of the wave(cm)\n",
      "\n",
      "#Result\n",
      "print \"frequency of wave is\",f, \"Hz\"\n",
      "print \"wavelength of wave is\",lamda, \"cm\"\n",
      "print \"The Equation of the wave moving along X-axis :\"\n",
      "print \"u = \",A,\"*sin*2*math.pi*(x/\",lamda,\"- t/\",T,\")\"     #x and y are in cm and t is in sec"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "frequency of wave is 2.0 Hz\n",
        "wavelength of wave is 100.0 cm\n",
        "The Equation of the wave moving along X-axis :\n",
        "u =  2 *sin*2*math.pi*(x/ 100.0 - t/ 0.5 )\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.9, Page number 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#import modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "T = 1000;    #Tension in the wire(N)\n",
      "M=15;    #mass of the wire(kg)\n",
      "l=300;   #length of the wire(m)\n",
      "lamda = 0.30;    #Wavelength of wave along wire(m)\n",
      "\n",
      "#Calculation\n",
      "m = M/l;    #Mass per unit length of the wire(kg/m)\n",
      "v = math.sqrt(T/m);    #Velocity of wave through wire(m/s)\n",
      "v=math.ceil(v*100)/100;   #rounding off to 2 decimals\n",
      "new = v/lamda;    #Frequency of wave through string(Hz)\n",
      "new=math.ceil(new*100)/100;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"The velocity of the wave through wire is\",v, \"m/s\"\n",
      "print \"The frequency of the wave through wire is\",new, \"Hz\"\n",
      "\n",
      "#answer for frequency of the wave is wrong in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of the wave through wire is 141.43 m/s\n",
        "The frequency of the wave through wire is 471.44 Hz\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}