import math
#Variable declaration
T=300#K
Na=1*10**18# Na=L*10**18 cm**-3
Nd=1*10**15# cm**-3
ni=1.5*10**10# cm**-3
e=1.6*10**-19# eV
k=1.3806*10**-23# JK**-1
#Calculations&Results
Vbi=(((k*T)/e)*math.log(Na*Nd/ni**2))
print "the value of Vbi is %.3f V"%Vbi
#changing the Na value
Na=10**16# Na=l*10**16 cm**1
Vbi=(((k*T)/e)*math.log(Na*Nd/ni**2))
print "the value of Vbi is %.3f V "%Vbi
#Variable declaration
T=300.#K
Na=10**16# cm**-3
Nd=10**15# cm**-3
e=1.6*10**-19# eV
epsilon0=8.85*10**-14# F/m
epsilons=11.7
Vbi=0.635# V
#Calculations&Results
W=(((2*(epsilons*epsilon0)*Vbi)/e)*(Na+Nd)/(Na*Nd))**0.5
print "W spacing charge width is %.2e c- meter"%W
xn=0.864*10**-4# xp=0.086 micro m
Emax=-e*Nd*xn/(epsilons*epsilon0)
print "the value of Emax is %.2e V/cm"%Emax #Answer in textbook is incorrect
#Variable declaration
T=300#K
Na=10**16# cm**-3
Nd=10**15# cm**-3
e=1.6*10**-19# eV
epsilon0=8.85*10**-14# F/m
epsilons=11.7
Vbi=0.635# V
Vr=5# V
#Calculations
W=(((2*(epsilons*epsilon0)*(Vbi+Vr))/e)*(Na+Nd)/(Na*Nd))**0.5
#Result
print "the value of W is %.2e m"%W
import math
#Variable declaration
T=300#K
k=8.617*10**-5#eV/K
e=1.6*10**-19 #C
Vr=25 #V
Emax=3*10**5#V/cm
Na=10**18#cm**-3
esp=11.7
esp0=8.85*10**-14
#Calculations
#Emax=sqrt((2*e*Vr*(Na+Nd))/(esp*(Na+Nd))
x=((Emax**2)*esp*esp0)/(2*e*Vr) #solving the above equation we get
Nd=(Na*x)/(Na-x)
#Result
print "doping concentration is %.2e cm**-3"%Nd
#Variable declaration
T=300#K
Na=10**16# cm**-3
Nd=10**15# cm**-3
e=1.6*10**-19# eV
epsilon0=8.85*10**-14# F/m
epsilons=11.7
Vbi=0.635# V
Vr=5# V
#Calculations
C=((e*(epsilons*epsilon0)*Na*Nd)/(2*(Vbi+Vr)*(Na+Nd)))**0.5
A=10**-4# cm**2
C=C*A
#Result
print "the value of c with cross section area is %.3e F "%C
import math
#Variable declaration
T=300#K
ni=1.5*10**10# cm**-3
Nd=10**15# cm**-3
Vbi=0.855# V
e=1.6*10**-19# eV
k=1.3806*10**-23# JK**-1
S=1.32*10**15# Slope=1.32*10**-15 (F/cm**2)**-2*(V)-1
epsilon0=8.85*10**-14# F/m
epsilons=11.7
#Calculations
Nd=2/((e*(epsilons*epsilon0))*S)
Na=((ni*ni)/Nd)*math.exp((e*Vbi)/(k*T))
#Result
print "the value of Na is %.2e cm**-3"%Na