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
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 1 - Introduction and basic concepts"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.1 Page: 4"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.1 - Page: 4\n",
"\n",
"\n",
"Weight of the man on the moon is 260.43 N\n",
"\n"
]
}
],
"source": [
"from __future__ import division\n",
"# Soltion\n",
"\n",
"print \"Example: 1.1 - Page: 4\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"g_Earth = 9.83 # [m/square s]\n",
"F_Earth = 800 # [N]\n",
"g_Moon = 3.2 # [m/square s]\n",
"#************#\n",
"\n",
"# From the expression of force, the force on the man on the Eath's surface is given by:\n",
"# F = m*g_Earth\n",
"m = F_Earth/g_Earth # [kg]\n",
"\n",
"# On the moon, the weight of the mass is equal to the force acting on the mass on the moon and is given by\n",
"F_Moon = m*g_Moon # [N]\n",
"\n",
"print \"Weight of the man on the moon is %0.2f N\\n\"%(F_Moon)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.2 Page: 5"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.2 - Page: 5\n",
"\n",
"\n",
"Gravitational force on the body is 16.68 N\n",
"\n"
]
}
],
"source": [
"# Solution\n",
"\n",
"print \"Example: 1.2 - Page: 5\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"m1 = 1.5 # [mass of the body, kg]\n",
"m2 = 6*10**(24) # [mass of the Earth, kg]\n",
"G = 6.672*10**(-11) # [N.square m/square.kg]\n",
"r = 6000*10**(3) # [m]\n",
"#************#\n",
"\n",
"# According to Newton's universal law of gravity:\n",
"F = G*m1*m2/r**2 # [N]\n",
"print \"Gravitational force on the body is %.2f N\\n\"%(F)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.3 Page: 5"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.3 - Page: 5\n",
"\n",
"\n",
"Mass of 1 kg will weigh 6.92 kg on moon\n",
"\n"
]
}
],
"source": [
"# Solution\n",
"\n",
"print \"Example: 1.3 - Page: 5\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"r_Moon = 0.3 # [km]\n",
"r_Earth = 1 # [km]\n",
"m2 = 1 # [mass of body, kg]\n",
"mMoon_By_mEarth = 0.013 # [kg/kg]\n",
"#***************#\n",
"\n",
"# According to the Newton's universal law of gravitation:\n",
"Fe_By_Fm = (1/mMoon_By_mEarth)*(r_Moon/r_Earth)**2#\n",
"print \"Mass of 1 kg will weigh %.2f kg on moon\\n\"%(Fe_By_Fm)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.4 Page: 6"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.4 - Page: 6\n",
"\n",
"\n",
"The absolute pressure is 54.914 kPa\n",
"\n"
]
}
],
"source": [
"# Solution\n",
"\n",
"print \"Example: 1.4 - Page: 6\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"h = 40 # [cm]\n",
"density = 14.02 # [g/cubic cm]\n",
"g = 9.792 # [m/square s]\n",
"#*************#\n",
"\n",
"P = h*density*g/1000 # [N/square cm]\n",
"P = P*10 # [kPa]\n",
"\n",
"print \"The absolute pressure is %.3f kPa\\n\"%(P)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.5 Page: 7"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.5 - Page: 7\n",
"\n",
"\n",
"The absolute pressure within the container is 119.299 kPa\n",
"\n"
]
}
],
"source": [
"# Solution\n",
"\n",
"print \"Example: 1.5 - Page: 7\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"Patm = 112 # [kPa]\n",
"density = 1200 # [kg/cubic m]\n",
"g = 9.81 # [m/sqaure s]\n",
"h = 0.62 # [m]\n",
"#**************#\n",
"\n",
"P = Patm + (density*g*h/1000) # [kPa]\n",
"\n",
"print \"The absolute pressure within the container is %.3f kPa\\n\"%(P)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.6 Page: 9"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.6 - Page: 9\n",
"\n",
"\n",
"Work done by the system is 1500 J\n",
"\n"
]
}
],
"source": [
"# Solution\n",
"\n",
"print \"Example: 1.6 - Page: 9\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"F = 150 # [N]\n",
"Displacement = 10 # [m]\n",
"#**************#\n",
"\n",
"W = F*Displacement # [J]\n",
"\n",
"print \"Work done by the system is %d J\\n\"%(W)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.7 Page: 9"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.7 - Page: 9\n",
"\n",
"\n",
"Actual Work done by the system is 9.1e+05 J\n",
"\n"
]
}
],
"source": [
"# Solution\n",
"\n",
"print \"Example: 1.7 - Page: 9\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"P = 560*10**3 # [Pa]\n",
"Vinit = 3 # [cubic m]\n",
"Vfinal = 5 # [cubic m]\n",
"Wext = 210*10**3 # [J]\n",
"#*************#\n",
"\n",
"W = P*(Vfinal - Vinit) # [J]\n",
"# Again the system receives 210 kJ of work from the external agent.\n",
"W = W - Wext # [J]\n",
"\n",
"print \"Actual Work done by the system is %.1e J\\n\"%(W)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.8 Page: 11"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.8 - Page: 11\n",
"\n",
"\n",
"Change in potential Energy is 981 J\n",
"\n"
]
}
],
"source": [
"# Solution\n",
"\n",
"print \"Example: 1.8 - Page: 11\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"g = 9.81 # [m/square s]\n",
"Z = 100 # [m]\n",
"#***************#\n",
"\n",
"# Basis: 1 kg of water\n",
"m = 1 # [kg]\n",
"Ep = m*g*Z # [J]\n",
"print \"Change in potential Energy is %d J\\n\"%(Ep)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.9 Page: 11"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.9 - Page: 11\n",
"\n",
"\n",
"The velocity of the metal block is 15.34 m/s\n",
"\n",
"The final Kinetic Energy is 1765.8 J\n",
"\n"
]
}
],
"source": [
"from __future__ import division\n",
"# Solution\n",
"\n",
"print \"Example: 1.9 - Page: 11\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"m = 15# # [kg]\n",
"g = 9.81 # [m/square s]\n",
"V1 = 0 # [m/square s]\n",
"Z1 = 12 # [m]\n",
"Z2 = 0 # [m]\n",
"#***************#\n",
"\n",
"# At initial condition, V1 = 0, so kinetic energy is zero.\n",
"# At final condition, Z2 = 0, so potential energy is zero.\n",
"# Ep1 + Ek1 = Ep2 + Ek2\n",
"#deff('[y] = f(V2)','y = ((1/2)*m*V1**2) + (m*g*Z1) - (((1/2)*m*V2**2) + (m*g*Z2))')#\n",
"def f(V2):\n",
" y = ((1/2)*m*V1**2) + (m*g*Z1) - (((1/2)*m*V2**2) + (m*g*Z2))\n",
" return y\n",
"from scipy.optimize import fsolve\n",
"V2 = fsolve(f,7)#\n",
"\n",
"print \"The velocity of the metal block is %.2f m/s\\n\"%(V2)#\n",
"\n",
"Ek2 = (1/2)*m*V2**2 # [J]\n",
"print \"The final Kinetic Energy is %.1f J\\n\"%(Ek2)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.10 Page: 12"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.10 - Page: 12\n",
"\n",
"\n",
"Power required is 7.64 kW\n",
"\n"
]
}
],
"source": [
"# Solution\n",
"\n",
"print \"Example: 1.10 - Page: 12\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"m = 1200 # [kg]\n",
"v1 = 10 # [km/h]\n",
"v2 = 100 # [km/h]\n",
"time = 1 # [min]\n",
"#***************#\n",
"\n",
"v1 = 10*1000/3600 # [m/s]\n",
"v2 = 100*1000/3600 # [m/s]\n",
"W = (1/2)*m*(v2**2 - v1**2) # [J]\n",
"time = time*60 # [s]\n",
"P = W/time # [W]\n",
"print \"Power required is %.2f kW\\n\"%(P/1000)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.11 Page: 13"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.11 - Page: 13\n",
"\n",
"\n",
"Total Force eacting upon the gas is 8139.7 N\n",
"\n",
"Pressure exerted is 115.153 kPa\n",
"\n",
"\n",
"Work due to expansion by the gas is 4.070 kJ\n",
"\n",
"\n",
"Change in Potential Energy is 489.6 J\n",
"\n"
]
}
],
"source": [
"from math import pi\n",
"print \"Example: 1.11 - Page: 13\\n\\n\"\n",
"\n",
"#*****Data*****#\n",
"dia = 0.3 # [m]\n",
"m = 100 # [kg]\n",
"P_atm = 1.013*10**5 # [N/square m]\n",
"g = 9.792 # [m/square s]\n",
"#**************#\n",
"\n",
"Area = (pi/4)*dia**2 # [square m]\n",
"#Solution (a)(i)\n",
"# Force exerted by the atmosphere:\n",
"F_atm = P_atm*Area # [N]\n",
"# Force exerted by piston & metal block:\n",
"F_mass = m*g # [N]\n",
"# Total force acting upon the gas:\n",
"F = F_atm + F_mass # [N]\n",
"print \"Total Force eacting upon the gas is %.1f N\\n\"%(F)#\n",
"\n",
"# Solution (a)(ii)\n",
"Pressure = F/Area # [N/square m]\n",
"print \"Pressure exerted is %.3f kPa\\n\\n\"%(Pressure/1000)#\n",
"\n",
"# Solution (b)\n",
"# The gas expands on application of heat, the volume of the gas goes on increasing and the piston moves upward.\n",
"Z = 0.5 # [m]\n",
"# Work done due to expansion of gas:\n",
"W = F*Z # [J]\n",
"print \"Work due to expansion by the gas is %.3f kJ\\n\\n\"%(W/1000)#\n",
"\n",
"# Solution (c)\n",
"# Change in potential energy of piston and weight after expansion process:\n",
"Ep = m*g*Z # [J]\n",
"print \"Change in Potential Energy is %.1f J\\n\"%(Ep)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.12 Page: 24"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.12 - Page: 24\n",
"\n",
"\n",
"The temperature which has the same value on both the centigrade and Fahrenheit scales is -40 degree Celsius or -40 degree Fahrenheit\n",
"\n"
]
}
],
"source": [
"print \"Example: 1.12 - Page: 24\\n\\n\"\n",
"\n",
"# Solution\n",
"\n",
"# The relation is:\n",
"# (C/5) = ((F - 32)/9)\n",
"# For C = F\n",
"C = - (32*5/4)# # [degree Celsius]\n",
"print \"The temperature which has the same value on both the centigrade and Fahrenheit scales is %d degree Celsius or %d degree Fahrenheit\\n\"%(C,C)#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example: 1.13 Page: 24"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Example: 1.13 - Page: 24\n",
"\n",
"\n",
"The rise in temperature in the Kelvin scale is 30 K\n",
"\n",
"The rise in temperature in the Rankine scale is 54 R\n",
"\n",
"The rise in temperature in the Fahrenheit scale is 54 OF\n",
"\n"
]
}
],
"source": [
"print \"Example: 1.13 - Page: 24\\n\\n\"\n",
"\n",
"# Solution\n",
"\n",
"#*****Data*****#\n",
"delta_T_C = 30 # [OC]\n",
"#*************#\n",
"\n",
"# The relation between the Kelvin temperature scale and the Celsius temperature scale:\n",
"# T(K) = T(OC) + 273.15\n",
"# Here, the temperature rise is to be expressed in terms of K, but the difference in temperature will be the same in the Kelvin and Celsius scales of temperature:\n",
"delta_T_K = delta_T_C # [K]\n",
"print \"The rise in temperature in the Kelvin scale is %d K\\n\"%(delta_T_K)#\n",
"# The emperical relationship between the Rankine and Kelvin scales is given by:\n",
"delta_T_R = 1.8*delta_T_K # [R]\n",
"print \"The rise in temperature in the Rankine scale is %d R\\n\"%(delta_T_R)#\n",
"delta_T_F = delta_T_R # [OF]\n",
"print \"The rise in temperature in the Fahrenheit scale is %d OF\\n\"%(delta_T_F)#"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|