import math
##Example 18.2
##calculation of probability
##given values
T=300.;##temp in K
kT=.026;##temperture equivalent at room temp in eV
Eg=5.6;##forbidden gap in eV
##calculation
f=1./(1.+math.e**(Eg/(2.*kT)));
print'%s %.3e %s'%('probability of an e being thermally promoted to conduction band is',f,'');
import math
##Example 18.3
##calculation of fraction of e in CB
##given values
T=300.;##temp in K
kT=.026;##temperture equivalent at room temp in eV
Eg1=.72;##forbidden gap of germanium in eV
Eg2=1.1;##forbidden gap of silicon in eV
Eg3=5.6;##forbidden gap of diamond in eV
##calculation
f1=math.e**(-Eg1/(2.*kT));
print'%s %.6f %s'%('fraction of e in conduction band of germanium is',f1,'');
f2=math.e**(-Eg2/(2.*kT));
print'%s %.3e %s'%('fraction of e in conduction band of silicon is',f2,'');
f3=math.e**(-Eg3/(2*kT));
print'%s %.3e %s'%('fraction of e in conduction band of diamond is',f3,'');
print'abpove results shows that larger the band gap and the smaller electrons that can go under into the conduction band'
import math
##Example 18.4
##calculation of fractionional change in no of e
##given values
T1=300.;##temp in K
T2=310.;##temp in K
Eg=1.1;##forbidden gap of silicon in eV
k=8.6*10**-5.;##boltzmann's constant in eV/K
##calculation
n1=(10**21.7)*(T1**(3/2.))*10**(-2500.*Eg/T1);##no of conduction e at T1
n2=(10**21.7)*(T2**(3/2.))*10**(-2500.*Eg/T2);##no of conduction e at T2
x=n2/n1;
print'%s %.1f %s'%('fractional change in no of e is',x,'');
print 'in book he just worte ans but he didnt calculated final ans but here is i calculated'
##Example 18.5
##calculation of resistivity
##given values
e=1.6*10**-19;
ni=2.5*10**19;##intrinsic density of carriers per m**3
ue=.39;##mobility of e
uh=.19;##mobility of hole
##calculation
c=e*ni*(ue+uh);##conductivity
r=1/c;##resistivity
print'%s %.2f %s'%('resistivity in ohm m is',r,'');
import math
##Example 18.6
##calculation of conductivity of intrinsic and doped semiconductors
##given values
h=4.52*10**24;##no of holes per m**3
e=1.25*10**14;##no of electrons per m**3
ue=.38;##e mobility
uh=.18;##hole mobility
q=1.6*10**-19;##charge of e in C
##calculation
ni=math.sqrt(h*e);##intrinsic concentration
ci=q*ni*(ue+uh);
print'%s %.2f %s'%('conductivity of semiconductor(in S/m) is',ci,'');
cp=q*h*uh;
print'%s %.2f %s'%('conductivity of doped semiconductor (in S/m) is',cp,'');
import math
##Example 18.7
##calculation of hole concentration
##given values
ni=2.4*10**19.;##carrier concentration per m**3
N=4*10**28.;##concentration of ge atoms per m**3
##calculation
ND=N/10**6.;##donor cocntrtn
n=ND;##no of electrones
p=ni**2./n;
print'%s %.3e %s'%('concentartion of holes per m^3 is',p,'');
import math
##Example 18.8
##calculation of Hall voltage
##given values
ND=10**21.;##donor density per m**3
B=.5;##magnetic field in T
J=500.;##current density in A/m**2
w=3*10**-3.;##width in m
e=1.6*10**-19.;##charge in C
##calculation
V=B*J*w/(ND*e);##in volts
print'%s %.2f %s'%('Hall voltage in mv is',V*10**3,'');