summaryrefslogtreecommitdiff
path: root/Material_Science/material_science_ch_8.ipynb
blob: 400defdab4b50626a3989408f4464e3ea38afd4c (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
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8.: Statics and Band theory of Solids"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1, page no-208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Fermi Energy of metals\n",
      "\n",
      "import math\n",
      "# variable declaration\n",
      "d_cu=8.96*10**3                         # density of cu\n",
      "a_cu=63.55                              # Atomic weight of cu\n",
      "d_z=7.14*10**3                          # density of Zn     \n",
      "a_z=65.38                               # Atomic weight of Zn\n",
      "d_al=2700                               # density of Al\n",
      "a_al=27                                 # Atomic weight of Al     \n",
      "avg=6.022*10**26                        # Avogadro's number    \n",
      "h=6.626*10**-34                         # Planck's constant\n",
      "m=9.1*10**-31                           # mass of an electrons\n",
      "e=1.6*10**-19                           # charge of an electron\n",
      "\n",
      "\n",
      "\n",
      "#(i)\n",
      "\n",
      "# Calculations\n",
      "n_cu=d_cu*avg/a_cu\n",
      "e_cu=(h**2/(8*m))*(3*n_cu/math.pi)**(2.0/3.0)\n",
      "e_cu=e_cu/e\n",
      "\n",
      "#Result\n",
      "print(\"\\n(i)For Cu\\nThe electron concentration in Cu is %.4f*10^28 per m^3\\nFermi energy at 0 k =%.4f eV \"%(n_cu*10**-28,e_cu))\n",
      "\n",
      "#(ii)\n",
      "\n",
      "# calculations\n",
      "n_z=d_z*avg*2/a_z\n",
      "e_z=(h**2/(8*m))*(3*n_z/math.pi)**(2.0/3.0)\n",
      "e_z=e_z/e\n",
      "\n",
      "# Result\n",
      "print(\"\\n(ii)For Zn\\nThe electron concentration in Zn is %.5f*10^28 per m^3\\nFermi energy at 0 k =%.2f eV \"%(n_z*10**-28,e_z))\n",
      "\n",
      "#(iii)\n",
      "\n",
      "# Calculations\n",
      "n_al=d_al*avg*3/a_al\n",
      "e_al=(h**2/(8*m))*(3*n_al/math.pi)**(2.0/3.0)\n",
      "e_al=e_al/e\n",
      "\n",
      "#Result\n",
      "print(\"\\n(iii)For Al\\nThe electron concentration in Al is %.3f*10^28 per m^3\\nFermi energy at 0 k =%.2f eV \"%(n_al*10**-28,e_al))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "(i)For Cu\n",
        "The electron concentration in Cu is 8.4905*10^28 per m^3\n",
        "Fermi energy at 0 k =7.0608 eV \n",
        "\n",
        "(ii)For Zn\n",
        "The electron concentration in Zn is 13.15298*10^28 per m^3\n",
        "Fermi energy at 0 k =9.45 eV \n",
        "\n",
        "(iii)For Al\n",
        "The electron concentration in Al is 18.066*10^28 per m^3\n",
        "Fermi energy at 0 k =11.68 eV \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2, page no-210"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Density of states for Cu\n",
      "\n",
      "import math\n",
      "# variable declaration\n",
      "avg=6.023*10**26                            # avogadro's number\n",
      "h=6.626*10**-34                             # Planck's constant \n",
      "m=9.1*10**-31                               # mass of an electron\n",
      "e=1.6*10**-19                               # charge of an electron\n",
      "n=8.4905*10**28                             # sphere of radius\n",
      "gam=6.82*10**27                             # gamma\n",
      "\n",
      "# Calculations\n",
      "ef=(h**2/(8*m))*(3*n/math.pi)**(2.0/3.0)\n",
      "ef=ef/e\n",
      "x=(gam*math.sqrt(ef))/2\n",
      "\n",
      "#Result\n",
      "print(\"The density of states for Cu at the Fermi level for T = 0 K is %.0f*10^27 m^-3\"%(x*10**-27))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The density of states for Cu at the Fermi level for T = 0 K is 9*10^27 m^-3\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3, page no-210"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Nordheims coeeficient\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "rni=63                            # Resistivity of Ni\n",
      "rcr=129                           # Resistivity of Cr\n",
      "k=1120                            # Resistivity of 80% Ni + 20% Cr\n",
      "\n",
      "#Calculations\n",
      "c=(k*10**-9)/(0.8*(1-0.8))\n",
      "\n",
      "#Result\n",
      "print(\"The Nordheims coeeficient is %.0f *10^-6 Ohm-m\"%(c*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Nordheims coeeficient is 7 *10^-6 Ohm-m\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4, page no-211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Conductivity of Al\n",
      "\n",
      "import math\n",
      "#Variable declaaration\n",
      "d=2700                            # Density of Al\n",
      "awt=27                            # Atomic weight\n",
      "t=10**-14                         # Relaxation time\n",
      "e=1.6*10**-19                     # charge of an electron\n",
      "m=9.1*10**-31                     # mass of an electron\n",
      "avg=6.022*10**26                  # Avogadros number\n",
      "\n",
      "# calculation\n",
      "n=avg*d*3/awt\n",
      "sig=(n*t*e**2)/m\n",
      "\n",
      "#Result\n",
      "print(\"The conductivity of Al is %.4f*10^7 ohm-m.\"%(sig*10**-7))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The conductivity of Al is 5.0823*10^7 ohm-m.\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5, page no-211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Fermi distribution function\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "e1=0.01                   # difference between energy level to fermi level in eV\n",
      "e=1.6*10**-19             # charge of an electron\n",
      "ed=e*e1                   # difference between energy level to fermi level in J\n",
      "T=200                     # Temperature\n",
      "k=1.38*10**-23            # Boltzmann's constant\n",
      "\n",
      "# Calculations\n",
      "E=1/(1+math.e**(ed/(T*k)))\n",
      "print(\"The Fermi distribution function for energy E is %.4f\"%E)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Fermi distribution function for energy E is 0.3590\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.6, page no-212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Fermi energy and fermi temperature\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "v=0.86*10**6                      # velocity of electron\n",
      "m=9.11*10**-31                     # mass of electron\n",
      "e=1.6*10**-19                     # electronic charge   \n",
      "k=1.38*10**-23                    # Boltzmann's constant \n",
      "\n",
      "#calculations\n",
      "E=(m*v**2)/2\n",
      "E= math.floor(E*10**22)/10**22\n",
      "T=E/k\n",
      "\n",
      "#Result\n",
      "print(\"\\nThe fermi energy is %.3f*10^-19 J\\nThe Fermi Temperature Tf is %.2f*10^4 K\"%(E*10**19,T*10**-4))\n",
      "# answer in the book for Temperature id 2.43 x 10^4"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The fermi energy is 3.368*10^-19 J\n",
        "The Fermi Temperature Tf is 2.44*10^4 K\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.7, page no-212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# No of states lying between energy levels\n",
      "\n",
      "import math\n",
      "# variable declaration\n",
      "m=9.1*10**-31                            # mass of electron\n",
      "dE=0.01                                  # energy interval\n",
      "h=6.63*10**-34                           # planck's constant\n",
      "eF=3.0                                   # Fermi energy\n",
      "e=1.6*10**-19                            # electronic charge\n",
      "\n",
      "#Calculations\n",
      "E1=eF*e\n",
      "E2=E1+e*dE\n",
      "n=(4*math.pi*(2*m)**(1.5))/h**3\n",
      "k=((2*0.3523/3)*((E2**(1.5)-(E1**(1.5)))))\n",
      "n=n*k\n",
      "\n",
      "#Result\n",
      "print(\"The number of states lying between the energy level is %.2f*10^25\"%(n*10**-25))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of states lying between the energy level is 4.14*10^25\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.8, page no-214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Fermi Velocity\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Tf=24600                       # Fermi temperature of the metal\n",
      "m=9.11*10**-31                 # mass of electron\n",
      "k=1.38*10**-23                 # Boltzmann's constant\n",
      "\n",
      "#Calculations\n",
      "vf=math.sqrt(2*k*Tf/m)\n",
      "\n",
      "#Result\n",
      "print(\"The Fermi Velocity is %.4f *10^6 m/s\"%(vf*10**-6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Fermi Velocity is 0.8633 *10^6 m/s\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.9, page no-214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Fermi energy\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "n=18.1*10**28                   # elecron density of electron\n",
      "h=6.62*10**-34                  # Planck's constant\n",
      "m=9.1*10**-31                   # mass of an electron\n",
      "e=1.6*10**-19                   # electronic charge\n",
      "\n",
      "#calculations\n",
      "ef=((3*n/(8*math.pi))**(2.0/3.0))*((h**2)/(2*m))\n",
      "ef=ef/e\n",
      "ef=math.ceil(ef*100)/100\n",
      "\n",
      "#Result\n",
      "print(\"The Fermi energy at 0 K is %.2f eV \"%(ef))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Fermi energy at 0 K is 11.68 eV \n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.10, page no-215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Fermi energy \n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "n=18.1*10**28                # elecron density of electron\n",
      "h=6.62*10**-34               # Planck's constant\n",
      "m=9.1*10**-31                # mass of an electron\n",
      "e=1.6*10**-19                # electronic charge\n",
      "\n",
      "#calculations\n",
      "ef=((3*n/(8*math.pi))**(2.0/3.0))*((h**2)/(2*m))\n",
      "ef=ef/e\n",
      "ef=math.ceil(ef*100)/100\n",
      "\n",
      "#result\n",
      "print(\"The Fermi energy at 0 K is %.2f eV \"%ef)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Fermi energy at 0 K is 11.68 eV \n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.11, page no-215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Temperature calculation\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "e=1.6*10**-19             # electronic charge\n",
      "Ed=0.5*e                  # difference between energy level to fermi level\n",
      "k=1.38*10**-23            # Boltzmann's constant\n",
      "x=0.01                    # probability\n",
      "\n",
      "#Calculaations\n",
      "T=Ed/(k*math.log((1/x)-1))\n",
      "\n",
      "#Result\n",
      "print(\"Temperature at which there is 1%% probability that a state with 0.5 eV energy occupied above the Fermi energy level is %.1f K\"%T)\n",
      "#answer is not matching with the answer given in the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature at which there is 1% probability that a state with 0.5 eV energy occupied above the Fermi energy level is 1261.6 K\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.14, page no-218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#energies for the occupying of electrons\n",
      "import math\n",
      "\n",
      "#variable declaration\n",
      "ef=2.1                      # Fermi energy\n",
      "k=1.38*10**-23              # Boltzmann's constant\n",
      "T=300                       # Temperature\n",
      "e=1.6*10**-19               # Electronic charge\n",
      "\n",
      "#calculations\n",
      "\n",
      "#(i)\n",
      "p1=0.99                     # probability\n",
      "E1=ef+(k*T*math.log(-1+1/p1))/e\n",
      "\n",
      "#(ii)\n",
      "p2=0.01                     # probability\n",
      "E2=ef+(k*T*math.log(-1+1/p2))/e\n",
      "\n",
      "#(iii)\n",
      "p3=0.5                     # probability\n",
      "E3=ef+(k*T*math.log(-1+1/p3))/e\n",
      "\n",
      "#Result\n",
      "\n",
      "print(\"\\nThe energies for the occupying of electrons at %d K for the probability of %.2f are %.2f eV\"%(T,p1,E1))\n",
      "\n",
      "print(\"\\nThe energies for the occupying of electrons at %d K for the probability of %.2f are %.2f eV\"%(T,p2,E2))\n",
      "\n",
      "print(\"\\nThe energies for the occupying of electrons at %d K for the probability of %.2f are %.2f eV\"%(T,p3,E3))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The energies for the occupying of electrons at 300 K for the probability of 0.99 are 1.98 eV\n",
        "\n",
        "The energies for the occupying of electrons at 300 K for the probability of 0.01 are 2.22 eV\n",
        "\n",
        "The energies for the occupying of electrons at 300 K for the probability of 0.50 are 2.10 eV\n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.15, page no-219"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Fermi distribution function\n",
      "\n",
      "import math\n",
      "# Variable declarations\n",
      "e=1.6*10**-19                       # Electronic charge\n",
      "ed=0.02*e                           # difference between energy level to fermi level\n",
      "T1=200                              # Temperature 1\n",
      "T2=400                              # Temperature 2\n",
      "k=1.38*10**-23                      # Boltzmann's constant\n",
      "\n",
      "#Calculations\n",
      "fe1=1/(1+math.e**(ed/(k*T1)))\n",
      "fe2=1/(1+math.e**(ed/(k*T2)))\n",
      "\n",
      "#Result\n",
      "print(\"\\nThe Fermi distribution function for the given energy at %d K is %.5f\"%(T1,fe1))\n",
      "print(\"\\nThe Fermi distribution function for the given energy at %d K is %.4f\"%(T2,fe2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The Fermi distribution function for the given energy at 200 K is 0.23877\n",
        "\n",
        "The Fermi distribution function for the given energy at 400 K is 0.3590\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.16, page no-220"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Fermi energy for given metal\n",
      "\n",
      "import math\n",
      "#Variaable declaration\n",
      "d=10500                           # Density of the metal\n",
      "avg=6.022*10**26                  # Avogadro's number\n",
      "awt=107.9                         # Atomic weight of metal\n",
      "h=6.62*10**-34                    # Planck's constant\n",
      "m=9.1*10**-31                     # mass of an electron\n",
      "e=1.6*10**-19                     # electronic charge\n",
      "\n",
      "#Calculattions\n",
      "n=d*avg/awt\n",
      "ef=((3*n/(8*math.pi))**(2.0/3.0))*((h**2)/(2*m))\n",
      "ef=ef/e\n",
      "\n",
      "#Result\n",
      "print(\"The Fermi energy for given metal is %.1f eV \"%ef)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Fermi energy for given metal is 5.5 eV \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.17, page no-221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Fermi distribution function \n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "e=1.6*10**-19                         # electronic charge\n",
      "ed=0.2*e                              # difference between energy level to Fermi level\n",
      "T1=300                                # Temperature 1\n",
      "T2=1000                               # Temperature 2\n",
      "k=1.38*10**-23                        # Boltzmann's constant\n",
      "\n",
      "#Calculations\n",
      "fe1=1/(1+math.e**(ed/(k*T1)))\n",
      "fe2=1/(1+math.e**(ed/(k*T2)))\n",
      "\n",
      "#Result\n",
      "print(\"\\nThe Fermi distribution function for the given energy at %d K is %.7f\"%(T1,fe1))\n",
      "print(\"\\nThe Fermi distribution function for the given energy at %d K is %.4f\"%(T2,fe2))\n",
      "# Answer for 300 K is wrong in the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The Fermi distribution function for the given energy at 300 K is 0.0004395\n",
        "\n",
        "The Fermi distribution function for the given energy at 1000 K is 0.0896\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.18, page no-221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Free electrons concentration\n",
      "\n",
      "import math\n",
      "#Variable declarations\n",
      "h=6.62*10**-34                         # Planck's constant\n",
      "m=9.1*10**-31                          # Mass of electron\n",
      "e=1.6*10**-19                          # Charge of an electron\n",
      "ef=3*e                                 # Fermi Energy\n",
      "\n",
      "#Calculations\n",
      "k=((3/(8*math.pi))**(2.0/3.0))*((h**2)/(2*m))\n",
      "k=ef/k\n",
      "n=k**(1.5)\n",
      "\n",
      "#Result\n",
      "print(\"The number of free electrons concentration in metal is %.2f *10^28 per cubic meter \"%(n*10**-28))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of free electrons concentration in metal is 2.36 *10^28 per cubic meter \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.19, page no-221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Free electrons concentration in metal  \n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "h=6.626*10**-34                     # Planck's constant\n",
      "m=9.1*10**-31                       # Mass of electron\n",
      "e=1.6*10**-19                       # Charge of electron\n",
      "ef=5.5*e                            # Fermi energy\n",
      "\n",
      "# Calculation\n",
      "k=((3/(8*math.pi))**(2.0/3.0))*((h**2)/(2*m))\n",
      "k=ef/k\n",
      "n=k**(1.5)\n",
      "\n",
      "#Result\n",
      "print(\"The number of free electrons concentration in metal is %.3f * 10^28 per cubic meter \"%(n*10**-28))\n",
      "#Answer is matching with the answer given in the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of free electrons concentration in metal is 5.837 * 10^28 per cubic meter \n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.20, page no-221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# electrons concentration and termal velocity of electrons\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "h=6.626*10**-34                             # Planck's constant\n",
      "m=9.1*10**-31                              # mass of electron\n",
      "e=1.6*10**-19                              # charge of electron\n",
      "ef=7*e                                     # Fermi energy\n",
      "\n",
      "#calculations\n",
      "k=((3/(8*math.pi))**(2.0/3.0))*((h**2)/(2*m))\n",
      "k=ef/k\n",
      "n=k**(1.5)\n",
      "vth=math.sqrt(2*ef/m)\n",
      "\n",
      "#Result\n",
      "print(\"The number of free electrons concentration in metal is %.2f *10^28 per cubic meter \"%(math.ceil(n*10**-28*10**2)/10**2))\n",
      "print(\"\\nThe termal velocity of electrons in copper is %.3f *10^6 m/s\"%(math.floor(vth*10**-6*10**3)/10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of free electrons concentration in metal is 8.39 *10^28 per cubic meter \n",
        "\n",
        "The termal velocity of electrons in copper is 1.568 *10^6 m/s\n"
       ]
      }
     ],
     "prompt_number": 41
    }
   ],
   "metadata": {}
  }
 ]
}