In [33]:

```
from __future__ import division
from math import log
# Given data
t = 4.4 * 10**22 # total number of Ge atoms/cm**3
n = 1 * 10**8 # number of impurity atoms
N_A = t/n # in atoms/cm**3
N_A = N_A * 10**6 # in atoms/m**3
N_D = N_A * 10**3 # in atoms/m**3
n_i = 2.5 * 10**13 # in atoms/cm**3
n_i = n_i * 10**6 # in atoms/m**3
V_T = 26 #in mV
V_T= V_T*10**-3 # in V
V_J = V_T * log((N_A * N_D)/(n_i)**2) # in V
print "Part (a) : The contact potential = %0.3f V " %V_J
# Part (b)
t = 5* 10**22 # total number of Si atoms/cm**3
N_A = t/n # in atoms/cm**3
N_A = N_A * 10**6 # in atoms/m**3
N_D = N_A * 10**3 # in atoms/m**3
n_i = 1.5 * 10**10 # in atoms/cm**3
n_i = n_i * 10**6 # in atoms/m**3
V_T = 26 #in mV
V_T= V_T*10**-3 # in V
V_J = V_T * log((N_A * N_D)/(n_i)**2) # in V
print "Part (b) : The contact potential = %0.3f V " %V_J
```

In [34]:

```
from math import log
from __future__ import division
# Given data
V_T = 26 # in mV
V_T=V_T*10**-3 # in V
n_i = 2.5 * 10**13
Sigma_p = 1
Sigma_n = 1
Mu_n = 3800
q = 1.6 * 10**-19 # in C
Mu_p = 1800
N_A = Sigma_p/(2* q * Mu_p) # in /cm**3
N_D = Sigma_n /(q * Mu_n) # in /cm**3
V_J = V_T * log((N_A * N_D)/(n_i)**2) # in V
print "For Ge the height of the energy barrier = %0.2f V " %V_J
# For Si p-n juction
n_i = 1.5 * 10**10
Mu_n = 1300
Mu_p = 500
N_A = Sigma_p/(2* q * Mu_p) # in /cm**3
N_D = Sigma_n /(q * Mu_n) # in /cm**3
V_J = V_T * log((N_A * N_D)/(n_i)**2) # in V
print "For Si p-n junction the height of the energy barrier = %0.3f V " %V_J
```

In [35]:

```
from math import exp
# Given data
Eta = 1
V_T = 26 # in mV
V_T= V_T*10**-3 # in V
# I = I_o * (exp(V/(Eta*V_T)) - 1) and I = -(0.9) * I_o
V= log(1-0.9)*V_T # in V
print "The voltage = %0.2f volts " %V
# Part (ii)
V1=0.05 # in V
V2= -0.05 # in V
ratio= (exp(V1/(Eta*V_T))-1)/(exp(V2/(Eta*V_T))-1)
print "The ratio of the current for a forward bias to reverse bias = %0.2f" %ratio
# Part (iii)
Io= 10 # in µA
Io=Io*10**-3 # in mA
#For
V=0.1 # in V
I = Io * (exp(V/(Eta*V_T)) - 1) # in mA
print "For v=0.1 V , the value of I = %0.3f mA " %I
#For
V=0.2 # in V
I = Io * (exp(V/(Eta*V_T)) - 1) # in mA
print "For v=0.2 V , the value of I = %0.1f mA " %I
#For
V=0.3 # in V
I = Io * (exp(V/(Eta*V_T)) - 1) # in mA
print "For v=0.3 V , the value of I = %0.2f A " %(I*10**-3)
print "From three value of I, for small rise in forward voltage, the diode current increase rapidly"
```

In [36]:

```
# Given data
# Part (i)
T1= 25 # in °C
T2= 80 # in °C
# Formula Io2= Io1*2**((T2-T1)/10)
AntiFactor= 2**((T2-T1)/10)
print "Anticipated factor for Ge = %0.f " %AntiFactor
# Part (ii)
T1= 25 # in °C
T2= 150 # in °C
AntiFactor= 2**((T2-T1)/10)
print "Anticipated factor for Si = %0.f " %AntiFactor
```

In [37]:

```
# Given data
I=5 # in µA
V=10 # in V
T1= 0.11 # in °C**-1
T2= 0.07 # in °C**-1
# Io+I_R=I (i)
# dI_by_dT= dIo_by_dT (ii)
# 1/Io*dIo_by_dT = T1 and 1/I*dI_by_dT = T2, So
Io= T2*I/T1 # in µA
I_R= I-Io # in µA
R= V/I_R # in MΩ
print "The leakage resistance = %0.1f MΩ " %R
```

In [38]:

```
from math import exp
# Given data
Eta = 1
T = 125 # in °C
T = T + 273 # in K
V_T = 8.62 * 10**-5 * 398 # in V
I_o = 30 # in µA
I_o= I_o*10**-6 # in A
v = 0.2 # in V
r_f = (Eta * V_T)/(I_o * exp(v/(Eta* V_T))) # in ohm
print "The dynamic resistance in the forward direction = %0.2f ohm " %r_f
r_r = (Eta * V_T)/(I_o * exp(-v/(Eta* V_T))) # in ohm
print "The dynamic resistance in the reverse direction = %0.2f kohm " %(r_r*10**-3)
```

In [39]:

```
from numpy import pi
# Given data
epsilon = 16/(36 * pi * 10**11) # in F/cm
A = 1 * 10**-2
W = 2 * 10**-4
C_T = (epsilon * A)/W # in F
print "The barrier capacitance = %0.2f pF " %(C_T*10**12)
```

In [40]:

```
from math import sqrt
# Given data
A = 1 # in mm**2
A = A * 10**-6 # in m**2
N_A = 3 * 10**20 # in atoms/m**3
q = 1.6 *10**-19 # in C
V_o = 0.2 # in V
epsilon_r=16
epsilon_o= 8.854*10**-12 # in F/m
epsilon=epsilon_r*epsilon_o
# Part (a)
V=-10 # in V
# V_o - V = 1/2*((q * N_A )/epsilon) * W**2
W = sqrt(((V_o - V) * 2 * epsilon)/(q * N_A)) # m
C_T1 = (epsilon * A)/W # in F
print "The width of the depletion layer for an applied reverse voltage of 10V = %0.2f µm " %(W*10**6)
# Part (b)
V=-0.1 # in V
W = sqrt(((V_o - V) * 2 * epsilon)/(q * N_A)) # m
C_T2 = (epsilon * A)/W # in F
print "The width of the depletion layer for an applied reverse voltage of 0.1V = %0.2f µm " %(W*10**6)
# Part (c)
V=0.1 # in V
W = sqrt(((V_o - V) * 2 * epsilon)/(q * N_A)) # m
print "The width of the depletion layer for an applied for a forward bias of 0.1V = %0.3f µm " %(W*10**6)
# Part (d)
print "The space charge capacitance for an applied reverse voltage of 10V = %0.2f pF " %(C_T1*10**12)
print "The space charge capacitance for an applied reverse voltage of 0.1V = %0.2f pF " %(C_T2*10**12)
```

In [41]:

```
from math import exp
# Given data
I_o = 1.8 * 10**-9 # A
v = 0.6 # in V
Eta = 2
V_T = 26 # in mV
V_T=V_T*10**-3 # in V
I = I_o *(exp(v/(Eta * V_T))) # in A
print "The current in the junction = %0.3f mA " %(I*10**3)
```

In [42]:

```
from math import log
# Given data
I_o = 2.4 * 10**-14
I = 1.5 # in mA
I=I*10**-3 # in A
Eta = 1
V_T = 26 # in mV
V_T= V_T*10**-3 # in V
v =log((I + I_o)/I_o) * V_T # in V
print "The forward biasing voltage across the junction = %0.4f V " %v
```

In [43]:

```
# Given data
I_o = 10 # in nA
# I = I_o * ((e**(v/(Eta * V_T))) - 1)
# e**(v/(Eta * V_T)<< 1, so neglecting it
I = I_o * (-1) # in nA
print "The Diode current = %0.f nA " %I
```

In [44]:

```
from math import exp
# Given data
R = 4.5 # in ohm
I = 44.4 # in mA
I=I*10**-3 # in A
V = R * I # in V
Eta = 1
V_T = 26 #in mV
V_T=V_T*10**-3 # in V
I_o = I/((exp(V/(Eta * V_T))) -1) # in A
# At
V = 0.1 # in V
r_f = (Eta * V_T)/(I_o * ((exp(V/(Eta * V_T)))-1)) # in ohm
print "The diode dynamic resistance = %0.2f Ω " %r_f
```

In [45]:

```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
# Given data
V_D = 10 # in V
# V_S = i*R_L + V_D
V_S = V_D # in V (i * R_L = 0)
print "when diode is OFF, the voltage = %0.f volts " %V_S
R_L = 250 # in ohm
I = V_S/R_L # in A
print "when diode is ON, the current = %0.f mA " %(I*10**3)
V_D= np.arange(0,10,0.1) # in V
I= (V_S-V_D)/R_L*1000 # in mA
plt.plot(V_D,I)
plt.xlabel('V_D in volts')
plt.ylabel('Current in mA')
plt.title('DC load line')
plt.axis([0, 12, 0, 50])
plt.show()
print "DC load line shown in figure"
```

In [46]:

```
from math import exp
# Given data
V = 0.25 # in V
I_o = 1.2 # in µA
I_o = I_o * 10**-6 # in A
V_T = 26 # in mV
V_T = V_T * 10**-3 # in V
Eta = 1
r = (Eta * V_T)/(I_o * (exp(V/(Eta * V_T)))) # in ohm
print "The ac resistance of the diode = %0.3f ohm " %r
```

In [47]:

```
from math import log
# Given data
t = 4.4 * 10**22 # in total number of atoms/cm**3
n = 1 * 10**8 # number of impurity
N_A = t/n # in atoms/cm**3
N_A = N_A * 10**6 # in atoms/m**3
N_D = N_A * 10**3 # in atoms/m**3
V_T = 26 # in mV
V_T = V_T * 10**-3 # in V
n_i = 2.5 * 10**19 # in /cm**3
V_J = V_T * log((N_A * N_D)/(n_i)**2) # in V
print "The junction potential = %0.3f V "%V_J
```

In [48]:

```
from math import exp
# Given data
Eta = 1
I_o = 30 # in MuA
I_o = I_o * 10**-6 # in A
v = 0.2 # in V
K = 1.381 * 10**-23 # in J/degree K
T = 125 # in °C
T = T + 273 # in K
q = 1.6 * 10**-19 # in C
V_T = (K*T)/q # in V
r_f = (Eta * V_T)/(I_o * (exp(v/(Eta * V_T)))) # in ohm
print "The forward dynamic resistance = %0.3f ohm " %r_f
r_f1 = (Eta * V_T)/(I_o * (exp(-(v)/(Eta * V_T)))) # in ohm
print "The Reverse dynamic resistance = %0.2f kΩ " %(r_f1*10**-3)
```

In [49]:

```
from math import sqrt
# Given data
q = 1.6 * 10**-19 # in C
N_A = 3 * 10**20 # in /m**3
A = 1 # in µm**2
A = A * 10**-6 # in m**2
V = -10 # in V
V_J = 0.25 # in V
V_B = V_J - V # in V
epsilon_o = 8.854 # in pF/m
epsilon_o = epsilon_o * 10**-12 # in F/m
epsilon_r = 16
epsilon = epsilon_o * epsilon_r
W = sqrt((V_B * 2 * epsilon)/(q * N_A)) # in m
print "The width of depletion layer = %0.2f µm " %(W*10**6)
C_T = (epsilon * A)/W # in pF
print "The space charge capacitance = %0.4f pF " %(C_T*10**12)
```

In [50]:

```
# Given data
W = 2 * 10**-4 # in cm
W = W * 10**-2 # in m
A = 1 # in mm**2
A = A * 10**-6 # in m**2
epsilon_r = 16
epsilon_o = 8.854 * 10**-12 # in F/m
epsilon = epsilon_r * epsilon_o
C_T = (epsilon * A)/W # in F
print "The barrier capacitance = %0.3f pF " %(C_T*10**12)
```

In [51]:

```
from math import sqrt, pi
# Given data
C_T = 100 # in pF
C_T=C_T*10**-12 # in F
epsilon_r = 12
epsilon_o = 8.854 * 10**-12 # in F/m
epsilon = epsilon_r * epsilon_o
Rho_p = 5 # in ohm-cm
Rho_p = Rho_p * 10**-2 # in ohm-m
V_j = 0.5 # in V
V = -4.5 # in V
Mu_p = 500 # in cm**2
Mu_p = Mu_p * 10**-4 # in m**2
Sigma_p = 1/Rho_p # in per ohm-m
qN_A = Sigma_p/ Mu_p
V_B = V_j - V
W = sqrt((V_B * 2 * epsilon)/qN_A) # in m
#C_T = (epsilon * A)/W
A = (C_T * W)/ epsilon # in m
D = sqrt(A * (4/pi)) # in m
D = D * 10**3 # in mm
print "The value of diameter = %0.3f mm " %D
```

In [52]:

```
from math import log
# Given data
q = 1.6 * 10**-19 # in C
Mu_p = 500 # in cm**2/V-sec
Rho_p = 3.5 # in ohm-cm
Mu_n = 1500 # in cm**2/V-sec
Rho_n = 10 # in ohm-cm
N_A = 1/(Rho_p * Mu_p * q) # in /cm**3
N_D = 1/(Rho_n * Mu_n * q) # in /cm**3
V_J = 0.56 # in V
n_i = 1.5 * 10**10 # in /cm**3
V_T = V_J/log((N_A * N_D)/(n_i)**2) # in V
# V_T = T/11600
T = V_T * 11600 # in K
T = T /19.78 # in °C ( 1 degree K = 19.78 degree C)
print "The Temperature of junction = %0.3f °C " %T
```

In [53]:

```
from math import log
# Given data
V_T = 26 # in mV
V_T = V_T * 10**-3 # in V
Eta = 1
# I = -90% for Io, so
IbyIo= 0.1
# I = I_o * ((e**(v/(Eta * V_T)))-1)
V = log(IbyIo) * V_T # in V
print "The reverse bias voltage = %0.5f volts " %V
```

In [54]:

```
from math import exp
# Given data
R = 5 # in ohm
I = 50 # in mA
I=I*10**-3 # in A
V = R * I # in V
Eta = 1
V_T = 26 # in mV
V_T=V_T*10**-3 # in V
I_o = I/((exp(V/(Eta * V_T))) - 1) # in A
print "Reverse saturation current = %0.2f µA " %(I_o*10**6)
v1 = 0.2 # in V
r = (Eta * V_T)/(I_o * (exp(v1/(Eta * V_T)))) # in ohm
print "Dynamic resistance of the diode = %0.3f Ω " %r
```