summaryrefslogtreecommitdiff
path: root/Heat_And_Thermodynamics_by_A_Manna/8-First_law_of_thermodynamics.ipynb
blob: b2fd7f2c0a6493b011a4ab82cf4040d38302ec5b (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
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
{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 8: First law of thermodynamics"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.10: The_final_temperature_and_pressure.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"p1=76;//inital pressure in cm\n",
"t1=290;//inital temperature in K\n",
"y=1.4;//coefficent of expansion\n",
"dv=2;//ratio of inital to fianl volume when air expands isothermally \n",
"dv1=2;//ratio of inital to final volume when air expands adiabatically\n",
"\n",
"//CALCULATIONS\n",
"p2=p1/dv;//final pressure when air expands isothermally in cm of hg\n",
"t2=t1;//final temperature when air expands isothermally in K\n",
"t3=t2*(1/dv1)^(y-1);//temprature when air expands adiabatically in K\n",
"p3=p2*(1/dv1)^(y);//final pressure when air expands adiabatically in mm of hg\n",
"\n",
"//OUTPUT\n",
"mprintf('final pressure when air expands isothermally in cm of hg %3.2f mm of hg \n final temperature when air expands isothermally is %3.2f K \n temprature when air expands adiabatically is %3.2f K \n final pressure when air expands adiabatically is %3.2f mm of hg',p2,t2,t3,p3)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.11: The_work_done.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"p=76*13.6*981;//pressure of air in dynes/sq.cm\n",
"v=11100;//volume expanded in ml\n",
"t1=273;//inital temperature in K\n",
"t2=274;//final temperature in K\n",
"cv=2.411;//specific heat at constant volume in cal/K\n",
"j=4.2*10^7;//joules constant in ergs/cal\n",
"//CALCULATIONS\n",
"w=p*v*log(t2/t1);//work done in ergs\n",
"h=cv*(t2-t1)+w/j;//heat supplied in cal\n",
"\n",
"//OUTPUT\n",
"mprintf('the work done is %3.2f erg \n the heat supplied is %3.3f cal',w,h)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.12: The_work_done.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"p=10^6;//pressure of air in dynes\n",
"d=0.0001293;//density of air in gm/cc\n",
"t1=273;//inital temperature in K\n",
"dv=2;//ratio of inital volume to final volume\n",
"y=1.4;//coefficient of expansion\n",
"\n",
"//CALCULATIONS\n",
"r=p/(d*t1);//universal gas constant in dynes.cc/gm.K\n",
"t2=t1*(dv)^(y-1);//final temperature in K\n",
"w=r*(t2-t1)/(y-1);//work done in adiabatic compression in ergs\n",
"\n",
"//OUTPUT\n",
"mprintf('work done in adiabatic compression is %3.2f ergs',w)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.13: The_change_in_internal_energy.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"m=5;//mass of air in gm\n",
"cv=0.172;//specific heat at constant volume cal/gm\n",
"dt=10;//changi in temperature in K\n",
"\n",
"//CALCULATIONS\n",
"ie=m*cv*dt;//change in internal energy in cal\n",
"\n",
"//OUTPUT\n",
"mprintf('change in internal energy is %3.2f cal',ie)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.14: The_heat_supplied.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"v1=10^3;//inital volume in cc\n",
"v2=2*v1;//final volume in cc\n",
"p1=76*13.6*981;//pressure in dyne/sq.cm\n",
"t1=273;//intial temperature in K\n",
"d=1.29;//density of the gas gm/lit\n",
"cv=0.168;//specific heat at constant volume in cal/gm\n",
"\n",
"//CALCULATIONS\n",
"t2=(v2/v1)*t1;//final temperature in K\n",
"r=0.068;//universal gas constant in cal\n",
"cp=cv+r;//specific heat at constant pressure in cal\n",
"q=d*cp*(t2-t1);//heat supplied in cal\n",
"\n",
"//OUTPUT\n",
"mprintf('the heat supplied to the gas is %3.2f cal',q)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.15: The_maximum_work_done.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"t=303;//temperature of the one mole of the argon in K\n",
"v1=1;//intial volume in litres\n",
"v2=10;//final volume in litres\n",
"r=8.31*10^7;//universal gas constant in ergs/K.mol\n",
"\n",
"//CALCULATIONS\n",
"w=r*t*log(v2/v1);//work done in isothermal expansion in ergs\n",
"\n",
"//OUTPUT\n",
"mprintf('the work done in isothermal expansion is %3.2f ergs',w)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.16: The_amount_of_heat_absorbed.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"dv=4;//final volume of neon in lit\n",
"t=273;//temperature of the gas in K\n",
"n=2.6/22.4;//the no.of moles of neon\n",
"r=1.98;//universal gas constant in cal/K.mol\n",
"\n",
"//CALCULATIONS\n",
"w=n*t*r*log(dv);//work done by gas in ergs\n",
"\n",
"//OUTPUT\n",
"mprintf('the work done by 2.6lit of neon is %3.2f ergs',w)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.18: The_temperature.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"dv=10^(-3);//ratio of initial and final volume\n",
"t1=10^5;//initial temperature in K\n",
"y=1.66;//coefficient of expansion\n",
"\n",
"//CALCULATIONS\n",
"t2=t1*(dv)^(y-1);//final temperature in K\n",
"\n",
"//OUTPUT\n",
"mprintf('final temperature of the gas is %3.2f K',t2)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.19: The_value_coefficient_of_expansion.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"p1=8;//intial pressure in cm of hg\n",
"p2=6;//final pressure in cm of hg\n",
"v1=1000;//intial volume in cc\n",
"v2=1190;//final volume in cc\n",
"\n",
"//CALCULATIONS\n",
"y=log(p1/p2)/log(v2/v1);//coefficient of expansion\n",
"\n",
"//OUTPUT\n",
"mprintf('the coefficent of expansion is %3.2f',y)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.1: The_change_in_internal_energy.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"l=80;//latent heat of fusion in cal\n",
"j=4.2*10^7;//joules constant in ergs/cal\n",
"w=-0.092*10^6;//work done in changing phase change in ergs\n",
"\n",
"//CALCULATIONS\n",
"q=l*j;//heat added in ergs\n",
"du=q-w;//internal energy in ergs\n",
"\n",
"//OUTPUT\n",
"mprintf('the change in internal energy is %3.2f ergs',du)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.2: The_change_in_internal_energy.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"m=1;//mass in gm\n",
"l=536;//latent heat in cal/gm\n",
"j=4.2*10^7;//joules constant in ergs/cal\n",
"v=1649;//volume of water in cc\n",
"p=76*13.6*981;//pressure of water in dynes/sq.cm\n",
"\n",
"//CALCULATIONS\n",
"dq=m*l*j;//heat supplied in ergs\n",
"dw=p*v;//work done in ergs\n",
"du=dq-dw;//internal energy developed in ergs\n",
"\n",
"//OUTPUT\n",
"mprintf('internal energy of water is %3.2f ergs',du)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.3: The_temperature_immediately_after_the_compressio.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"dv=10;//ratio of original volume to final volume\n",
"t1=293;//inital temperature in K\n",
"y=1.41;//coefficent of expansion\n",
"\n",
"//CALCULATIONS\n",
"t2=t1*(dv)^(y-1);//final temperature in K\n",
"\n",
"//OUTPUT\n",
"mprintf('the final temperature is %3.2f K',t2)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.4: The_change_in_temperature.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"t=273;//temperature of earth at height h in K\n",
"p=760;//pressure in mm of hg\n",
"dp=1;//change in pressure in mm of hg\n",
"y=1.418;//coefficient of expansion\n",
"\n",
"//CALCULATIONS\n",
"dt=((y-1)/y)*dp*t/p;//change in temperature in deg.C\n",
"\n",
"//OUTPUT\n",
"mprintf('the change in temperature is %3.3f deg.C',dt)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.5: The_resulting_drop_in_temperature.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"p1=2;//pressure initial in atm\n",
"p2=1;//pressure final in atm\n",
"t1=288;//inital temperature in K\n",
"y=1.4;//coefficent of expansion\n",
"\n",
"//CALCULATIONS\n",
"t2=t1*(p2/p1)^((y-1)/y);//final temperature in K\n",
"dt=t1-t2;//drop in temperature in K\n",
"\n",
"//OUTPUT\n",
"mprintf('drop in temperature is %3.2f K',dt)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.6: The_resultant_temperature.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"t1=288;//inital temperature in K\n",
"dv=1/2;//ratio of inital to final volume\n",
"y=1.4;//coefficient of expansion\n",
"\n",
"//CALCULATIONS\n",
"t2=t1*(dv)^(y-1);//final temperature in K\n",
"\n",
"//OUTPUT\n",
"mprintf('the final temperature is %3.1f K',t2)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.7: The_resultant_rise_in_temperatures_in_both_the_cases.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"y=1.4;//coefficent of exapnsion\n",
"p1=1;//standard pressure in atm\n",
"dv=50;//ratio of initial volume to final volume\n",
"t1=273;//standard temperature in K\n",
"\n",
"//CALCULATIONS\n",
"p2=p1*dv;//final pressure when slowly compressed in atm\n",
"p3=p1*(dv)^(y);//final pressure when suddenly compressed in atm\n",
"t2=t1*(dv)^(y-1);//rise in temperature when it is suddenly compressed in K\n",
"\n",
"//OUTPUT\n",
"mprintf('the final pressure when it is compressed slowly is %3fatm \n the final pressure when it is compressed suddenly is %3.2fatm \n the rise in temperature when it is suddenly compressed is %3.0fK',p2,p3,t2)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.8: The_rise_in_temperature.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"y=1.5;//coefficient of expansion\n",
"dp=1/8;//ratio of inital pressure to final pressure\n",
"t1=300;//inital tempreature in K\n",
"\n",
"//CALCULATIONS\n",
"t2=t1*(dp)^((1-y)/y);//change in temperature in K\n",
"t3=t2-t1;//rise in temperature in K\n",
"\n",
"//OUTPUT\n",
"mprintf('the rise in temperature is %3.2f K',t3)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 8.9: The_amount_of_work_done.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clc\n",
"clear\n",
"\n",
"//INPUT\n",
"t1=400;//inital temperature in K\n",
"dv=2;//ratio of volumes final and inital\n",
"r=8.31*10^7;//universal gas constant in ergs/kg.K\n",
"\n",
"//CALCULATIONS\n",
"w=r*t1*log(2);//work done in expanding isothermally in ergs\n",
"\n",
"//OUTPUT\n",
"mprintf('the work done in expanding isothermally is %3.2f ergs',w)"
   ]
   }
],
"metadata": {
		  "kernelspec": {
		   "display_name": "Scilab",
		   "language": "scilab",
		   "name": "scilab"
		  },
		  "language_info": {
		   "file_extension": ".sce",
		   "help_links": [
			{
			 "text": "MetaKernel Magics",
			 "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
			}
		   ],
		   "mimetype": "text/x-octave",
		   "name": "scilab",
		   "version": "0.7.1"
		  }
		 },
		 "nbformat": 4,
		 "nbformat_minor": 0
}