from __future__ import division
#given
#side of cube
l=20*10**-3 #m
#plank's constant
h=6.626*10**-34 #Js
#mass of electron
m=9.109*10**-31 #kg
# lower energy level
nx1=1
ny1=1
nz1=1
#higher energy level
nx2=2
ny2=1
nz2=1
#energy in the lower level
E1=h**2*(nx1**2+ny1**2+nz1**2)/(8*m*l**2) #J
#energy in the higher level
E2=h**2*(nx2**2+ny2**2+nz2**2)/(8*m*l**2) #J
#difference in energies of the two levels
deltaE=E2-E1 #J
print "deltaE = %0.2e"%deltaE
print "since deltaE is very small, so the assumption that E varies continuously with k, is justified"
#given
#distance between the plates
d=5*10**-3 #m
#voltage difference between the plates
V=230 #Volts
#electric field is given by
E=-V/d #V/m
print "electric field between the plates is %.f V/m"%(E)
#given
#conductivity of material
sigma=0.018 # per ohm m
#no of electrons
n=10**19 #electrons/m**3
#voltage
V=0.16 #V
#thickness of material
t=0.29*10**-3 #m
#mass and charge of electron
m=9.1*10**-31 #kg
e=1.602*10**-19 #C
#electric feilf gradient
kie=V/t #V/m
#as we know that
#sigma=n*e*vd/kie
#so v
vd=sigma*kie/n/e #m/s
print " drift velocity of carriers is %0.3f m/s"%(vd)
from math import pi
#given
#resistance of wire
R=21 #ohm
#length of wire
l=200 #m
#diameter of wire
d=0.44*10**-3 #m
#area of cross section of wire
A=(pi)/4*d**2 #m**2
#as we know that
#R=rho*l/A
#so
rho=R*A/l #ohm m
print "the specific resistance of wire is %0.2e ohm m"%(rho)
#given
#resistance of wire at 70 degree celcius is 57.2 ohm and at 25 degrees celcius 50 ohm
R25=50 #ohm
R70=57.2 #ohm
T1=25 #degree C
T2=70 #degree C\
#as we know that
#Rt=R0*(1+t*alpha)
#putting above values in the above given equation we get
#R25=R0*(1+25*alpha) -------(1)
#R70=R0*(1+70*alpha) --------(2)
#applying R70/R25
#we get
#R70/R25=(1+70*alpha)/(1+25*alpha)
#solving for alpha we get equation as follows
alpha=(R70-R25)/(T2*R25-T1*R70) #K**-1
print "the temperature coefficient of resistance is %f K**-1"%(alpha)
#given
#resistivity of copper , nickel and silver are
rhoCu=0.015*10**-6 #ohm m
rhoNi=0.012*10**-6 #ohm m
rhoAg=0.016*10**-6 #ohm m
#atomic percent of nickle and silver
CNi=0.25
CAg=0.40
#the resistivity of Cu-Ni-Ag alloy at 300 K
rho=rhoCu+(rhoNi*CNi)+(rhoAg*CAg) #ohm m
print " the resistivity of Cu=Ni-Ag alloy is %.2e ohm m"%(rho)