summaryrefslogtreecommitdiff
path: root/Semiconductor_Devices_Basic_Principle_by_J._Singh/chapter5.ipynb
blob: b2d3468e2e163c84dfe0bc28b58e8d6a7bdadf5d (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
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
{

 "metadata": {

  "name": "",

  "signature": "sha256:fe3dcc940fc59f790e074289cf01cde719f2ffc396107eb8d641ad2e7812dc13"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter5:JUNCTIONS IN SEMICONDUCTORS:P-N DIODES"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "\n",

      "Ex5.1:pg-169"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "Nd = 1.0*10**16 #initialising value of donor atoms in centimeter\n",

      "Na= 1.0*10**18 #initialising value of accepter atoms in centimeter\n",

      "Nc= 2.8*10**19 #initialising value of conduction band effective density\n",

      "Nv= 1.0*10**19 #initialising value of valence band effective density\n",

      "kbT = 0.026 #initializing value of kbT at 300K\n",

      "Eg = 1.1 #initializing value of forbidden energy gap\n",

      "#NOTE: nn=Nd and pp=Na\n",

      "eVbi = Eg+(kbT*log(Na/Nv))+((kbT*log(Nd/Nc)))\n",

      "print\"built in voltage is ,eVbi =  \",\"{:.2e}\".format(eVbi),\" eV\"\n",

      "apsilen = 11.9*8.85*10**-12 #initializing value of relative permitivity\n",

      "e = 1.6*10**-19 #initializing value of charge of electron\n",

      "Vbi=eVbi/e\n",

      "Nd = 1.0*10**22 #initialising value of donor atoms in metrers\n",

      "Na= 1.0*10**24 #initialising value of accepter atomsin meters\n",

      "Wp_Vbi = sqrt(((2*apsilen*eVbi)/(e))*(Nd/(Na*(Na+Nd))))\n",

      "print\"depletion width at p side is ,Wp_Vbi =\",\"{:.2e}\".format(Wp_Vbi),\" m\"\n",

      "Wn_Vo = 100*sqrt(((2*apsilen*eVbi)/(e))*(Nd/(Na*(Na+Nd))))\n",

      "print\"depletion width at n side is ,Wn_Vo = \",\"{:.2e}\".format(Wn_Vo),\" m\"\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "built in voltage is ,eVbi =   8.34e-01  eV\n",

        "depletion width at p side is ,Wp_Vbi = 3.30e-09  m\n",

        "depletion width at n side is ,Wn_Vo =  3.30e-07  m\n"

       ]

      }

     ],

     "prompt_number": 15

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.2:pg-172"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "Nd = 1.0*10**16 #initialising value of donor atoms in centimeter\n",

      "Na= 1.0*10**18 #initialising value of accepter atoms in centimeter\n",

      "ni = 1.5*10**10 #initializing value of intrinsic carrier concentration\n",

      "#NOTE: nn=Nd and pp=Na\n",

      "R= 10*10**-6 #initializing value of radius of pn diode\n",

      "A = math.pi*(R**2)\n",

      "pn = ni**2/Nd\n",

      "print\"concentration of electron in p type is ,pn = \",\"{:.2e}\".format(pn),\" cm**-3\"\n",

      "kbT = 0.026  #initializing value of kbT at 300K\n",

      "eVbi = (kbT*log(Na/pn))\n",

      "print\"built in voltage is ,eVbi =\",\"{:.2e}\".format(eVbi),\" V\"\n",

      "apsilen = 11.9*8.84*10**-12 #initializing value of relative permitivity\n",

      "e = 1.6*10**-19 #initializing value of charge of electron\n",

      "#NOTE: for reverse bias Vr = 0 V,\n",

      "Wp_4 = sqrt(((2.0*apsilen*eVbi)/(e))*((Nd*1.0*10**6)/((Na*1.0*10**6)*((Nd*1.0*10**6)+(Na*1.0*10**6)))))\n",

      "print\"depletion width at p side is ,Wp_4 =\",\"{:.2e}\".format(Wp_4),\"m\"\n",

      "Wn_4 = Wp_4*100\n",

      "print\"depletion width at n side is ,Wn_4 = \",\"{:.2e}\".format(Wn_4),\"m\"\n",

      "\n",

      "#for calculation purpose and for differentiating part (I), equating\n",

      "Vbi_4 = eVbi\n",

      "Vbi_4=round(Vbi_4,3)\n",

      "print(\"\")# for spacing \n",

      "Vbi_2 = Vbi_4 + 2\n",

      "Vbi_2=round(Vbi_2,3)\n",

      "#NOTE: for reverse bias Vr = 2 V,\n",

      "Wp_2 = Wp_4*sqrt(Vbi_2/Vbi_4)\n",

      "print\"depletion width at p side is ,Wp_2 = \",\"{:.2e}\".format(Wp_2),\"m\"\n",

      "Wn_2 = Wp_2*100\n",

      "print\"depletion width at n side is ,Wn_2  = \",\"{:.2e}\".format(Wn_2),\"m\"\n",

      "\n",

      "print(\"\")# for spacing\n",

      "Vbi_3 = Vbi_4 + 5\n",

      "Vbi_3=round(Vbi_3,2)\n",

      "#NOTE: for reverse bias Vr = 5 V,\n",

      "Wp_3 = sqrt(((2.0*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_3/Vbi_4)\n",

      "print\"depletion width at p side is ,Wp_3 =  \"\"{:.2e}\".format(Wp_3),\"m\"\n",

      "Wn_3 = Wp_3*100\n",

      "print\"depletion width at n side is ,Wn_3 = \",\"{:.2e}\".format(Wn_3),\"m\"\n",

      "print(\"\")# for spacing\n",

      "Vbi_4 = Vbi_4 + 10\n",

      "Vbi_4=round(Vbi_4,2)\n",

      "#NOTE: for reverse bias Vr = 10 V,\n",

      "\n",

      "Wp_4 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_4/Vbi_4)\n",

      "print\"depletion width at p side is ,Wp_4 =  \",\"{:.2e}\".format(Wp_4),\"m\"\n",

      "Wn_4 = Wp_4*100\n",

      "print\"depletion width at n side is ,Wn_4 = \",\"{:.2e}\".format(Wn_4),\"m\"\n",

      "\n",

      "print(\"\")# for spacing\n",

      "Vbi_5 = Vbi_4 - 0.5\n",

      "Vbi_5=round(Vbi_5,2)\n",

      "#NOTE: for forward bias Vf = 0.5 V,\n",

      "\n",

      "Wp_5 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_5/Vbi_4)\n",

      "print\"depletion width at p side is ,Wp_5 =\",\"{:.2e}\".format(Wp_5),\"m\"\n",

      "Wn_5 = Wp_5*100\n",

      "print\"depletion width at n side is ,Wn_5 = \",\"{:.2e}\".format(Wn_5),\"m\"\n",

      "\n",

      "#CALCULATION   FOR    PEAK FIELD :\n",

      "F =  - e*Nd*(10**6)*Wn_4/apsilen\n",

      "print\"F=\",\"{:.2e}\".format(F),\"v/m\"\n",

      "F =  - e*Nd*(10**6)*Wn_2/apsilen\n",

      "print\"F=\",\"{:.2e}\".format(F),\"v/m\"\n",

      "F =  - e*Nd*(10**6)*Wn_3/apsilen\n",

      "print\"F=\",\"{:.2e}\".format(F),\"v/m\"\n",

      "F =  - e*Nd*(10**6)*Wn_4/apsilen\n",

      "print\"F=\",\"{:.2e}\".format(F),\"v/m\"\n",

      "F =  - e*Nd*(10**6)*Wn_5/apsilen\n",

      "print\"F=\",\"{:.2e}\".format(F),\"v/m\"\n",

      "#calculation for \n",

      "Q = e*(Nd*10**6)*Wn_4*A#charge in depletion region for Vr = 0V\n",

      "print\"Q = \",\"{:.2e}\".format(Q),\"C\"\n",

      "#due to approximation taken by author in the textbook .... the values of Vbi_2, Vbi_3, Vbi_4 and \n",

      "#the values of depletion width(Wp_4, Wp_2,Wp_3, Wp_4, Wn_4, Wn_2, Wn_3, Wn_4) differ from the above solution\n",

      "# The answer of the textbook can be different due to different precision \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "concentration of electron in p type is ,pn =  2.25e+04  cm**-3\n",

        "built in voltage is ,eVbi = 8.17e-01  V\n",

        "depletion width at p side is ,Wp_4 = 3.26e-09 m\n",

        "depletion width at n side is ,Wn_4 =  3.26e-07 m\n",

        "\n",

        "depletion width at p side is ,Wp_2 =  6.06e-09 m\n",

        "depletion width at n side is ,Wn_2  =  6.06e-07 m\n",

        "\n",

        "depletion width at p side is ,Wp_3 =  8.71e-09 m\n",

        "depletion width at n side is ,Wn_3 =  8.71e-07 m\n",

        "\n",

        "depletion width at p side is ,Wp_4 =   3.26e-09 m\n",

        "depletion width at n side is ,Wn_4 =  3.26e-07 m\n",

        "\n",

        "depletion width at p side is ,Wp_5 = 3.19e-09 m\n",

        "depletion width at n side is ,Wn_5 =  3.19e-07 m\n",

        "F= -4.96e+06 v/m\n",

        "F= -9.21e+06 v/m\n",

        "F= -1.32e+07 v/m\n",

        "F= -4.96e+06 v/m\n",

        "F= -4.84e+06 v/m\n",

        "Q =  1.64e-13 C\n"

       ]

      }

     ],

     "prompt_number": 19

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.3:pg-173"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import cmath\n",

      "Nd = 1.0*10**16\n",

      "Na= 1.0*10**18\n",

      "ni = 1.5*10**10\n",

      "#NOTE: nn=Nd and pp=Na\n",

      "R= 10*10**-6\n",

      "A = math.pi*(R**2)\n",

      "pn = ni**2/Nd\n",

      "print\"concentration of electron in p type is ,pn = \",\"{:.2e}\".format(pn),\" cm**-3\"\n",

      "kbT = 0.026\n",

      "eVbi = (kbT*log(Na/pn))\n",

      "print\"built in voltage is ,eVbi= \",\"{:.2e}\".format(eVbi),\" V\"\n",

      "apsilen = 11.9*8.84*10**-12\n",

      "e = 1.6*10**-19\n",

      "#NOTE: for reverse bias Vr = 0 V,\n",

      "Wp_4 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))\n",

      "print\"depletion width at p side is ,Wp_4 =  \",\"{:.2e}\".format(Wp_4),\"m\"\n",

      "Wn_4 = Wp_4*100\n",

      "print\"depletion width at n side is ,Wn_4  = \",\"{:.2e}\".format(Wn_4),\"m\"\n",

      "#for calculation purpose and for differentiating part (I), equating\n",

      "Vbi_4 = eVbi\n",

      "print(\"\")# for spacing \n",

      "Vbi_2 = Vbi_4 + 2\n",

      "#NOTE: for reverse bias Vr = 2 V,\n",

      "Wp_2 = Wp_4*sqrt(Vbi_2/Vbi_4)\n",

      "print\"depletion width at p side is ,Wp_2 = \",\"{:.2e}\".format(Wp_2),\"m\"\n",

      "Wn_2 = Wp_2*100\n",

      "print\"depletion width at n side is ,Wn_2 =  \",\"{:.2e}\".format(Wn_2),\"m\"\n",

      "print(\"\")# for spacing\n",

      "Vbi_3 = Vbi_4 + 5\n",

      "#NOTE: for reverse bias Vr = 5 V,\n",

      "Wp_3 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_3/Vbi_4)\n",

      "print\"depletion width at p side is ,Wp_3 = \",\"{:.2e}\".format(Wp_3),\"m\"\n",

      "Wn_3 = Wp_3*100\n",

      "print\"depletion width at n side is ,Wn_3 =  \",\"{:.2e}\".format(Wn_3),\"m\"\n",

      "print(\"\")# for spacing\n",

      "Vbi_4 = Vbi_4 + 10\n",

      "#NOTE: for reverse bias Vr = 10 V,\n",

      "Wp_4 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_4/Vbi_4)\n",

      "print\"depletion width at p side is ,Wp_4 =  \",\"{:.2e}\".format(Wp_4),\"m\"\n",

      "Wn_4 = Wp_4*100\n",

      "print\"depletion width at n side is ,Wn_4 =\",\"{:.2e}\".format(Wn_4),\"m\"\n",

      "print(\"\")# for spacing\n",

      "Vbi_5 = Vbi_4 - 0.5\n",

      "#NOTE: for forward bias Vf = 0.5 V,\n",

      "Wp_5 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_5/Vbi_4)\n",

      "print\"depletion width at p side is ,Wp_5 =\",\"{:.2e}\".format(Wp_5),\"m\"\n",

      "Wn_5 = Wp_5*100\n",

      "print\"depletion width at n side is ,Wn_5 =\",\"{:.2e}\".format(Wn_5),\"m\"\n",

      "#CALCULATION   FOR    PEAK FIELD :\n",

      "Fm =  - e*Nd*(10**6)*Wn_4/apsilen\n",

      "print\"peak Field For Vr = 0V, Fm =  \",\"{:.2e}\".format(Fm),\"V/m\"\n",

      "Fm =  - e*Nd*(10**6)*Wn_2/apsilen\n",

      "print\"peak Field for Vr = 2V, Fm =\",\"{:.2e}\".format(Fm),\"V/m\"\n",

      "Fm =  - e*Nd*(10**6)*Wn_3/apsilen\n",

      "print\"peak Field For Vr = 5V, Fm =  \",\"{:.2e}\".format(Fm),\"V/m\"\n",

      "Fm =  - e*Nd*(10**6)*Wn_4/apsilen\n",

      "print\"peak Field For Vr = 10V, Fm =   \",\"{:.2e}\".format(Fm),\"V/m\"\n",

      "print\"By the appendix B given in the book, the velocity of electron: v = 1*10**7 cm/s\"\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "concentration of electron in p type is ,pn =  2.25e+04  cm**-3\n",

        "built in voltage is ,eVbi=  8.17e-01  V\n",

        "depletion width at p side is ,Wp_4 =   3.26e-09 m\n",

        "depletion width at n side is ,Wn_4  =  3.26e-07 m\n",

        "\n",

        "depletion width at p side is ,Wp_2 =  6.06e-09 m\n",

        "depletion width at n side is ,Wn_2 =   6.06e-07 m\n",

        "\n",

        "depletion width at p side is ,Wp_3 =  8.70e-09 m\n",

        "depletion width at n side is ,Wn_3 =   8.70e-07 m\n",

        "\n",

        "depletion width at p side is ,Wp_4 =   3.26e-09 m\n",

        "depletion width at n side is ,Wn_4 = 3.26e-07 m\n",

        "\n",

        "depletion width at p side is ,Wp_5 = 3.19e-09 m\n",

        "depletion width at n side is ,Wn_5 = 3.19e-07 m\n",

        "peak Field For Vr = 0V, Fm =   -4.96e+06 V/m\n",

        "peak Field for Vr = 2V, Fm = -9.21e+06 V/m\n",

        "peak Field For Vr = 5V, Fm =   -1.32e+07 V/m\n",

        "peak Field For Vr = 10V, Fm =    -4.96e+06 V/m\n",

        "By the appendix B given in the book, the velocity of electron: v = 1*10**7 cm/s\n"

       ]

      }

     ],

     "prompt_number": 24

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.4:pg-178"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "A= 10**-7\n",

      "Na=10**18*10**6\n",

      "Nd=10**16*10**6\n",

      "Dp1 = 7.8*10**-4\n",

      "Dn2 = 7.3*10**-4\n",

      "Tn = 10**-6\n",

      "Tp = 10**-6\n",

      "e = 1.6*10**-19\n",

      "kbT = 0.026\n",

      "ni = 1.5*10**16\n",

      "#NOTE: nn=Nd and pp=Na\n",

      "Lp = sqrt(Dp1*Tp)\n",

      "print\"The hole diffusion length is ,Lp =\",\"{:.2e}\".format(Lp),\"m\"\n",

      "Ln = sqrt(Dn2*Tn)\n",

      "print\"The electron diffusion length is ,Ln =\",\"{:.2e}\".format(Ln),\"m\"\n",

      "# NOTE: pn= (ni**2/nn) and np=(ni**2/pp)\n",

      "# assume that the doants are fully ionised \n",

      "Io = A*e*((((Dn2)/(Ln))*(ni**2/Na))+(((Dp1)/(Lp))*(ni**2/Nd)))\n",

      "print\"The prefactor current is ,Io =\",\"{:.1e}\".format(Io),\"A\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The hole diffusion length is ,Lp = 2.79e-05 m\n",

        "The electron diffusion length is ,Ln = 2.70e-05 m\n",

        "The prefactor current is ,Io = 1.0e-14 A\n"

       ]

      }

     ],

     "prompt_number": 5

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.5:pg-181"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "Na=10**17\n",

      "Nd=10**17\n",

      "Dp1 = 12.5\n",

      "Dn1 = 35\n",

      "Dp2 = 10\n",

      "Dn2 = 220\n",

      "Tn = 10**-8\n",

      "Tp = 10**-8\n",

      "e = 1.6*10**-19\n",

      "kbT = 0.026\n",

      "pn1 = 2.25*10**3\n",

      "np1 = 2.25*10**3\n",

      "pn2 = 3.38*10**-5\n",

      "np2 = 3.38*10**-5\n",

      "#Note : since value of holes and electrons in n- type and p type are not given for silicon and germanium thus we have assume it as above\n",

      "#NOTE: nn=Nd and pp=Na\n",

      "Lp1 = sqrt(Dp1*Tp)\n",

      "Ln1 = sqrt(Dn1*Tn)\n",

      "Lp2 = sqrt(Dp2*Tp)\n",

      "Ln2 = sqrt(Dn2*Tn)\n",

      "# NOTE: pn= (ni**2/nn) and np=(ni**2/pp)\n",

      "# assume that the doants are fully ionised \n",

      "Jo1 = e*((((Dn1)/(Ln1))*np1)+(((Dp1)/(Lp1))*pn1))\n",

      "print\"The prefactor current density for silicon is ,Jo1 =\",\"{:.2e}\".format(Jo1),\"A/cm**2\"\n",

      "Jo2 = e*((((Dn2)/(Ln2))*np2)+(((Dp2)/(Lp2))*pn2))\n",

      "print\"The prefactor current density for GaAs is ,Jo2 =\",\"{:.2e}\".format(Jo2),\"A/cm**2\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The prefactor current density for silicon is ,Jo1 = 3.40e-11 A/cm**2\n",

        "The prefactor current density for GaAs is ,Jo2 = 9.73e-19 A/cm**2\n"

       ]

      }

     ],

     "prompt_number": 4

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "\n",

      "Ex5.6:pg-182"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "Na=5*10**16\n",

      "Nd=5*10**17\n",

      "Dp = 15\n",

      "Dn = 30\n",

      "Tn = 10**-8\n",

      "Tp = 10**-7\n",

      "e = 1.6*10**-19\n",

      "kbT = 0.026\n",

      "ni = 1.84*10**6\n",

      "np=ni**2/Na\n",

      "print\"The electron conc in p type is ,np=\",\"{:.2e}\".format(np),\"cm**-3\"\n",

      "pn=ni**2/Nd\n",

      "print\"The holes conc in n type is ,pn=\",\"{:.2e}\".format(pn),\"cm**-3\"\n",

      "Lp = sqrt(Dp*Tp)\n",

      "print\"The hole diffusion length is ,Lp =\",\"{:.2e}\".format(Lp),\"cm\"\n",

      "Ln = sqrt(Dn*Tn)\n",

      "print\"The electron diffusion length is ,Ln =\",\"{:.2e}\".format(Ln),\"cm\"\n",

      "Gamma_inj = ((e*Dn*np)/(Ln))/(((e*Dn*np)/(Ln))+((e*Dp*pn)/(Lp)))\n",

      "print\"The efficiency of diode is ,Gamma_inj =\",round(Gamma_inj,2)"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The electron conc in p type is ,np= 6.77e-05 cm**-3\n",

        "The holes conc in n type is ,pn= 6.77e-06 cm**-3\n",

        "The hole diffusion length is ,Lp = 1.22e-03 cm\n",

        "The electron diffusion length is ,Ln = 5.48e-04 cm\n",

        "The efficiency of diode is ,Gamma_inj = 0.98\n"

       ]

      }

     ],

     "prompt_number": 8

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.7:pg-182"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "A= 0.1*10**-2\n",

      "Vf= 1.0\n",

      "E= 1.43\n",

      "Na=5.0*10**16\n",

      "Nd=5.0*10**17\n",

      "Dp = 15.0\n",

      "Dn = 30.0\n",

      "Tn =1*10**-8\n",

      "Tp = 1.0*10**-7\n",

      "e = 1.6*10**-19\n",

      "kbT = 0.026\n",

      "kni = 1.84*10**6\n",

      "np=ni**2/Na\n",

      "pn=ni**2/Nd\n",

      "Ln = sqrt(Dn*Tn)\n",

      "In = ((e*A*Dn*np)/Ln)*(exp(Vf/kbT)-1)\n",

      "print\"The electron current is ,In =\",\"{:.1e}\".format(In),\"A\"\n",

      "In_by_e = In/e\n",

      "print\"The electron generation rate is ,In_by_e = \",\"{:.1e}\".format(In_by_e),\"s**-1\"\n",

      "power = In*E\n",

      "print\"The optical power of photon is ,power =\",\"{:.1e}\".format(power),\"W\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The electron current is ,In = 3.0e-05 A\n",

        "The electron generation rate is ,In_by_e =  1.9e+14 s**-1\n",

        "The optical power of photon is ,power = 4.3e-05 W\n"

       ]

      }

     ],

     "prompt_number": 11

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "\n",

      "Ex5.8:pg-183"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "apsilen = 11.9*8.85*10**-14\n",

      "GL= 1.0*10**22\n",

      "A= 1.0*10**-4\n",

      "Vr= 15.0\n",

      "Na=2.0*10**16\n",

      "Nd=1.0*10**16\n",

      "Dp = 12.0\n",

      "Dn = 20.0\n",

      "Tn = 1.0*10**-8\n",

      "Tp = 1.0*10**-8\n",

      "e = 1.6*10**-19\n",

      "kbT = 0.026\n",

      "ni = 1.5*10**10\n",

      "Ln = sqrt(Dn*Tn)\n",

      "print\"The electron diffusion length is ,Ln =\",\"{:.1e}\".format(Ln),\"cm\"\n",

      "Lp = sqrt(Dp*Tp)\n",

      "print\"The hole diffusion length is ,Lp =  \",\"{:.2e}\".format(Lp),\"cm\"\n",

      "Vbi = kbT*log((Na*Nd)/ni**2)\n",

      "print\"The built in voltage is ,Vbi =\",\"{:.2e}\".format(Vbi),\"V\"\n",

      "W = sqrt(((2*apsilen)/e)*((Na+Nd)/(Na*Nd))*(Vbi+Vr))\n",

      "print\"The depletion width is ,W =\",\"{:.2e}\".format(W),\"cm\"\n",

      "IL = e*A*GL*(W+Ln+Lp)\n",

      "print\"The photo current is IL =\",\"{:.2e}\".format(IL),\"A\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The electron diffusion length is ,Ln = 4.5e-04 cm\n",

        "The hole diffusion length is ,Lp =   3.46e-04 cm\n",

        "The built in voltage is ,Vbi = 7.15e-01 V\n",

        "The depletion width is ,W = 1.76e-04 cm\n",

        "The photo current is IL = 1.55e-04 A\n"

       ]

      }

     ],

     "prompt_number": 13

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.9:pg-185"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "e = 1.6*10**-19\n",

      "A=1.0*10**-7\n",

      "Na=10**18*10**6\n",

      "Nd=10**16*10**6\n",

      "Dp = 7.8*10**-4\n",

      "Dn = 7.3*10**-4\n",

      "ni = 1.5*10**16\n",

      "Wln = 5.0*10**-6\n",

      "Wlp = Wln\n",

      "#NOTE: nn=Nd and pp=Na\n",

      "pn = ni**2/Nd\n",

      "np = ni**2/Na\n",

      "# from example 5.4 and 5.2 we get the value of diffusion length and zero bias depletion widths\n",

      "Lp = 27.9*10**-6\n",

      "print\"The electron diffusion length is ,Lp= \",\"{:.2e}\".format(Lp),\"m\"\n",

      "Ln = 27*10**-6\n",

      "print\"The electron diffusion length is ,Ln= \",\"{:.2e}\".format(Ln),\"m\"\n",

      "Wp = 3.2*10**-10\n",

      "print\"The zero bias depletion widths is ,Wp= \",\"{:.2e}\".format(Wp),\"m\"\n",

      "Wn = 0.0000003\n",

      "print\"The zero bias depletion widths is ,Wn \",\"{:.2e}\".format(Wn),\"m\"\n",

      "# for short diode the prefactor current is given as\n",

      "Io = e*A*(((Dp*pn)/(Wln-Wn))+((Dn*np)/abs(Wlp-Wp)))\n",

      "print\"The prefactor current is ,Io = \",\"{:.2e}\".format(Io),\"A\"\n",

      "# The prefactor current of short diode is approximately increase by a factor of 5.6 from that of long diode\n",

      "# Note : due to different precisions taken by me and the author ... my answer differ "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The electron diffusion length is ,Lp=  2.79e-05 m\n",

        "The electron diffusion length is ,Ln=  2.70e-05 m\n",

        "The zero bias depletion widths is ,Wp=  3.20e-10 m\n",

        "The zero bias depletion widths is ,Wn  3.00e-07 m\n",

        "The prefactor current is ,Io =  6.03e-14 A\n"

       ]

      }

     ],

     "prompt_number": 19

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.10:pg-188"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "e = 1.6*10**-19\n",

      "A= 10**-7\n",

      "ni = 1.5*10**16\n",

      "T = 1.0*10**-6\n",

      "# from example 5.2 we get the value of zero bias depletion widths\n",

      "W = 0.32*10**-6\n",

      "Io_GR = (e*A*W*ni)/(2*T)\n",

      "print\"The prefactor of the  is ,generation recombination currentIo_GR = \",\"{:.2e}\".format(Io_GR),\"A\"\n",

      "#let V = .2 V \n",

      "V = 0.2\n",

      "I_GR = Io_GR*(exp(V/(2*kbT))-1)\n",

      "print\"The diode current is ,I_GR =\",\"{:.2e}\".format(I_GR),\"A\"\n",

      "#let V = 0.6 V \n",

      "V = 0.6\n",

      "I_GR = Io_GR*(exp(V/(2*kbT))-1)\n",

      "print\"The diode current is ,I_GR = \",\"{:.2e}\".format(I_GR),\"A\"\n",

      "# The generation-recombination prefactor is much larger than prefactor due to diffusion term\n",

      "#In forward bias the diffusion current is initially much smaller than the generation recombination term but at high forward bias diffusion current will start to dominate\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The prefactor of the  is ,generation recombination currentIo_GR =  3.84e-11 A\n",

        "The diode current is ,I_GR = 1.76e-09 A\n",

        "The diode current is ,I_GR =  3.94e-06 A\n"

       ]

      }

     ],

     "prompt_number": 20

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "\n",

      "Ex5.11:pg-189"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "A= 1.0*10**-8\n",

      "Na=1.0*10**23\n",

      "Nd=1.0*10**23\n",

      "Dp = 10.0*10**-4\n",

      "Dn = 30.0*10**-4\n",

      "Tn = 1.0*10**-7\n",

      "Tp = 1.0*10**-7\n",

      "tau = 1.0*10**-8\n",

      "e = 1.6*10**-19\n",

      "kbT = 0.026\n",

      "ni = 1.5*10**16\n",

      "apsilen = 11.9*8.85*10**-12\n",

      "#NOTE: nn=Nd and pp=Na\n",

      "Lp = sqrt(Dp*Tp)\n",

      "print\"The hole diffusion length is ,Lp =  \",\"{:.2e}\".format(Lp),\"m\"\n",

      "Ln = sqrt(Dn*Tn)\n",

      "print\"The electron diffusion length is ,Ln = \",\"{:.2e}\".format(Ln),\"m\"\n",

      "# NOTE: pn= (ni**2/nn) and np=(ni**2/pp)\n",

      "np=ni**2/Na\n",

      "print\"The electron conc in p type is ,np=\",\"{:.2e}\".format(np),\"m**-3\"\n",

      "pn=ni**2/Nd\n",

      "print\"The holes conc in n type is ,pn=\",\"{:.2e}\".format(pn),\"m**-3\"\n",

      "Vbi = kbT*log((Na*Nd)/ni**2)\n",

      "print\"The built in voltage is ,Vbi =\",\"{:.2e}\".format(Vbi),\"V\"\n",

      "Io = e*((((Dn)*np)/(Ln))+((Dp*pn)/(Lp)))\n",

      "print\"The prefactor in the ideal diode  is ,Io =\",\"{:.2e}\".format(Io),\"A\"\n",

      "#let Vf = 0.5 V \n",

      "Vf = 0.5\n",

      "W = sqrt((2*apsilen/e)*((Na+Nd)/Nd/Na)*(Vbi-Vf))\n",

      "print\"The depletion width is ,W =\",\"{:.2e}\".format(W),\"m\"\n",

      "Io_GR  = e*A*W*ni/(2*tau)\n",

      "print\"prefactor for recombination generation current, Io_GR = \",\"{:.2e}\".format(Io_GR),\"A\"\n",

      "I = (Io*exp(Vf/kbT))+(Io_GR*exp(Vf/(2*kbT)))\n",

      "I_V1 = I\n",

      "print\"Current, I =\",\"{:.2e}\".format(I_V1),\"A\"\n",

      "#let V = 0.6 V \n",

      "Vf = 0.6\n",

      "W = sqrt((2*apsilen/e)*((Na+Nd)/Nd/Na)*(Vbi-Vf))\n",

      "print\"The depletion width is ,W =\",\"{:.2e}\".format(W),\"m\"\n",

      "Io_GR  = e*A*W*ni/2/tau\n",

      "print\"prefactor for recombination generation current, Io_GR = \",\"{:.1e}\".format(Io_GR),\"A\"\n",

      "I = (Io*exp(Vf/kbT))+(Io_GR*exp(Vf/(2*kbT)))\n",

      "I_V2 = I\n",

      "print\"Current, I =\",\"{:.2e}\".format(I_V2),\"A\"\n",

      "V1 = 0.5\n",

      "V2 = 0.6\n",

      "n = e*(V2-V1)/kbT/log(I_V2/I_V1)\n",

      "print\"Ideallity factor ,n =\",\"{:.2e}\".format(n)\n",

      "#note: in the text book the value of \n",

      "#-+\"prefactor of ideal diode equation, Io\" \n",

      "#calculated by author is wrong thus it efect the overall calculation of the solution ,so the answer in the are wrong of some of the values\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The hole diffusion length is ,Lp =   1.00e-05 m\n",

        "The electron diffusion length is ,Ln =  1.73e-05 m\n",

        "The electron conc in p type is ,np= 2.25e+09 m**-3\n",

        "The holes conc in n type is ,pn= 2.25e+09 m**-3\n",

        "The built in voltage is ,Vbi = 8.17e-01 V\n",

        "The prefactor in the ideal diode  is ,Io = 9.84e-08 A\n",

        "The depletion width is ,W = 9.14e-08 m\n",

        "prefactor for recombination generation current, Io_GR =  1.10e-10 A\n",

        "Current, I = 2.21e+01 A\n",

        "The depletion width is ,W = 7.56e-08 m\n",

        "prefactor for recombination generation current, Io_GR =  9.1e-11 A\n",

        "Current, I = 1.04e+03 A\n",

        "Ideallity factor ,n = 1.60e-19\n"

       ]

      }

     ],

     "prompt_number": 20

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.12:pg-195"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "apsilen = 11.9*8.85*10**-14\n",

      "Na=1.0*10**19\n",

      "Nd=1.0*10**16\n",

      "e = 1.6*10**-19\n",

      "Fcrit1 = 4.0*10**5\n",

      "Fcrit2 = 1.0*10**7\n",

      "VBD_Si = (apsilen*Fcrit1**2)/(2*e*Nd)\n",

      "print\"The breakdown field for silicon is ,VBD_Si =\",\"{:.2e}\".format(VBD_Si),\" V\"\n",

      "VBD_C = (apsilen*Fcrit2**2)/(2*e*Nd)\n",

      "print\"The breakdown field for diomond is ,VBD_C =\",\"{:.2e}\".format(VBD_C),\" V\"\n",

      "# Note : In the textbook answer of breakdown voltage of silicon is wrong due to which breakdown voltage of diomand also differ\n",

      "\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The breakdown field for silicon is ,VBD_Si = 5.27e+01  V\n",

        "The breakdown field for diomond is ,VBD_C = 3.29e+04  V\n"

       ]

      }

     ],

     "prompt_number": 11

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.13:pg-199"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import numpy as np\n",

      "print\"Let the intercept of the 1/c**2 Vs V plot is represented by Icv, which is the built in voltage\"\n",

      "Icv = 0.68\n",

      "Vbi = Icv\n",

      "print\"Let the slope of the intercept of the 1/c**2 Vs V plot is represented by dIcv\"\n",

      "dIcv=2.1*10**23\n",

      "C = 7.0*10**-13\n",

      "#NOTE: The above mentioned values are taken from the figure given in the question in textbook\n",

      "apsilen = 11.9*8.85*10**-12\n",

      "e = 1.6*10**-19\n",

      "kbT = 0.026\n",

      "A = 10**-7\n",

      "ni = sqrt(2.25*10**20)\n",

      "Neff = 2/(A**2*e*apsilen*dIcv)\n",

      "print\"The thickness of n region is ,Neff =\",\"{:.2e}\".format(Neff),\" m**-3\"\n",

      "Neff = Neff/10**6\n",

      "print\"The thickness of n region is ,Neff =\",\"{:.2e}\".format(Neff),\" cm**-3\"\n",

      "NaNd = exp(Vbi/kbT)*ni**2\n",

      "print\"NaNd =\",\"{:.2e}\".format(NaNd),\" cm**-6\"\n",

      "# solving for Na and Nd by creating a quadratic equation using the equations mentioned in the book\n",

      "p1 = [Neff*NaNd, -NaNd, Neff]\n",

      "#Neff*NaNd - NaNd*X + Neff*X**2 \n",

      "p1=p1[0]\n",

      "#p2=p1[1]\n",

      "print(p1)\n",

      "R= roots(p1)\n",

      "#s=roots(p2)\n",

      "Na= R\n",

      "#Nd= s\n",

      "#format ('e',10)\n",

      "#print\"Na = \"\"{:.2e}\".format(Na),\"cm**-3\"\n",

      "#print\"Nd = \"\"{:.2e}\".format(Nd),\"cm**-3\"\n",

      "W = (apsilen*A)/C\n",

      "print\"The thickness of n region is ,W =\",\"{:.1e}\".format(W),\" m\"\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Let the intercept of the 1/c**2 Vs V plot is represented by Icv, which is the built in voltage\n",

        "Let the slope of the intercept of the 1/c**2 Vs V plot is represented by dIcv\n",

        "The thickness of n region is ,Neff = 5.65e+19  m**-3\n",

        "The thickness of n region is ,Neff = 5.65e+25  cm**-3\n",

        "NaNd = 5.14e+31  cm**-6\n",

        "The thickness of n region is ,W = 1.5e-05  m\n"

       ]

      }

     ],

     "prompt_number": 30

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.14:pg-201"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import cmath\n",

      "e = 1.6*10**-19\n",

      "I= 1*10**-3\n",

      "kbT = 0.026\n",

      "Tp = 10**-6\n",

      "Gs = (I)/(kbT)\n",

      "print\"The diode conductance is Gs = \",\"{:.2e}\".format(Gs),\"A/V\"\n",

      "Cdiff = (I*Tp)/(2*kbT)\n",

      "print\"The diffusion capacitance is Cdiff =  \",\"{:.2e}\".format(Cdiff),\"F\"\n",

      "# The diffusion capacitance is much larger than junction capacitance hence neglecting junction capacitance\n",

      "Y = Gs+(1j*2*math.pi*10**6*Cdiff)\n",

      "print\"The admittance of the diode is Y =\",Y,\"A/V\"\n",

      "# Note : due to different precisions taken by me and the author ... my answer differ \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The diode conductance is Gs =  3.85e-02 A/V\n",

        "The diffusion capacitance is Cdiff =   1.92e-08 F\n",

        "The admittance of the diode is Y = (0.0384615384615+0.120830486677j) A/V\n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.15:pg-207"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "Vr= 10.0\n",

      "R= 10.0*10**3\n",

      "#The junction capacitance is 20pF at zero bias and 10 pF at full reverse bias so\n",

      "Cavg= ((20+10)/2)\n",

      "Tp = 10**-7\n",

      "Ir = (Vr)/(R)\n",

      "Tsd = Tp*log(2)\n",

      "print\"The storage delay time is Tsd = \",\"{:.2e}\".format(Tsd),\" s\"\n",

      "Tt = 2.3*R*Cavg*10**-12\n",

      "print\"The time Tt =  \",\"{:.2e}\".format(Tt),\" s\"\n",

      "T = Tsd+Tt\n",

      "print\"The total diode recovery time is T =  \",\"{:.2e}\".format(T),\" s\"\n",

      "# Note : due to different precisions taken by me and the author ... my answer differ \n",

      "\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The storage delay time is Tsd =  6.93e-08  s\n",

        "The time Tt =   3.45e-07  s\n",

        "The total diode recovery time is T =   4.14e-07  s\n"

       ]

      }

     ],

     "prompt_number": 1

    }

   ],

   "metadata": {}

  }

 ]

}