import math
#Variable declaration
T=300 #K
Nc=2.8*10**19 #cm**-3
k=8.617*10**-5 #eV K**-1
#Calculations&Results
#E=Ec
#a=Ec-Ef
a=-0.25
#fF(E)=1/(1+exp(Ec-Ef/kT)) =exp(-(Ec-Ef)/kT)
#b=k*T
#print b)
c=k*T
fFE=math.exp(a/c)
print "fF(E) value is= %.2e"%fFE
n0=Nc*math.exp(-a/(k*T))
print "n0 value is %.1e cm**-3"%n0
#answer in the textbook is wrong
import math
#Variable declaration
T1=400. #K
T2=300 #K
N=1.04*10**19 #cm^-3
k=8.617*10**-5 #eV/K
#Calculations&Results
Nv=N*(T1/T2)**(3./2)
print 'Nv=%.2e cm^-3'%Nv
a=k*T2*(T1/T2)
print 'kT=%.5f eV'%a
#p0=Nv*exp(-(Ef-Ev)/kT)
p0=Nv*math.exp(-0.27/a)
print 'p0=%.2e cm^-3'%p0
import math
#Variable declaration
T1=300 #K
T2=450. #K
Nc=4.7*10**17 #cm**-3
N=7*10**18 #cm**-3
k=8.617*10**-5 #eV/K
#Calculations&Results
a=k*T1*(T2/T1)
print 'kT=%.5f eV'%a
ni=math.sqrt(Nc*N*math.exp(-1.42/(k*T1)))
print 'ni=%.2e cm**-3'%ni
ni=math.sqrt(Nc*N*(T2/T1)**3*math.exp(-1.42/a))
print 'ni=%.2e cm**-3'%ni
import math
#Variable declaration
T=300 #K
mn=1.08 #m0
mp=0.56 #m0
k=8.617*10**-5 #eV/K
#Calculations
#Efi-Emidgap=(3./4)k*T*log(mp/mn)
#a=Efi-Emidgap
a=(0.75)*k*T*math.log(mp/mn)
#Result
print 'Efi-Emidgap=%.4f eV'%a
import math
#Variable declaration
T=300 #K
Nn=2.8*10**19 #cm**-3
Np=1.04*10**19 #cm**-3
#a=Ef-Ev
an=0.25 #eV
ap=0.87 #eV
k=8.617*10**-5 #eV/K
#Calculations&Results
n0=Nn*math.exp(-an/(k*T))
print "n0 in cm**-3 is= %.1e"%n0
p0=Np*math.exp(-ap/(k*T))
print "p0 in cm**-3 is=%.1e"%p0
import math
#Variable declaration
nf=2
T=300 #K
Nc=2.8*10**19 #cm^-3
#Calculations
#n0=(2/sqrt(%pi))*Nc*F12(nf)
#x=F12(nf)=2.3
x=2.3
n0=(2./math.sqrt(math.pi))*Nc*x
#Result
print "n0 in cm^-3 is= %.2e"%n0
import math
#Variable declaration
Nd=10**16 #cm^-3
Ne=2.8*10**19 #cm^-3
T=300 #K
#Calculations
#(nd/(n0+nd))=z=1/(1+(Ne/2*Nd)*exp(-(Ec-Ed)/kT))
#y=Ec-Ed
y=0.045
k=8.617*10**-5 #eV/K
z=1./(1+(Ne/(2*Nd))*math.exp(-y/(k*T)))
#Result
print "the donor states is= %.2f%%"%(z*100)
import math
#Variable declaration
Nd=10**16 #cm**-3
Na=0
ni=1.5*10**10 #cm**-3
T=300 #K
k=8.617*10**-5 #eV/K
#Calculations&Results
n0=((Nd-Na)/2)+math.sqrt((((Nd-Na)/2)**2)+ni**2)
print "n0 is %.e cm**-3 "%n0
p0=(ni**2)/n0
print "p0 is %.2e cm**-3"%p0
import math
#Variable declaration
Nd=5*10**13 #cm**-3
Na=0
ni=2.4*10**13 #cm**-3
T=300 #K
k=8.617*10**-5 #eV/K
#Calculations&Results
n0=((Nd-Na)/2)+math.sqrt((((Nd-Na)/2)**2)+ni**2)
print "n0 is %.2e cm**-3"%n0
p0=(ni**2)/n0
print "p0 is %.2e cm**-3"%p0
import math
#Variable declaration
T=300 #K
Nd=3.*10**15 #cm**-3
Na=10.**16 #cm**-3
k=8.617*10**-5 #eV/K
ni=1.5*10**10 #cm^-3
#Calculations&Results
a=((Na-Nd)/2)
b=math.sqrt(((Na-Nd)/2)**2+(ni**2))
p0=a+b
print "p0 is %.e cm^-3"%p0 #textbook ans is wrong
n0=(ni**2)/p0
print "n0 is %.2e cm^-3 "%n0 #textbook ans is wrpng
import math
#Variable declaration
T1=550. #K
T2=300 #K
Nc=2.8*10**19 #cm**-3
Ne=1.04*10**19 #cm**-3
k=8.617*10**-5 #eV/K
Eg=1.12
#Calculations&Results
#ni^2=Nc*Ne*exp(-Eg/(k*T))
ni=math.sqrt(Nc*Ne*(T1/T2)**3*math.exp((-Eg/(k*T2))*(T2/T1)))
print "ni is %.2e cm^-3 "%ni
#n0=1.05*Nd
#n0=(Nd/2)+sqrt((Nd/2)**2+ni**2) equation 1
a=(((1.05*2)-1)/2)**2 #simplifying and sloving the about equaton 1
b=ni**2
c=((4*a)-1)/4
Nd=math.sqrt(b/c)
print "Nd value is %.2e cm^-3"%Nd
import math
#Variable declaration
T=300 #K
Na=10**16 #cm^-3
Nc=2.8*10**19 #cm**-3
k=8.617*10**-5 #eV/K
#Calculations
#a=Ec-Ef
a=0.20 #eV
#Ec-Ef=k*T*log(Ne/(Nd-Na))
#Nd-Na=Nc*exp(-(Ec-Ef)/k*T)
Nd=Na+Nc*math.exp(-a/(k*T))
#Result
print "Nd is %.2e cm^-3"%Nd
import math
#Variable declaration
T=300 #K
k=8.617*10**-5 #eV/K
ni=1.5*10**10 #cm^-3
#Ef-Ea=a
a=3*k*T
#Ea-Ev=b
b=0.045 #eV
Eg=1.12 #eV
#Calculations
#Efi-Ef=(Eg/2)-(Ea-Ev)-(Ef-Ea)=kT*log(Na/ni)
c=(Eg/2)-(b)-(a)
Na=ni*math.exp(c/(k*T))
#Result
print "Na is %.1e cm^-3"%Na