import math
#Variable declaration
Nd=10**16 #cm^-3
Na=0
ni=1.8*10**6 #cm^-3
T=300 #K
k=8.617*10**-5 #eV/K
E=10 #V/cm^2
e=1.6*10**-19
un=8500
#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
#Jdrf=e*(un*n0+up*p0)*E= e*un*Nd*E
Jdrf=e*un*Nd*E
print "Jdrf is %.f A/cm^2 "%Jdrf
#Variable declaration
Na=10**17 #cm**-3
T=300 #K
k=8.617*10**-5 #eV/K
E=10 #V/cm^2
e=1.6*10**-19 #C
#Calculations&Results
#sigma=e*un*n0=e*un*(Nd-Na)
#if
Nd=2*10**17 #cm**-3
sigma=8.16#ohm/cm
un=sigma/(e*(Nd-Na))
print "un is %.f cm^2/Vs "%un
#if
Nd=5*10**17 #cm^-3
sigma=20.8#ohm/cm
un=sigma/(e*(Nd-Na))
print "un is %.f cm^2/Vs"%un
#if
Nd=3.5*10**17 #cm^-3
sigma=16#ohm/cm
un=sigma/(e*(Nd-Na))
print "un is %.f cm^2/Vs"%un
#Variable declaration
V=5. #v
R=10*10**3 #ohm
J=50 #A/cm^2
E=100
Na=1.25*10**16 #cm^-3
Nd=5*10**15 #cm^-3
e=1.6*10**-19 #C
up=410 #cm**2/Vs
#Calculations&Results
I=V/R
print "I current is %.1f Ampere"%(I*10**3)
A=I/J
print "A cross sectional area is %.e cm^2 "%A
L=V/E
print "L length of resistor is %.e cm "%L
sigma=L/(R*A)
print "sigma conductivity is %.3f per ohm cm"%sigma #theoretical value
#sigma=e*up*p0=e*up*(Na-Nd)
sigma=e*up*(Na-Nd)
print "sigma conductivity is %.3f per ohm cm "%sigma #practical value
#Variable declaration
T=300 # ..K
Dn=225 #cm^2/s
e=1.6*10**-19# C
deltax=0.10 #cm
#Calculations
deltan=(1*10**18-7*10**17)#cm^-3
#Jnxdif=e*Dx*derivative (n,x)=e*Dn*(deltan/deltax)
Jnxdif=e*Dn*(deltan/deltax)
#Result
print "diffusion current density is %.f A/cm^2 "%Jnxdif
#Variable declaration
T=300. #K
k=8.617*10**-5 #eV/K
#derivative(Ndx,x)=a
a=-10**19 #cm**-4
Ndx=(10**16-10**19) #cm^3
l=1
#Calculations
#Ex=-(k*T/l)*(1./Ndx)*derivative(Ndx,x)
Ex=-(k*T/l)*(1./Ndx)*a*10**3
#Result
print "induced electric field is %.1f V/cm"%Ex
#Variable declaration
T=300 #K
u=1000 #cm^2/s
k=8.617*10**-5 #eV/K
e=1.6*10**-19 #C
#Calculations
#D=((k*T)/e)*u
D=k*T*u
#Result
print "diffusion coefficient is %.1f cm^2/s "%D
#Variable declaration
I=10**-3 #A
Bz=5.*10**-2 #500gauss
e=1.6*10**-19 #C
Vh=-6.25*10**-3 #V
Vx=12.5 #V
W=10**-4#m
d=10**-5 #m
#Calculations&Results
u=-(I*Bz)/(e*Vh*d)
print "electron concentration is %.2e m^-3 "%u
un=(I*I)/(e*Bz*Vx*W*d)
print "electron mobility is %.2e m^2/Vs"%un #textbook ans is wrong