#pg 395
#calculate the voltage
#Given:
import math
sigma_n = 10**4; #conductivity in mho/m
sigma_p = 10**2; # conductivity in mho/m
e = 1.6*10**-19;# charge of an electron in C
kT = 0.026 ;# k*T value at room temperature in eV
ni = 2.5*10**19; # per m**3
mue = 0.38; # mobility of free electrons in m**2/Vs
muh = 0.18;# mobility of free electrons in m**2/Vs
# sigma_n = e*n*mue and sigma_p = e*p*muh
#calculations
nn0 = sigma_n/(e*mue); # per m**3
pp0 = sigma_p/(e*muh);# per m**3
np0 =(ni**2)/pp0; # in m**-3
# V0 = (kT/e)*log(nn0/np0) , but we consider only kT because kT/e = 0.026 eV/e , both the e's cancel each other.Finally we obtain the answer in Volts
V0 = (kT)*math.log(nn0/np0); # in V
#results
print "V0 (V) = ",round(V0,2)
### pg 396
#calculate the np
#Given :
import math
#(a)Forward bias of 0.1 V
# np = np0*exp[eV/kT] , here we dont have np0 value, so we will calculate the remaining part.
kT = 0.026; # in eV
#calculations and results
np = math.exp(0.1/kT);
print "(a) np =",round(np,0),"x np0"
#(b)Reverse bias of 1 V
# np = np0*exp[-eV/kT] , here we dont have np0 value, so we will calculate the remaining part.
np1 = math.exp(-1/kT);
print "(b) np =",round(np1*10**17,2),"x 10^-17 x np0"
#pg 398
#calculate the Current
#import math
#Given :
import math
I0 = 0.1; # muA
kT = 0.026; # kT value at room temperature
#calculations
#Forward bias of 0.1 V
# I = I0[exp(eV/kT) - 1]
# since I = I0*(exp(0.1 eV/kT (eV))), both the eV's cancel each other , so it is only I = I0*(exp(0.1/kT) - 1) while evaluating.
I = I0*(math.exp(0.1/kT) - 1) # in muA
#results
print "Current (muA) = ",round(I,2)
#pg 420
#calculate the Input voltage and load resistance
#Given :
Vin = 36.; # Input Voltage in V
Vb = 6.; # Zerner Breakdown Voltage in V
R = 5.*10**3; # resistance in ohm
Rl = 2.*10**3; # load resistance in ohm
#calculations
Vr = Vin-Vb; # Volatge drop across resistor
I = Vr/R; # current in A
Il = Vb/Rl; # current in A
Iz = I - Il ;# current in A
#(a)
Vin1 = 41; # Input Voltage in V
I1 = (Vin1-Vb)/R; # current in A
Iz1 = I1-Iz; # current in A
#(b)
Rl1 = 4*10**3; #load resistance in ohm
Il1 = Vb/Rl1; # current in A
Iz2 = I - Il1; # current in A
#results
print "Input voltage = 41 V , Iz (mA) = ",Iz1*10**3
print "Load resistance = 4k ohm , Iz (mA) = ",Iz2*10**3
#pg 430
#calculate the Voltage gain
#Given :
deltaIE = 2.; # in mA
deltaIB = 5.; # in mA
Rl = 200.*10**3; # load resistance in ohm
ri = 200.; # input resistance in ohm
# IE= IB + IC , 1 muA = 1.0*10**-3 mA
#calculations
deltaIC = deltaIE - deltaIB*10**-3 ;# in mA
alpha = deltaIC/deltaIE;
A = alpha*(Rl/ri);
#results
print "Voltage gain = ",A