In [1]:

```
#Variable declaration
e = 1.6e-019; # Charge on an electron, C
mu_h = 0.048; # Mobility of holes, metre square/volt-s
mu_e = 0.135; # Mobility of electrons, metre square/volt-s
#Calculations
# For P-type semiconductor
rho_p = 1e-01; # Resistivity of P type silicon, omh-m
# As rho_p = 1/(e*N_a*mu_h), solving for N_a
N_a = 1/(e*rho_p*mu_h); # Density of acceptor atoms, per metre cube
# For N-type semiconductor
rho_n = 1e-01; # Resistivity of N type silicon, omh-m
# As rho_n = 1/(e*N_d*mu_h), solving for N_d
N_d = 1/(e*rho_n*mu_e); # Density of donor atoms, per metre cube
#Results
print "Density of acceptor atoms = %4.2e per metre cube"%N_a
print "Density of donor atoms = %4.2e per metre cube"%N_d #incorrect answer in textbook
```

In [2]:

```
#Variable declaration
e = 1.6e-019; # Charge on an electron, C
mu_e = 0.36; # Mobility of an electron, metre square/V-s
mu_h = 0.17; # Mobility of a hole, metre square/V-s
n_i = 2.5e+018; # Intrinsic concentration of Ge sample, per metre cube
#Calculations
sigma = e*n_i*(mu_h+mu_e); # Electrical conductivity of Ge sample, mho per metre
rho = 1/sigma; # Electrical resistivity of Ge, ohm-m
#Results
print "The electrical conductivity of intrinsic germanium sample = %5.3f mho/m"%sigma
print "The electrical resistivity of intrinsic germanium sample = %3.1f ohm-m"%rho
```

In [3]:

```
#Variable declaration
e = 1.6e-019; # Charge on an electron, C
mu_e = 0.13; # Mobility of an electron, metre square/V-s
mu_h = 0.05; # Mobility of a hole, metre square/V-s
n_i = 1.5e+016; # Intrinsic concentration of Si, per metre cube
#Calculations
# Pure Si
sigma = e*n_i*(mu_h+mu_e); # Electrical conductivity of Si, mho per metre
# Pure Si doped with donor impurity
n_e = 5e+028/1e+09; # Concentration of electrons, per metre cube
sigma_n = e*n_e*mu_e; # Electrical conductivity of Si doped with donor impurity, mho per metre
# Pure Si doped with acceptor impurity
n_h = 5e+028/1e+09; # Concentration of holes, per metre cube
sigma_p = e*n_h*mu_h; # Electrical conductivity of Si doped with acceptor impurity, mho per metre
#Results
print "The electrical conductivity of pure Si = %4.2e mho/m"%sigma
print "The electrical conductivity of Si doped with donor impurity = %4.2f mho/m"%sigma_n
print "The electrical conductivity of Si doped with acceptor impurity= %4.2f mho/m"%sigma_p
```

In [5]:

```
from math import *
#Variable declaration
Nd = 1; # For simplicity assume donor concentration to be unity, per metre cube
Nd_prime = 3*Nd; # Thrice the donor concentration, per metre cube
dE_CF1 = 0.5; # Energy difference between normal Fermi level and conduction level, eV
k_BT = 0.03; # Thermal energy at room temperature, eV
#Calculations
# As Nd_prime/Nd = exp((dE_CF1 - dE_CF2))/k_BT, solving for dE_CF2
dE_CF2 = dE_CF1-k_BT*log(Nd_prime/Nd); # Energy difference between new postion of Fermi level and conduction level, eV
#Result
print "The new postion of Fermi level when donor concentration is trebled = %5.3f eV"%dE_CF2
```

In [6]:

```
from math import *
#Variable declaration
e = 1.6e-019; # Charge on an electron, C
T = 300; # Room temperature, K
J0 = 300e-03; # Saturation current density of the pn junction diode, A/metre square
J = 1e+05; # Forward current density of pn junction diode, A/metre square
k_B = 1.38e-023; # Boltzmann constant, J/K
eta = 1; # Ideality factor for Ge diode
#Calculations
# As J = J0*exp(e*V/(eta*k_B*T)), solving for V
V = eta*k_B*T/e*log(J/J0); # Voltage required to cause a forward current density in pn junction diode, volt
#Results
print "The voltage required to cause a forward current density in pn junction diode = %5.3f V"%V
```

In [7]:

```
from math import *
#Variable declaration
e = 1.6e-019; # Charge on an electron, C
T = 300; # Room temperature, K
J0 = 200e-03; # Saturation current density of the pn junction diode, A/metre square
J = 5e+04; # Forward current density of pn junction diode, A/metre square
k_B = 1.38e-023; # Boltzmann constant, J/K
eta = 1; # Ideality factor for Ge diode
#Calculations
# As J = J0*exp(e*V/(eta*k_B*T)), solving for V
V = eta*k_B*T/e*log(J/J0); # Voltage required to cause a forward current density in pn junction diode, volt
#Result
print "The voltage required to cause a forward current density in pn junction diode = %5.3f V"%V
```

In [8]:

```
from math import *
#Variable declaration
e = 1.6e-019; # Charge on an electron, C
T = 300; # Room temperature, K
J0 = 300e-03; # Saturation current density of the pn junction diode, A/metre square
J = 1e+05; # Forward current density of pn junction diode, A/metre square
k_B = 1.38e-023; # Boltzmann constant, J/K
eta = 2; # Ideality factor for Ge diode
#Calculations
# As J = J0*exp(e*V/(eta*k_B*T)), solving for V
V = eta*k_B*T/e*log(J/J0); # Voltage required to cause a forward current density in pn junction diode, volt
#Result
print "The voltage required to cause a forward current density in Si iode = %5.3f V"%V
```

In [9]:

```
#Variable declaration
I = 55e-03; # Forward current through Si diode, A
V = 3; # Forward bias across Si diode, V
eta = 2; # Ideality factor for Si diode
#Calculations
R_dc = V/I; # Static diode resistance, ohm
R_ac = 0.026*eta/I; # Dynamic diode resistance, ohm
#Results
print "The static diode resistance = %4.1f ohm"%R_dc
print "The dynamic diode resistance = %5.3f ohm"%R_ac
```

In [10]:

```
from math import *
#Variable declaration
R_L = 1000; # Load resistance across HWR, ohm
V_rms = 200; # Rms value of voltage supply, V
#Calculations
V0 = sqrt(2)*V_rms; # Peak value of voltage, V
I0 = V0/(R_L*1e-03); # Peak value of current, mA
I_dc = I0/pi; # Average value of current, mA
I_rms = I0/2; # Rms value of current, mA
V_dc = I_dc*R_L/1e+03; # Dc output voltage, V
PIV = V0; # Peak inverse voltage, V
#Results
print "The average value of current = %2d mA"%I_dc
print "The rms value of current = %5.1f mA"%I_rms
print "The dc output voltage = %2d V"%(V_dc/1)
print "PIV = %5.1f V"%PIV
```

In [17]:

```
from math import *
#Variable declaration
R_L = 980; # Load resistance across FWR, ohm
R_F = 20.; # Internal resistance of two crystal diodes in FWR, ohm
V_rms = 50; # Rms value of voltage supply, V
#Calculations
V0 = sqrt(2)*V_rms; # Peak value of voltage, V
I0 = V0/((R_L+R_F)*1e-03); # Peak value of current, mA
I_dc = 2*I0/pi; # Average value of current, mA
I_rms = I0/sqrt(2); # Rms value of current, mA
V_dc = I_dc*R_L/1e+03; # Dc output voltage, V
eta = 81.2/(1+R_F/R_L); # Rectification efficiency
PIV = 2*V0; # Peak inverse voltage, V
#Results
print "The average value of current = %2d mA"%I_dc
print "The rms value of current = %2d mA"%I_rms
print "The dc output voltage = %4.1f V"%(V_dc/1)
print "The rectification efficiency = %4.1f percent"%eta
print "PIV = %5.1f V"%PIV
```

In [12]:

```
#Variable declaration
delta_IC = 1e-03; # Change in collector current, A
delta_IB = 50e-06; # Change in base current, A
#Calculations
bta = delta_IC/delta_IB; # Base current amplification factor
alpha = bta/(1+bta); # Emitter current amplification factor
#Results
print "Alpha of BJT = %4.2f"%alpha
print "Beta of BJT = %2d"%bta
```

In [13]:

```
#Variable declaration
I_E = 2; # Emitter current, mA
alpha = 0.88; # Emitter current amplification factor
#Calculations
I_C = alpha*I_E; # Collector current, mA
I_B = I_E - I_C; # Base current of BJT in CB mode, mA
#Result
print "The base current of BJT in CB mode = %4.2f mA"%I_B
```

In [14]:

```
#Variable declaration
I_CBO = 12.5e-03; # Reverse saturation current, mA
I_E = 2; # Emitter current, mA
I_C = 1.97; # Collector current, mA
#Calculations
# As I_C = alpha*I_E+I_CBO, solving for alpha
alpha = (I_C - I_CBO)/I_E; # Emitter current gain
I_B = I_E - I_C; # Base current, mA
#Results
print "The emitter current gain = %5.3f"%alpha
print "The base current = %4.2f mA"%I_B
```

In [15]:

```
#Variable declaration
alpha = 0.98; # Emitter current amplification factor
I_CBO = 5e-06; # Reverse saturation current, A
#Calculations
bta = alpha/(1-alpha); # Emitter current amplification factor
I_CEO = 1/(1-alpha)*I_CBO; # Leakage current of BJT in CE mode, mA
#Results
print "The base current gain = %2g"%bta
print "The leakage current of BJT in CE mode = %4.2f mA"%(I_CEO/1e-03)
```

In [16]:

```
#Variable declaration
R_i = 50; # Dynamic input resistance of PNP transistor, ohm
R_L = 5e+03; # Load resistance in collector circuit, ohm
alpha = 0.96; # Emitter current amplification factor
#Calculations
A_v = alpha*R_L/R_i; # Voltage gain
A_p = alpha*A_v; # Power gain
#Results
print "The voltage gain = %2g"%A_v
print "The power gain = %2d"%A_p
```