Nd = 1.0*10**16 #initialising value of donor atoms in centimeter
Na= 1.0*10**18 #initialising value of accepter atoms in centimeter
Nc= 2.8*10**19 #initialising value of conduction band effective density
Nv= 1.0*10**19 #initialising value of valence band effective density
kbT = 0.026 #initializing value of kbT at 300K
Eg = 1.1 #initializing value of forbidden energy gap
#NOTE: nn=Nd and pp=Na
eVbi = Eg+(kbT*log(Na/Nv))+((kbT*log(Nd/Nc)))
print"built in voltage is ,eVbi = ","{:.2e}".format(eVbi)," eV"
apsilen = 11.9*8.85*10**-12 #initializing value of relative permitivity
e = 1.6*10**-19 #initializing value of charge of electron
Vbi=eVbi/e
Nd = 1.0*10**22 #initialising value of donor atoms in metrers
Na= 1.0*10**24 #initialising value of accepter atomsin meters
Wp_Vbi = sqrt(((2*apsilen*eVbi)/(e))*(Nd/(Na*(Na+Nd))))
print"depletion width at p side is ,Wp_Vbi =","{:.2e}".format(Wp_Vbi)," m"
Wn_Vo = 100*sqrt(((2*apsilen*eVbi)/(e))*(Nd/(Na*(Na+Nd))))
print"depletion width at n side is ,Wn_Vo = ","{:.2e}".format(Wn_Vo)," m"
Nd = 1.0*10**16 #initialising value of donor atoms in centimeter
Na= 1.0*10**18 #initialising value of accepter atoms in centimeter
ni = 1.5*10**10 #initializing value of intrinsic carrier concentration
#NOTE: nn=Nd and pp=Na
R= 10*10**-6 #initializing value of radius of pn diode
A = math.pi*(R**2)
pn = ni**2/Nd
print"concentration of electron in p type is ,pn = ","{:.2e}".format(pn)," cm**-3"
kbT = 0.026 #initializing value of kbT at 300K
eVbi = (kbT*log(Na/pn))
print"built in voltage is ,eVbi =","{:.2e}".format(eVbi)," V"
apsilen = 11.9*8.84*10**-12 #initializing value of relative permitivity
e = 1.6*10**-19 #initializing value of charge of electron
#NOTE: for reverse bias Vr = 0 V,
Wp_4 = sqrt(((2.0*apsilen*eVbi)/(e))*((Nd*1.0*10**6)/((Na*1.0*10**6)*((Nd*1.0*10**6)+(Na*1.0*10**6)))))
print"depletion width at p side is ,Wp_4 =","{:.2e}".format(Wp_4),"m"
Wn_4 = Wp_4*100
print"depletion width at n side is ,Wn_4 = ","{:.2e}".format(Wn_4),"m"
#for calculation purpose and for differentiating part (I), equating
Vbi_4 = eVbi
Vbi_4=round(Vbi_4,3)
print("")# for spacing
Vbi_2 = Vbi_4 + 2
Vbi_2=round(Vbi_2,3)
#NOTE: for reverse bias Vr = 2 V,
Wp_2 = Wp_4*sqrt(Vbi_2/Vbi_4)
print"depletion width at p side is ,Wp_2 = ","{:.2e}".format(Wp_2),"m"
Wn_2 = Wp_2*100
print"depletion width at n side is ,Wn_2 = ","{:.2e}".format(Wn_2),"m"
print("")# for spacing
Vbi_3 = Vbi_4 + 5
Vbi_3=round(Vbi_3,2)
#NOTE: for reverse bias Vr = 5 V,
Wp_3 = sqrt(((2.0*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_3/Vbi_4)
print"depletion width at p side is ,Wp_3 = ""{:.2e}".format(Wp_3),"m"
Wn_3 = Wp_3*100
print"depletion width at n side is ,Wn_3 = ","{:.2e}".format(Wn_3),"m"
print("")# for spacing
Vbi_4 = Vbi_4 + 10
Vbi_4=round(Vbi_4,2)
#NOTE: for reverse bias Vr = 10 V,
Wp_4 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_4/Vbi_4)
print"depletion width at p side is ,Wp_4 = ","{:.2e}".format(Wp_4),"m"
Wn_4 = Wp_4*100
print"depletion width at n side is ,Wn_4 = ","{:.2e}".format(Wn_4),"m"
print("")# for spacing
Vbi_5 = Vbi_4 - 0.5
Vbi_5=round(Vbi_5,2)
#NOTE: for forward bias Vf = 0.5 V,
Wp_5 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_5/Vbi_4)
print"depletion width at p side is ,Wp_5 =","{:.2e}".format(Wp_5),"m"
Wn_5 = Wp_5*100
print"depletion width at n side is ,Wn_5 = ","{:.2e}".format(Wn_5),"m"
#CALCULATION FOR PEAK FIELD :
F = - e*Nd*(10**6)*Wn_4/apsilen
print"F=","{:.2e}".format(F),"v/m"
F = - e*Nd*(10**6)*Wn_2/apsilen
print"F=","{:.2e}".format(F),"v/m"
F = - e*Nd*(10**6)*Wn_3/apsilen
print"F=","{:.2e}".format(F),"v/m"
F = - e*Nd*(10**6)*Wn_4/apsilen
print"F=","{:.2e}".format(F),"v/m"
F = - e*Nd*(10**6)*Wn_5/apsilen
print"F=","{:.2e}".format(F),"v/m"
#calculation for
Q = e*(Nd*10**6)*Wn_4*A#charge in depletion region for Vr = 0V
print"Q = ","{:.2e}".format(Q),"C"
#due to approximation taken by author in the textbook .... the values of Vbi_2, Vbi_3, Vbi_4 and
#the values of depletion width(Wp_4, Wp_2,Wp_3, Wp_4, Wn_4, Wn_2, Wn_3, Wn_4) differ from the above solution
# The answer of the textbook can be different due to different precision
import cmath
Nd = 1.0*10**16
Na= 1.0*10**18
ni = 1.5*10**10
#NOTE: nn=Nd and pp=Na
R= 10*10**-6
A = math.pi*(R**2)
pn = ni**2/Nd
print"concentration of electron in p type is ,pn = ","{:.2e}".format(pn)," cm**-3"
kbT = 0.026
eVbi = (kbT*log(Na/pn))
print"built in voltage is ,eVbi= ","{:.2e}".format(eVbi)," V"
apsilen = 11.9*8.84*10**-12
e = 1.6*10**-19
#NOTE: for reverse bias Vr = 0 V,
Wp_4 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))
print"depletion width at p side is ,Wp_4 = ","{:.2e}".format(Wp_4),"m"
Wn_4 = Wp_4*100
print"depletion width at n side is ,Wn_4 = ","{:.2e}".format(Wn_4),"m"
#for calculation purpose and for differentiating part (I), equating
Vbi_4 = eVbi
print("")# for spacing
Vbi_2 = Vbi_4 + 2
#NOTE: for reverse bias Vr = 2 V,
Wp_2 = Wp_4*sqrt(Vbi_2/Vbi_4)
print"depletion width at p side is ,Wp_2 = ","{:.2e}".format(Wp_2),"m"
Wn_2 = Wp_2*100
print"depletion width at n side is ,Wn_2 = ","{:.2e}".format(Wn_2),"m"
print("")# for spacing
Vbi_3 = Vbi_4 + 5
#NOTE: for reverse bias Vr = 5 V,
Wp_3 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_3/Vbi_4)
print"depletion width at p side is ,Wp_3 = ","{:.2e}".format(Wp_3),"m"
Wn_3 = Wp_3*100
print"depletion width at n side is ,Wn_3 = ","{:.2e}".format(Wn_3),"m"
print("")# for spacing
Vbi_4 = Vbi_4 + 10
#NOTE: for reverse bias Vr = 10 V,
Wp_4 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_4/Vbi_4)
print"depletion width at p side is ,Wp_4 = ","{:.2e}".format(Wp_4),"m"
Wn_4 = Wp_4*100
print"depletion width at n side is ,Wn_4 =","{:.2e}".format(Wn_4),"m"
print("")# for spacing
Vbi_5 = Vbi_4 - 0.5
#NOTE: for forward bias Vf = 0.5 V,
Wp_5 = sqrt(((2*apsilen*eVbi)/(e))*((Nd*10**6)/((Na*10**6)*((Nd*10**6)+(Na*10**6)))))*sqrt(Vbi_5/Vbi_4)
print"depletion width at p side is ,Wp_5 =","{:.2e}".format(Wp_5),"m"
Wn_5 = Wp_5*100
print"depletion width at n side is ,Wn_5 =","{:.2e}".format(Wn_5),"m"
#CALCULATION FOR PEAK FIELD :
Fm = - e*Nd*(10**6)*Wn_4/apsilen
print"peak Field For Vr = 0V, Fm = ","{:.2e}".format(Fm),"V/m"
Fm = - e*Nd*(10**6)*Wn_2/apsilen
print"peak Field for Vr = 2V, Fm =","{:.2e}".format(Fm),"V/m"
Fm = - e*Nd*(10**6)*Wn_3/apsilen
print"peak Field For Vr = 5V, Fm = ","{:.2e}".format(Fm),"V/m"
Fm = - e*Nd*(10**6)*Wn_4/apsilen
print"peak Field For Vr = 10V, Fm = ","{:.2e}".format(Fm),"V/m"
print"By the appendix B given in the book, the velocity of electron: v = 1*10**7 cm/s"
A= 10**-7
Na=10**18*10**6
Nd=10**16*10**6
Dp1 = 7.8*10**-4
Dn2 = 7.3*10**-4
Tn = 10**-6
Tp = 10**-6
e = 1.6*10**-19
kbT = 0.026
ni = 1.5*10**16
#NOTE: nn=Nd and pp=Na
Lp = sqrt(Dp1*Tp)
print"The hole diffusion length is ,Lp =","{:.2e}".format(Lp),"m"
Ln = sqrt(Dn2*Tn)
print"The electron diffusion length is ,Ln =","{:.2e}".format(Ln),"m"
# NOTE: pn= (ni**2/nn) and np=(ni**2/pp)
# assume that the doants are fully ionised
Io = A*e*((((Dn2)/(Ln))*(ni**2/Na))+(((Dp1)/(Lp))*(ni**2/Nd)))
print"The prefactor current is ,Io =","{:.1e}".format(Io),"A"
Na=10**17
Nd=10**17
Dp1 = 12.5
Dn1 = 35
Dp2 = 10
Dn2 = 220
Tn = 10**-8
Tp = 10**-8
e = 1.6*10**-19
kbT = 0.026
pn1 = 2.25*10**3
np1 = 2.25*10**3
pn2 = 3.38*10**-5
np2 = 3.38*10**-5
#Note : since value of holes and electrons in n- type and p type are not given for silicon and germanium thus we have assume it as above
#NOTE: nn=Nd and pp=Na
Lp1 = sqrt(Dp1*Tp)
Ln1 = sqrt(Dn1*Tn)
Lp2 = sqrt(Dp2*Tp)
Ln2 = sqrt(Dn2*Tn)
# NOTE: pn= (ni**2/nn) and np=(ni**2/pp)
# assume that the doants are fully ionised
Jo1 = e*((((Dn1)/(Ln1))*np1)+(((Dp1)/(Lp1))*pn1))
print"The prefactor current density for silicon is ,Jo1 =","{:.2e}".format(Jo1),"A/cm**2"
Jo2 = e*((((Dn2)/(Ln2))*np2)+(((Dp2)/(Lp2))*pn2))
print"The prefactor current density for GaAs is ,Jo2 =","{:.2e}".format(Jo2),"A/cm**2"
Na=5*10**16
Nd=5*10**17
Dp = 15
Dn = 30
Tn = 10**-8
Tp = 10**-7
e = 1.6*10**-19
kbT = 0.026
ni = 1.84*10**6
np=ni**2/Na
print"The electron conc in p type is ,np=","{:.2e}".format(np),"cm**-3"
pn=ni**2/Nd
print"The holes conc in n type is ,pn=","{:.2e}".format(pn),"cm**-3"
Lp = sqrt(Dp*Tp)
print"The hole diffusion length is ,Lp =","{:.2e}".format(Lp),"cm"
Ln = sqrt(Dn*Tn)
print"The electron diffusion length is ,Ln =","{:.2e}".format(Ln),"cm"
Gamma_inj = ((e*Dn*np)/(Ln))/(((e*Dn*np)/(Ln))+((e*Dp*pn)/(Lp)))
print"The efficiency of diode is ,Gamma_inj =",round(Gamma_inj,2)
A= 0.1*10**-2
Vf= 1.0
E= 1.43
Na=5.0*10**16
Nd=5.0*10**17
Dp = 15.0
Dn = 30.0
Tn =1*10**-8
Tp = 1.0*10**-7
e = 1.6*10**-19
kbT = 0.026
kni = 1.84*10**6
np=ni**2/Na
pn=ni**2/Nd
Ln = sqrt(Dn*Tn)
In = ((e*A*Dn*np)/Ln)*(exp(Vf/kbT)-1)
print"The electron current is ,In =","{:.1e}".format(In),"A"
In_by_e = In/e
print"The electron generation rate is ,In_by_e = ","{:.1e}".format(In_by_e),"s**-1"
power = In*E
print"The optical power of photon is ,power =","{:.1e}".format(power),"W"
apsilen = 11.9*8.85*10**-14
GL= 1.0*10**22
A= 1.0*10**-4
Vr= 15.0
Na=2.0*10**16
Nd=1.0*10**16
Dp = 12.0
Dn = 20.0
Tn = 1.0*10**-8
Tp = 1.0*10**-8
e = 1.6*10**-19
kbT = 0.026
ni = 1.5*10**10
Ln = sqrt(Dn*Tn)
print"The electron diffusion length is ,Ln =","{:.1e}".format(Ln),"cm"
Lp = sqrt(Dp*Tp)
print"The hole diffusion length is ,Lp = ","{:.2e}".format(Lp),"cm"
Vbi = kbT*log((Na*Nd)/ni**2)
print"The built in voltage is ,Vbi =","{:.2e}".format(Vbi),"V"
W = sqrt(((2*apsilen)/e)*((Na+Nd)/(Na*Nd))*(Vbi+Vr))
print"The depletion width is ,W =","{:.2e}".format(W),"cm"
IL = e*A*GL*(W+Ln+Lp)
print"The photo current is IL =","{:.2e}".format(IL),"A"
e = 1.6*10**-19
A=1.0*10**-7
Na=10**18*10**6
Nd=10**16*10**6
Dp = 7.8*10**-4
Dn = 7.3*10**-4
ni = 1.5*10**16
Wln = 5.0*10**-6
Wlp = Wln
#NOTE: nn=Nd and pp=Na
pn = ni**2/Nd
np = ni**2/Na
# from example 5.4 and 5.2 we get the value of diffusion length and zero bias depletion widths
Lp = 27.9*10**-6
print"The electron diffusion length is ,Lp= ","{:.2e}".format(Lp),"m"
Ln = 27*10**-6
print"The electron diffusion length is ,Ln= ","{:.2e}".format(Ln),"m"
Wp = 3.2*10**-10
print"The zero bias depletion widths is ,Wp= ","{:.2e}".format(Wp),"m"
Wn = 0.0000003
print"The zero bias depletion widths is ,Wn ","{:.2e}".format(Wn),"m"
# for short diode the prefactor current is given as
Io = e*A*(((Dp*pn)/(Wln-Wn))+((Dn*np)/abs(Wlp-Wp)))
print"The prefactor current is ,Io = ","{:.2e}".format(Io),"A"
# The prefactor current of short diode is approximately increase by a factor of 5.6 from that of long diode
# Note : due to different precisions taken by me and the author ... my answer differ
e = 1.6*10**-19
A= 10**-7
ni = 1.5*10**16
T = 1.0*10**-6
# from example 5.2 we get the value of zero bias depletion widths
W = 0.32*10**-6
Io_GR = (e*A*W*ni)/(2*T)
print"The prefactor of the is ,generation recombination currentIo_GR = ","{:.2e}".format(Io_GR),"A"
#let V = .2 V
V = 0.2
I_GR = Io_GR*(exp(V/(2*kbT))-1)
print"The diode current is ,I_GR =","{:.2e}".format(I_GR),"A"
#let V = 0.6 V
V = 0.6
I_GR = Io_GR*(exp(V/(2*kbT))-1)
print"The diode current is ,I_GR = ","{:.2e}".format(I_GR),"A"
# The generation-recombination prefactor is much larger than prefactor due to diffusion term
#In forward bias the diffusion current is initially much smaller than the generation recombination term but at high forward bias diffusion current will start to dominate
A= 1.0*10**-8
Na=1.0*10**23
Nd=1.0*10**23
Dp = 10.0*10**-4
Dn = 30.0*10**-4
Tn = 1.0*10**-7
Tp = 1.0*10**-7
tau = 1.0*10**-8
e = 1.6*10**-19
kbT = 0.026
ni = 1.5*10**16
apsilen = 11.9*8.85*10**-12
#NOTE: nn=Nd and pp=Na
Lp = sqrt(Dp*Tp)
print"The hole diffusion length is ,Lp = ","{:.2e}".format(Lp),"m"
Ln = sqrt(Dn*Tn)
print"The electron diffusion length is ,Ln = ","{:.2e}".format(Ln),"m"
# NOTE: pn= (ni**2/nn) and np=(ni**2/pp)
np=ni**2/Na
print"The electron conc in p type is ,np=","{:.2e}".format(np),"m**-3"
pn=ni**2/Nd
print"The holes conc in n type is ,pn=","{:.2e}".format(pn),"m**-3"
Vbi = kbT*log((Na*Nd)/ni**2)
print"The built in voltage is ,Vbi =","{:.2e}".format(Vbi),"V"
Io = e*((((Dn)*np)/(Ln))+((Dp*pn)/(Lp)))
print"The prefactor in the ideal diode is ,Io =","{:.2e}".format(Io),"A"
#let Vf = 0.5 V
Vf = 0.5
W = sqrt((2*apsilen/e)*((Na+Nd)/Nd/Na)*(Vbi-Vf))
print"The depletion width is ,W =","{:.2e}".format(W),"m"
Io_GR = e*A*W*ni/(2*tau)
print"prefactor for recombination generation current, Io_GR = ","{:.2e}".format(Io_GR),"A"
I = (Io*exp(Vf/kbT))+(Io_GR*exp(Vf/(2*kbT)))
I_V1 = I
print"Current, I =","{:.2e}".format(I_V1),"A"
#let V = 0.6 V
Vf = 0.6
W = sqrt((2*apsilen/e)*((Na+Nd)/Nd/Na)*(Vbi-Vf))
print"The depletion width is ,W =","{:.2e}".format(W),"m"
Io_GR = e*A*W*ni/2/tau
print"prefactor for recombination generation current, Io_GR = ","{:.1e}".format(Io_GR),"A"
I = (Io*exp(Vf/kbT))+(Io_GR*exp(Vf/(2*kbT)))
I_V2 = I
print"Current, I =","{:.2e}".format(I_V2),"A"
V1 = 0.5
V2 = 0.6
n = e*(V2-V1)/kbT/log(I_V2/I_V1)
print"Ideallity factor ,n =","{:.2e}".format(n)
#note: in the text book the value of
#-+"prefactor of ideal diode equation, Io"
#calculated by author is wrong thus it efect the overall calculation of the solution ,so the answer in the are wrong of some of the values
apsilen = 11.9*8.85*10**-14
Na=1.0*10**19
Nd=1.0*10**16
e = 1.6*10**-19
Fcrit1 = 4.0*10**5
Fcrit2 = 1.0*10**7
VBD_Si = (apsilen*Fcrit1**2)/(2*e*Nd)
print"The breakdown field for silicon is ,VBD_Si =","{:.2e}".format(VBD_Si)," V"
VBD_C = (apsilen*Fcrit2**2)/(2*e*Nd)
print"The breakdown field for diomond is ,VBD_C =","{:.2e}".format(VBD_C)," V"
# Note : In the textbook answer of breakdown voltage of silicon is wrong due to which breakdown voltage of diomand also differ
import numpy as np
print"Let the intercept of the 1/c**2 Vs V plot is represented by Icv, which is the built in voltage"
Icv = 0.68
Vbi = Icv
print"Let the slope of the intercept of the 1/c**2 Vs V plot is represented by dIcv"
dIcv=2.1*10**23
C = 7.0*10**-13
#NOTE: The above mentioned values are taken from the figure given in the question in textbook
apsilen = 11.9*8.85*10**-12
e = 1.6*10**-19
kbT = 0.026
A = 10**-7
ni = sqrt(2.25*10**20)
Neff = 2/(A**2*e*apsilen*dIcv)
print"The thickness of n region is ,Neff =","{:.2e}".format(Neff)," m**-3"
Neff = Neff/10**6
print"The thickness of n region is ,Neff =","{:.2e}".format(Neff)," cm**-3"
NaNd = exp(Vbi/kbT)*ni**2
print"NaNd =","{:.2e}".format(NaNd)," cm**-6"
# solving for Na and Nd by creating a quadratic equation using the equations mentioned in the book
p1 = [Neff*NaNd, -NaNd, Neff]
#Neff*NaNd - NaNd*X + Neff*X**2
p1=p1[0]
#p2=p1[1]
print(p1)
R= roots(p1)
#s=roots(p2)
Na= R
#Nd= s
#format ('e',10)
#print"Na = ""{:.2e}".format(Na),"cm**-3"
#print"Nd = ""{:.2e}".format(Nd),"cm**-3"
W = (apsilen*A)/C
print"The thickness of n region is ,W =","{:.1e}".format(W)," m"
import cmath
e = 1.6*10**-19
I= 1*10**-3
kbT = 0.026
Tp = 10**-6
Gs = (I)/(kbT)
print"The diode conductance is Gs = ","{:.2e}".format(Gs),"A/V"
Cdiff = (I*Tp)/(2*kbT)
print"The diffusion capacitance is Cdiff = ","{:.2e}".format(Cdiff),"F"
# The diffusion capacitance is much larger than junction capacitance hence neglecting junction capacitance
Y = Gs+(1j*2*math.pi*10**6*Cdiff)
print"The admittance of the diode is Y =",Y,"A/V"
# Note : due to different precisions taken by me and the author ... my answer differ
Vr= 10.0
R= 10.0*10**3
#The junction capacitance is 20pF at zero bias and 10 pF at full reverse bias so
Cavg= ((20+10)/2)
Tp = 10**-7
Ir = (Vr)/(R)
Tsd = Tp*log(2)
print"The storage delay time is Tsd = ","{:.2e}".format(Tsd)," s"
Tt = 2.3*R*Cavg*10**-12
print"The time Tt = ","{:.2e}".format(Tt)," s"
T = Tsd+Tt
print"The total diode recovery time is T = ","{:.2e}".format(T)," s"
# Note : due to different precisions taken by me and the author ... my answer differ