summaryrefslogtreecommitdiff
path: root/Electronic_Devices_and_Circuits_by_J._Paul/Ch2.ipynb
blob: 1385990a8fe936803e8fb84980bba2a0d53ddfd4 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 2 - Semiconductor Diodes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 99 example 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of reverse saturation current   =   4963.36\n"
     ]
    }
   ],
   "source": [
    "q=0.01##centimetre\n",
    "sigma1=1##ohm centimetre inverse\n",
    "q1=0.01##centimetre\n",
    "sigm11=0.01##ohm centimetre inverse\n",
    "iratio=(0.0224**2*2.11*20)*3.6**2/((3.11*(4.3**2*10**-6)**2*2.6*20*10**3))#\n",
    "for q in range(0,2):\n",
    "    if q==1:\n",
    "        un=3800#\n",
    "        up=1500#\n",
    "        q=1.6*10**-19#\n",
    "        ni=2.5*10#\n",
    "    else:\n",
    "        q=1.6*10**-19#\n",
    "        up=500\n",
    "        un=1300#\n",
    "        ni=1.5*10\n",
    "\n",
    "    \n",
    "    b=un/up#\n",
    "    sigmai=(un+up)*q*ni#\n",
    "\n",
    "print \"ratio of reverse saturation current   =   %0.2f\"%((iratio))\n",
    "##correction required in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 100 example 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "reverse current ratio   =   7.79e-09\n"
     ]
    }
   ],
   "source": [
    "sigma1=0.01##ohm centimetre inverse\n",
    "area11=4*10**-3##metre square\n",
    "q=0.01*10**-2##metre\n",
    "un=1300.0#\n",
    "up=500.0#\n",
    "ni=1.5*10**15##per cubic centimetre\n",
    "sigma1=(un+up)*1.6*10**-19*ni#\n",
    "iratio=(4*10**-10*0.026*sigma1**2*2.6*2/10**-4)/3.6**2#\n",
    "print \"reverse current ratio   =   %0.2e\"%((iratio))\n",
    "##correction required in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 100 example 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "reverse saturation current   =   3.48e-06 ampere\n"
     ]
    }
   ],
   "source": [
    "a=4*10**-4##metre square\n",
    "sigmap=1#\n",
    "sigman=0.1#\n",
    "de=0.15#\n",
    "vtem=26*10**-3#\n",
    "i=(a*vtem*((2.11)*(0.224))/((3.22)**(2)))*((1/de*sigman)+(1/de*sigmap))#\n",
    "print \"reverse saturation current   =   %0.2e\"%(i),\"ampere\"#correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 101 example 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage at which the reverse saturation current at saturate   =   -0.06 volt\n",
      "reverse saturation current   =   -6.84 ampere\n",
      "reverse saturation current 0.10    =   0.000 ampere\n",
      "reverse saturation current 0.20    =   0.022 ampere\n",
      "reverse saturation current 0.30    =   1.026 ampere\n"
     ]
    }
   ],
   "source": [
    "from math import log, exp\n",
    "w=0.9#\n",
    "voltaf=0.05##volt\n",
    "revcur=10*10**-6##ampere\n",
    "#(1) voltage\n",
    "volrev=0.026*(log((-w+1)))##voltage at which the reverse saturation current at saturate\n",
    "resacu=((exp(voltaf/0.026)-1)/((exp(-voltaf/0.026)-1)))##reverse saturation current\n",
    "print \"voltage at which the reverse saturation current at saturate   =   %0.2f\"%((volrev)),\"volt\"\n",
    "print \"reverse saturation current   =   %0.2f\"%((resacu)),\"ampere\"\n",
    "u=0.1#\n",
    "for q in range(0,3):\n",
    "        reverc=revcur*(exp((u/0.026))-1)\n",
    "        print \"reverse saturation current %0.2f\"%((u)),\"   =   %0.3f\"%((reverc)),\"ampere\"\n",
    "        u=u+0.1#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 103 example 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "capacitance   =   7.08e-11 farad\n"
     ]
    }
   ],
   "source": [
    "a=1*10**-6##metre square\n",
    "w=2*10**-6##thick centimetre\n",
    "re=16#\n",
    "eo=8.854*10**-12#\n",
    "c=(eo*re*a)/w#\n",
    "print \"capacitance   =   %0.2e\"%(c),\"farad\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 105 example 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "width of depletion layer at -10.00    =   7.73e-06 metre\n",
      "width of depletion layer at -0.10    =   1.33e-06 metre\n",
      "width of depletion layer at 0.10    =   7.65e-07 metre\n",
      "capacitance at -10.00    =   1.57e-11 farad\n",
      "capacitance at -0.10    =   9.13e-11 farad\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "volbar=0.2##barrier voltage for germanium volt\n",
    "na=3*10**20##atoms per metre\n",
    "#(1) width of depletion layer at 10 and 0.1 volt\n",
    "\n",
    "for q in [-10, -0.1, 0.1]:\n",
    "    w=2.42*10**-6*sqrt((0.2-(q)))#\n",
    "    print \"width of depletion layer at %0.2f\"%((q)),\"   =   %0.2e\"%((w)),\"metre\"#for -0.1volt correction in the book\n",
    "\n",
    "#(d) capacitance\n",
    "for q in [-10, -0.1]:\n",
    "    capaci=0.05*10**-9/sqrt(0.2-q)#\n",
    "    print \"capacitance at %0.2f\"%((q)),\"   =   %0.2e\"%((capaci)),\"farad\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 104 example 8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum forward current   =   2.22 ampere\n",
      "forward diode resistance   =   0.40 ohm\n"
     ]
    }
   ],
   "source": [
    "p=2##watts\n",
    "voltaf=900*10**-3##volt\n",
    "i1=p/voltaf#\n",
    "r1=voltaf/i1#\n",
    "print \"maximum forward current   =   %0.2f\"%(i1),\"ampere\"\n",
    "\n",
    "\n",
    "print \"forward diode resistance   =   %0.2f\"%(r1),\"ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 108 example 11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha   =   104.86 degree\n"
     ]
    }
   ],
   "source": [
    "from math import atan, degrees\n",
    "r=250##ohm\n",
    "c=40*10**-6##farad\n",
    "alpha1=180-degrees(atan(377*r*c))\n",
    "print \"alpha   =   %0.2f\"%(alpha1),\"degree\"       "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 109 example 12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "inductance   =   3022899.27 henry\n",
      "output voltage   =   31.03 volt\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "i1=0.1##current in ampere\n",
    "vms=40##rms voltage in volts\n",
    "c=40*10**-6##capacitance in farad\n",
    "r1=50##resistance in ohms\n",
    "ripple=0.0001#\n",
    "induct=((1.76/c)*sqrt(0.472/ripple))##inductance\n",
    "outv=(2*sqrt(2)*vms)/3.14-i1*r1##output voltage\n",
    "print \"inductance   =   %0.2f\"%(induct),\"henry\"#correction in the book\n",
    "print \"output voltage   =   %0.2f\"%(outv),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 109 example 14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ripple voltage   =   0.093 volt\n",
      "ripple voltage including filters   =   118.49 volt\n",
      "ripple voltage   =   0.0040 volt\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "voltag=40##volt\n",
    "i1=0.2##ampere\n",
    "c1=40*10**-6##farad\n",
    "c2=c1#\n",
    "induct=2##henry\n",
    "#(1) ripple\n",
    "vdc=2*sqrt(2)*voltag/3.14#\n",
    "r1=vdc/i1#\n",
    "induc1=r1/1130#\n",
    "v1=voltag/(3*3.14**3*120**2*4*induct*c1)#\n",
    "print \"ripple voltage   =   %0.3f\"%((v1)),\"volt\"\n",
    "#(2) with two filter\n",
    "v1=4*voltag/((3*3.14**5)*(16*120**2*induct**2*c1**2))#\n",
    "print \"ripple voltage including filters   =   %0.2f\"%((v1)),\"volt\"#correction in the book\n",
    "#(3)ripple voltage\n",
    "v1=4*voltag/(5*3.14*1.414*2*3.14*240*240*3.14*induct*c1)#\n",
    "v1=v1/20#\n",
    "print \"ripple voltage   =   %0.4f\"%((v1)),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 111 example 15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage and ripple with load\n",
      "vdc   =   250.21 volt\n",
      "ripple   =   3.13e-02\n",
      "capacitance connected across load\n",
      "vdc   =   497.91 volt\n",
      "ripple   =   3.76e-02\n",
      "filter containing two inductors and capacitors in parallel\n",
      "vdc   =   250.00 volt\n",
      "ripple   =   6.48e-04\n",
      "two filter\n",
      "vdc   =   250.00 volt\n",
      "ripple   =   4.76e-06\n",
      "vdc   =   358.26 volt\n",
      "ripple   =   1.61e-04\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt\n",
    "voltag=375##volt\n",
    "r1=2000##ohm\n",
    "induct=20##henry\n",
    "c1=16*10**-6##farad\n",
    "r11=100##ohm\n",
    "r=200##ohm\n",
    "#(1) voltage and ripple with load\n",
    "print \"voltage and ripple with load\"\n",
    "r=r+r11+400#\n",
    "vdc=((2*sqrt(2)*voltag/3.14))/1.35#\n",
    "ripple=r1/(3*sqrt(2)*(377)*induct*2)#\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))\n",
    "#(2) capacitance connected across load\n",
    "print \"capacitance connected across load\"\n",
    "vdc=sqrt(2)*voltag/(1+1/(4*(60)*r1*2*c1))#\n",
    "ripple=1/(4*sqrt(3)*(60)*r1*2*c1)#\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))\n",
    "#(3) filter containing two inductors and capacitors in parallel\n",
    "print \"filter containing two inductors and capacitors in parallel\"\n",
    "vdc=250##volt\n",
    "ripple=0.83*10**-6/(2*induct*2*c1)##correction in the book\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))\n",
    "#(4) two filter\n",
    "print \"two filter\"\n",
    "vdc=250#\n",
    "ripple=sqrt(2)/(3*16*3.14**2*60**2*induct*c1)**2##correction in the book\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))\n",
    "vdc=sqrt(2)*voltag/(1+(4170/(r1*16))+(r/r1))#\n",
    "ripple=3300/(16**2*2*20*r1)#\n",
    "print \"vdc   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple   =   %0.2e\"%((ripple))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 112 example 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "output voltage   =   362.14 volt\n",
      "ripple voltage   =   1.46e-03\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "capaci=4##farad\n",
    "induct=20##henry\n",
    "i1=50*10**-3##ampere\n",
    "resist=200##ohm\n",
    "maxvol=300*sqrt(2)#\n",
    "vdc=maxvol-((4170/capaci)*(i1))-(i1*resist)#\n",
    "ripple=(3300*i1)/((capaci**2)*(induct)*353)#\n",
    "print \"output voltage   =   %0.2f\"%((vdc)),\"volt\"\n",
    "print \"ripple voltage   =   %0.2e\"%((ripple))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 113 example 17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "inductance of filter   =   4.98 henry\n",
      "resistance of filter   =   250.00 ohm\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "voltag=25##volt\n",
    "c1=10*10**-6##farad\n",
    "i1=100*10**-3##ampere\n",
    "ripple=0.001#\n",
    "w=754##radians\n",
    "#(1) inductance and resistance\n",
    "\n",
    "\n",
    "r1=voltag/i1#\n",
    "induct=40/(sqrt(2)*w**2*(c1))#\n",
    "print \"inductance of filter   =   %0.2f\"%((induct)),\"henry\"#correction in the book\n",
    "print \"resistance of filter   =   %0.2f\"%((r1)),\"ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 113 example 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "current   =   2.83e-04 ampere\n",
      "current at 100celsius rise\n",
      "current   =   6.81e-04 ampere\n"
     ]
    }
   ],
   "source": [
    "from math import exp\n",
    "resacu=0.1*10**-12##ampere\n",
    "u=20+273##kelvin\n",
    "voltaf=0.55##volt\n",
    "w=1.38*10**-23#\n",
    "q=1.6*10**-19#\n",
    "for z in range(1,3):\n",
    "    if z==2 :\n",
    "        u=100+273#\n",
    "        print \"current at 100celsius rise\"\n",
    "    \n",
    "    voltag=w*u/q#\n",
    "    i1=(10**-13)*(exp((voltaf/voltag))-1)#\n",
    "    if z==2:\n",
    "        i1=(256*10**-13)*((exp(voltaf/voltag)-1))#\n",
    "    \n",
    "    print \"current   =   %0.2e\"%((i1)),\"ampere\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 114 example 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "thermal voltage   =   0.026 volt\n",
      "barrier voltage   =   0.535 volt\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "na=10*22##atoms per cubic metre\n",
    "nd=1.2*10**21##donor per cubic metre\n",
    "voltag=1.38*10**-23*(273+298)/(1.6*10**-19)##correction in the book\n",
    "voltag=0.026#\n",
    "ni=1.5*10**16#\n",
    "ni=ni**2#\n",
    "v1=voltag*log((na*nd)/(ni))#\n",
    "print \"thermal voltage   =   %0.3f\"%((voltag)),\"volt\"\n",
    "print \"barrier voltage   =   %0.3f\"%(abs(v1)),\"volt\"#correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 114 example 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "current   =   9.16e-06 ampere\n"
     ]
    }
   ],
   "source": [
    "from math import exp\n",
    "i1=2*10**-7##ampere\n",
    "voltag=0.026##volt\n",
    "i=i1*((exp(0.1/voltag)-1))#\n",
    "print \"current   =   %0.2e\"%((i)),\"ampere\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 115 example 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistance at 150mvolt   =   80.74 ohm\n"
     ]
    }
   ],
   "source": [
    "from math import exp\n",
    "resacu=1*10**-6##ampere\n",
    "voltaf=150*10**-3##volt\n",
    "w=8.62*10**-5#\n",
    "voltag=0.026##volt\n",
    "u=300##kelvin\n",
    "uw=u*w#\n",
    "resist=(uw)/((resacu)*exp(voltaf/voltag))#\n",
    "print \"resistance at 150mvolt   =   %0.2f\"%((resist)),\"ohm\"#correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 115 example 22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in barrier   =   0.18 volt\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "dopfac=1000#\n",
    "w=300##kelvin\n",
    "q=0.026*log(dopfac)#\n",
    "print \"change in barrier   =   %0.2f\"%((q)),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 116 example 23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "depletion capacitance   =   1.09e-11 farad\n",
      "capacitance   =   3.85e-07 farad\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "area12=1*10**-8##metre square\n",
    "volre1=-1##reverse voltage\n",
    "capac1=5*10**-12##farad\n",
    "volbu1=0.9##volt\n",
    "voltag=0.5##volt\n",
    "i1=10*10**-3##ampere\n",
    "durmin=1*10**-6##ssecond\n",
    "#(1) capacitance\n",
    "capac1=capac1*sqrt((volre1-volbu1)/(voltag-volbu1))#\n",
    "print \"depletion capacitance   =   %0.2e\"%((capac1)),\"farad\"\n",
    "#(2) capacitance\n",
    "capac1=i1*durmin/(0.026)#\n",
    "\n",
    "print \"capacitance   =   %0.2e\"%((capac1)),\"farad\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 116 example 24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential germanium   =   0.34 volt\n",
      "potential silicon   =   0.74 volt\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "quantg=4*10**22##atoms per cubic centimetre\n",
    "quants=5*10**22##atoms per cubic centimetre\n",
    "w=2.5*10**13##per cubic centimetre\n",
    "w1=1.5*10**10##per cubic centimetre\n",
    "for q in [quantg, quants]:\n",
    "    na=2*q/(10**8)\n",
    "    nd=500*na#\n",
    "    if q==quantg :\n",
    "        w=w#\n",
    "        voltag=0.026*log(na*nd/w**2)#\n",
    "        print \"potential germanium   =   %0.2f\"%((voltag)),\"volt\"\n",
    "    \n",
    "    if q==quants:\n",
    "        w=w1#\n",
    "        voltag=0.026*log(na*nd/w**2)#\n",
    "        print \"potential silicon   =   %0.2f\"%((voltag)),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 117 example 25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "electrons density   =   9.62e+20 per cubic metre\n",
      "holes density   =   1.25e+23 per cubic metre\n"
     ]
    }
   ],
   "source": [
    "u=0.05##metre square per velocity second correction in the book\n",
    "un=0.13##metre square per velocity second\n",
    "condun=20##second per metre conductivity of n region\n",
    "condup=1000##second per metre conductivity of p region\n",
    "p=condup/(1.6*10**-19*u)#\n",
    "no=condun/(1.6*10**-19*un)#\n",
    "print \"electrons density   =   %0.2e\"%((no)),\"per cubic metre\"\n",
    "print \"holes density   =   %0.2e\"%((p)),\"per cubic metre\"#others to find is not in the book"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}