summaryrefslogtreecommitdiff
path: root/Thermodynamics:_A_Core_Course/CH3.ipynb
blob: fa64788f07f49e30173a157c8f09dcc2894524bc (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
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3:The first Law of Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1,Page no:18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "V1=14 \t\t\t\t#initial volume of cylinder in m3\n",
      "V2=9 \t\t\t\t#final volume of cylinder in m3\n",
      "P=2000 \t\t\t\t#pressure during the operation in N/m2\n",
      "U=(-6000) \t\t\t#internal energy of the system in J\n",
      "W=-P*(V2-V1) \t\t\t#work done during the operation in J\n",
      "Q=U-W \t\t\t\t#energy tranfered in form of heat in J\n",
      "print\"energy tranfered in form of heat is\",Q,\"J\"\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "energy tranfered in form of heat is -16000 J\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2,Page no:18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "R=8.314 \t\t\t\t#universal gas constant [J/K/mol]\n",
      "T=300\t\t\t\t\t#temperture for the process [K]\n",
      "U=0 \t\t\t\t\t#change in internal energy [J]\n",
      "V1=2.28 \t\t\t\t#initial volume [m3]\n",
      "V2=4.56 \t\t\t\t#final volume[m3]\n",
      "import math\n",
      "W=2.303*R*T*math.log10(V2/V1) \t\t#work done during the process[J]\n",
      "Q=W \t\t\t\t\t#heat lost or gained by the system[J]\n",
      "print\"The heat gained by the system is\",round(Q),\"J mol^-1\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat gained by the system is 1729.0 J mol^-1\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3,Page no:19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "H=29.2 \t\t\t\t\t#latent heat of vaporisation[KJ/mol]\n",
      "T=332 \t\t\t\t\t#temperature of the system[K]\n",
      "R=8.314 \t\t\t\t#universal gas constant [J/K/mol]\n",
      "Qp=H \t\t\t\t\t#at constant pressure [KJ]\n",
      "W=-R*0.001*T \t\t\t\t#workdone [KJ]\n",
      "U=Qp+W \t\t\t\t\t#change in internal energy[KJ]\n",
      "print\"Heat absorbed by the bromine vapours is\",Qp,\"KJ\"\n",
      "print\"\\nWorkdone during the process is\",round(W,2),\"KJ\"\n",
      "print\"\\nChange in internal energy of the system is\",round(U,2),\"KJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat absorbed by the bromine vapours is 29.2 KJ\n",
        "\n",
        "Workdone during the process is -2.76 KJ\n",
        "\n",
        "Change in internal energy of the system is 26.44 KJ\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4,Page no:20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "print\"C7H16(l) + 11O2(g) -> 7CO2(g) + 8H2O(l)\" \n",
      "n=-4 \t\t\t\t#change in no. of moles when reaction proceeds from reactants to \t\t\t\tproducts\n",
      "T=298 \t\t\t\t#temperature of the process [K]\n",
      "R=8.314 \t\t\t#universal gas constant [J/K/mol]\n",
      "Qv=-4800 \t\t\t#heat energy at constant volume [KJ]\n",
      "U=Qv \t\t\t\t#change in internal energy of system [KJ]\n",
      "H=U+n*R*0.001*T \t\t#change in enthalpy of the system[KJ]\n",
      "print\"the change in enthalpy of system is\",round(H,2),\"kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C7H16(l) + 11O2(g) -> 7CO2(g) + 8H2O(l)\n",
        "the change in enthalpy of system is -4809.91 kJ\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5,Page no:21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "n=1 \t\t\t\t#number of moles of an given ideal gas\n",
      "T=298 \t\t\t\t#temperature for the process[K]\n",
      "V1=8.3 \t\t\t\t#initial volume of the ideal gas[m3]\n",
      "V2=16.8 \t\t\t#final volume of the ideal gas[m3]\n",
      "R=8.314 \t\t\t#universal gas constant[J#K#mol]\n",
      "import math\n",
      "W=-2.303*R*T*math.log10(V2/V1) #[J]\n",
      "Q=-W \t\t\t\t#[J]\n",
      "print\"H=U+PV ,where U is change in internal energy which is zero due to isothermal process\" \n",
      "print\"PV where V is change in volume of system ,PV=RT & RT==0 since T i.e change in temp is zero for system\" \n",
      "print\"Therefore,the change in enthalpy is 0J\" \n",
      "print\"The workdone by system is\",round(W,1),\"J mol^-1\"\n",
      "print\"\\nThe heat evolved is\",round(Q,1),\"J mol^-1\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "H=U+PV ,where U is change in internal energy which is zero due to isothermal process\n",
        "PV where V is change in volume of system ,PV=RT & RT==0 since T i.e change in temp is zero for system\n",
        "Therefore,the change in enthalpy is 0J\n",
        "The workdone by system is -1747.3 J mol^-1\n",
        "\n",
        "The heat evolved is 1747.3 J mol^-1\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6,Page no:24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "T1=323 \t\t\t#intial temperature of water[K]\n",
      "T2=373 \t\t\t#final temperature of water[K]\n",
      "Cp=75.29 \t\t#specific heat of water[J/K/mol]\n",
      "w=100.0 \t\t\t#weight of water[g]\n",
      "mol_wt=18.0 \t\t#molecular weight of water[g/mol]\n",
      "n=w/mol_wt \t\t#no. of moles of water[moles]\n",
      "H=(n*Cp*(T2-T1))*0.001 \t#change in enthalpy of water[J]\n",
      "print\"The change in enthalpy of water is\",round(H,2),\"kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in enthalpy of water is 20.91 kJ\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7,Page no:29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"SO2 + 0.5O2 -> SO3\"\n",
      "U=-97030 \t\t\t#heat of reaction[J]\n",
      "n=1-(1+0.5) \t\t\t#change in no. of moles \n",
      "R=8.314 \t\t\t#universal gas constant[J/K/mol]\n",
      "T=298 \t\t\t\t#temperature during the reaction[K]\n",
      "H=U+n*R*T \t\t\t#change inenthalpy of reaction[J]\n",
      "print\"The change in enthalpy of reaction is\",round(H),\"J(approx)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "SO2 + 0.5O2 -> SO3\n",
        "The change in enthalpy of reaction is -98269.0 J(approx)\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.8,Page no:29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"i.C(s) + O2(g) -> CO2(g)\"\n",
      "H1=-393.5 \t\t#change in enthalpy [KJ/mol]\n",
      "T1=298 \t\t\t#temperature [K]\n",
      "n1=0 \t\t\t#change in no. of moles in reaction moving in forward direction\n",
      "R=0.008314 \t\t#universal gas constant [KJ/K/mol]\n",
      "\n",
      "U1=H1-n1*R*T1 \t\t#change in internal energy [KJ]\n",
      "print\"The change in internal energy is\",round(U1,1),\"KJ/mol\"\n",
      "\n",
      "print\"ii.C(s) + 0.5O2 -> CO(g)\" \n",
      "H2=-110.5 \t\t#change in enthalpy[KJ/mol]\n",
      "T2=298 \t\t\t#temperature[K]\n",
      "n2=1-0.5 \t\t#change in no. of moles in reaction moving in forward direction\n",
      "R=0.008314 \t\t#universal gas constant [KJ/K/mol]\n",
      "\n",
      "U2=H2-n2*R*T2 \t\t#change in internal energy [KJ]\n",
      "print\"The change in internal energy is\",round(U2,3),\"KJ/mol\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.C(s) + O2(g) -> CO2(g)\n",
        "The change in internal energy is -393.5 KJ/mol\n",
        "ii.C(s) + 0.5O2 -> CO(g)\n",
        "The change in internal energy is -111.739 KJ/mol\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.9,Page no:30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"The standard heat of combustion of\"\n",
      "print\"2C6H6(l)+ 15O2(g)-> 12 CO2(g)+ 6 H2O(l)\" \n",
      "print\"H1(standard heat of combustion)=-6536 KJ/mol\" \n",
      "H1=-6536 \t\t\t#standard heat of combustion [KJ/mol]\n",
      "print\"C6H6(l)+ 7.5 O2(g)-> 6 CO2(g)+ 6 H2O(l)\" \n",
      "H2=H1/2 \t\t\t#standard heat of combustion[KJ/mol]\n",
      "print\"H2(standard heat of combustion for 1 mole of C6H6)=\",H2,\"kJ/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The standard heat of combustion of\n",
        "2C6H6(l)+ 15O2(g)-> 12 CO2(g)+ 6 H2O(l)\n",
        "H1(standard heat of combustion)=-6536 KJ/mol\n",
        "C6H6(l)+ 7.5 O2(g)-> 6 CO2(g)+ 6 H2O(l)\n",
        "H2(standard heat of combustion for 1 mole of C6H6)= -3268 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.10,Page no:32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print\"N2(g)+3H2(g)-> 2NH3(g)\" \n",
      "H=-92.22 \t\t\t#standard heat of reaction [KJ/mol]\n",
      "H1=H/2 \t\t\t\t#standard heat of formation of 1 mole [KJ/mol]\n",
      "print\"H(heat of formation of 1 mole of product)=\",H1,\"kJ mol^-1\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "N2(g)+3H2(g)-> 2NH3(g)\n",
        "H(heat of formation of 1 mole of product)= -46.11 kJ mol^-1\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.11,Page no:32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "print\"C2H5OH(l)+3O2(g)->2CO2(g)+3H2O(l)\" \n",
      "T=298 \t\t\t\t#temperature during the reaction[K]\n",
      "Hw=-285.83 \t\t\t#standard heat of formation of liquid water [KJ/mol]\n",
      "He=-277.69 \t\t\t#standard heat of formation of liquid ethanol[KJ/mol]\n",
      "Hco2=-393.51 \t\t\t#standard heat of formation of carbon dioxide[KJ/mol]\n",
      "Ho2=0 \t\t\t\t#standard heat of formation of oxygen gas[KJ/mol]\n",
      "H=2*Hco2+3*Hw-He-3*Ho2 \t\t#standard heat of reaction\n",
      "print\"H(standard heat of reaction)=\",H,\"kJ\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C2H5OH(l)+3O2(g)->2CO2(g)+3H2O(l)\n",
        "H(standard heat of reaction)= -1366.82 kJ\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.12,Page no:33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "print\"CO(g)+NO(g)->0.5N2(g)+CO2(g)\" \n",
      "Hrxn=-374 \t\t#standard heat of reaction[KJ/mol]\n",
      "Hno=90.25 \t\t#standard heat of formation of NO[KJ/mol]\n",
      "Hco2=-393.51 \t\t#standard heat of formation of CO2[KJ/mol]\n",
      "Hn2=0 \t\t\t#standard heat of formation of N2[KJ/mol]\n",
      "T=298 \t\t\t#temperature of reaction [K]\n",
      "Hco=0.5*Hn2+Hco2-Hno-Hrxn \t#standard heat of formation of CO[KJ/mol]\n",
      "print\"Hco(standard heat of formation)=\",Hco,\"kJ mol^-1\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "CO(g)+NO(g)->0.5N2(g)+CO2(g)\n",
        "Hco(standard heat of formation)= -109.76 kJ mol^-1\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.13,Page no:34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "H1=-29.6 \t\t#the standard heat of hydrogenation of gaseous propylene to propane[Kcal]\n",
      "H2=-530.6 \t\t#the heat of combustion of propane[Kcal] \n",
      "H3=-94.0 \t\t#the heat of formation of carbon dioxide[Kcal]\n",
      "H4=-68.3 \t\t#the heat of formation of liquid water[Kcal]\n",
      "\n",
      "\n",
      "print\"C3H6(g)+4.5O2(g)->3CO2(g)+3H2O(l)\" \n",
      "H5=(3*H3+4*H4)-(H1+H2)#[Kcal]\n",
      "print\"\\n H(standard heat of combustion)=\",H5,\"Kcal\"\n",
      "print\"3C(s)+3H2(g)->C3H6(g)\" \n",
      "H6=-H5+3*H3+3*H4 #[Kcal]\n",
      "print\"\\n H(standard heat of formation)=\",H6,\"Kcal\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C3H6(g)+4.5O2(g)->3CO2(g)+3H2O(l)\n",
        "\n",
        " H(standard heat of combustion)= 5.0 Kcal\n",
        "3C(s)+3H2(g)->C3H6(g)\n",
        "\n",
        " H(standard heat of formation)= -491.9 Kcal\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.14,Page no:34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "H1=-114.1 \t\t\t#standard heat of reaction:2NO(g)+O2(g)->2NO2(g) [KJ/mol]\n",
      "H2=-110.2 \t\t\t#standard heat of reaction:4NO2(g)+O2(g)->2N2O5(g) [KJ/mol]\n",
      "H3=180.5 \t\t\t#standard heat of reaction:N2(g)+O2(g)->2NO(g) [KJ/mol]\n",
      "\n",
      "\t#reacton:N2(g)+2.5O2(g)->N2O5(g)\n",
      "H4=(2*H1+H2+2*H3)/2 \t\t#standard heat of formation of N2O5[KJ/mol]\n",
      "print\"H(standard heat of formation of N2O5)=\",H4,\"kJ/mol\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "H(standard heat of formation of N2O5)= 11.3 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.15,Page no:35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Hc=-5645 \t\t#standard enthalpy of combustion of \t\t\treaction:C12H22O11(s)+12O2(g)->12CO2(g)+11H2O(l) [KJ/mol]\n",
      "Hf1=-393.51 \t\t#standard heat of formation of CO2: C(s)+O2(g)->CO2(g) [KJ/mol]\n",
      "Hf2=-285.83 \t\t#standard heat of formation of H2O: H2(g)+0.5O2(g)->H2O(l) [KJ/mol]\n",
      "\n",
      "\t#reaction:12C(s)+11H2(g)+5.5O2(g)->C12H22O11(s)\n",
      "Hf=12*Hf1+11*Hf2-Hc \t#[KJ/mol]\n",
      "print\"Hf(standard heat of formation of solid sucrose)=\",Hf,\"KJ/mol(approx)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hf(standard heat of formation of solid sucrose)= -2221.25 KJ/mol(approx)\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.16,Page no:37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Hf1=-46.11 \t\t\t#standard heat of formation of NH3 at 298K \t\t\t\t#reaction:0.5N2(g)+1.5H2(g)->NH3(g) [KJ/mol]\n",
      "Cp1=29.125 \t\t\t#molar heat capacity at constant pressure for N2(g)[J/K/mol]\n",
      "Cp2=28.824 \t\t\t#molar heat capacity at constant pressure for H2(g)[J/K/mol]\n",
      "Cp3=35.06 \t\t\t#molar heat capacity at constant pressure for NH3(g)[J/K/mol]\n",
      "T1=298 \t\t\t\t#initial temperature[K]\n",
      "T2=400 \t\t\t\t#final temperature[K]\n",
      "\n",
      "\t\n",
      "Cp=Cp3-0.5*Cp1-1.5*Cp2 \t\t#[J/K/mol]\n",
      "T=T2-T1 \t\t\t#[K]\n",
      "Hf2=Hf1+Cp*0.001*T \t\t#standard heat of formation for NH3 at 400K[KJ/mol]\n",
      "print\"\\n Hf2(standard heat of formation for NH3 at 400K =\",round(Hf2,3),\"kJ/mol\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " Hf2(standard heat of formation for NH3 at 400K = -48.429 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.17,Page no:38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from scipy.optimize import fsolve\n",
      "from scipy import integrate\n",
      "dH_298=-241.82       #Std Heat of formation at 298 K [kJ mol^-1]\n",
      "dH_298=dH_298*1000   # in  [J mol^-1]\n",
      "T1=298               #[K]\n",
      "T2=1273             #[K]\n",
      "def f(T):\n",
      "    Cp_H2g=(29.07-((0.836*10**-3)*T)+((20.1*10**-7)*T**2))\n",
      "    Cp_O2g=25.72+(12.98*10**-3)*T-(38.6*10**-7)*T**2\n",
      "    Cp_H2Og=30.36+(9.61*10**-3)*T+(11.8*10**-7)*T**2\n",
      "    delta_Cp=(Cp_H2Og-(Cp_H2g+(1.0/2.0)*Cp_O2g))\n",
      "    return(delta_Cp)\n",
      "\n",
      "dHK=integrate.quad(f,T1,T2)\n",
      "\n",
      "dH_1273=dH_298+dHK[0]\n",
      "dH_1273=dH_1273/1000\n",
      "print\"Heat of formation of H2O(g) at 1000 C=\",round(dH_1273,1),\"kJ mol^-1  (APPROXIMATE)\"\n",
      "\n",
      "print\"NOTE:\"\n",
      "print\"Slight variation in answer,because integration is not done precisely in the book\"\n",
      "print\"In the book,it is written as:-7497.46 instead of -7504.3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat of formation of H2O(g) at 1000 C= -249.3 kJ mol^-1  (APPROXIMATE)\n",
        "NOTE:\n",
        "Slight variation in answer,because integration is not done precisely in the book\n",
        "In the book,it is written as:-7497.46 instead of -7504.3\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.18,Page no:40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "H1=435.0 \t\t\t#bond dissociation energy for: CH4->CH3+H [KJ/mol]\n",
      "H2=364.0 \t\t\t#bond dissociation energy for:CH3->CH2+H [KJ/mol]\n",
      "H3=385.0 \t\t\t#bond dissociation energy for:CH2->CH+H [KJ/mol] \n",
      "H4=335.0 \t\t\t#bond dissociation energy for:CH->C+H [KJ/mol]\n",
      "H=(H1+H2+H3+H4)/4 \t#the bond energy for C-H bond in CH4 [KJ/mol]\n",
      "print\"\\n H(the C-H bond energy in CH4)=\",round(H,1),\"kJ/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " H(the C-H bond energy in CH4)= 379.8 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.19,Page no:40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "H1=-84.68 \t\t\t#heat of formation : 2C(s)+3H2(g)->C2H6(g) [KJ/mol]\n",
      "H2=2*716.68 \t\t\t#heat of formation : 2C(s)->2C(g) [KJ]\n",
      "H3=3*436 \t\t\t#heat of formation : 3H2(g)->6H(g) [KJ]\n",
      "H4=412 \t\t\t\t#taking it as bond energy for one C-H bond[KJ/mol]\n",
      "\n",
      "\n",
      "H=H2+H3-H1 \t\t\t#heat of reaction : C2H6(g)->2C(g)+6H(g) [KJ/mol]\n",
      "H5=H-6*H4 \t\t\t#bond energy for one C-C bond in ethane bond [KJ/mol]\n",
      "print\"\\n Hc-c(bond energy for one C-C bond in ethane bond)=\",H5,\"kJ/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " Hc-c(bond energy for one C-C bond in ethane bond)= 354.04 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.20,Page no:42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t#MgBr2(s)-->Mg(s)+Br2(l)-->Mg(g)+Br2(l)-->Mg(g)+Br2(g)-->Mg(g)+2Br(g)-->Mg+2(g) + 2e(g) + \t2Br(g)-->Mg+2(g) + 2Br-(g)\n",
      "H1=-524 \t\t#enthalpy of formation of MgBr2(s) from its element [KJ/mol]\n",
      "H2=148 \t\t\t#enthalpy of sublimation of Mg(s) [KJ/mol]\n",
      "H3=31 \t\t\t#enthalpy of vaporization of Br2(l) [KJ/mol]\n",
      "H4=193 \t\t\t#enthalpy of dissociation Br2 to 2Br(g) [KJ/mol]\n",
      "H5=2187 \t\t#enthalpy of ionization of Mg(g) to Mg+2(g) [KJ/mol]\n",
      "H6=-650 \t\t#enthalpy of formation of Br-(g) [KJ/mol]\n",
      "\n",
      "H=-H1+H2+H3+H4+H5+H6 \t#lattice enthalpy [KJ/mol]\n",
      "print\"\\n H(lattice enthalpy of magnesium bromide)=\",H,\"kJ/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " H(lattice enthalpy of magnesium bromide)= 2433 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.21,Page no:44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from scipy.optimize import fsolve\n",
      "from scipy import integrate\n",
      "\n",
      "\n",
      "dH1_298=-881.25      #[kJ/mol]\n",
      "dH2_298=43.60        #[kJ/mol]\n",
      "dH3_298=2*dH2_298   #[kJ/mol]\n",
      "dH4_298=dH1_298+dH3_298     #[kJ/mol]\n",
      "dH_heat=-dH4_298*1000       #[J/mol]\n",
      "\n",
      "\n",
      "def f(T2):\n",
      "    def g(T):\n",
      "        Cp_CO2g=26.0+((43.5*10**-3)*T)-((148.3*10**-7)*T**2)\n",
      "        Cp_H2Og=30.36+((9.61*10**-3)*T)+((11.8*10**-7)*T**2)\n",
      "        Cp_N2g=27.30-((5.23*10**-3)*T)-((0.04*10**-7)*T**2)\n",
      "        sig_nCpf=Cp_CO2g+2*Cp_H2Og+8*Cp_N2g\n",
      "        return(sig_nCpf)\n",
      "    crt=integrate.quad(g,298,T2)\n",
      "    ct=crt[0]-dH_heat\n",
      "    return(ct)\n",
      "T2=fsolve(f,2)\n",
      "print \"T2,maximum flame temperature is :\",round(T2[0],2),\"K\"\n",
      "print\"Calculation mistake in book,wrongly written as:2250 K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T2,maximum flame temperature is : 2957.06 K\n",
        "Calculation mistake in book,wrongly written as:2250 K\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}