#Variable declaration
import math
Ro= 0.281 #equilibrium distance between ions, nm
alpha= 1.748 #Madelung constant
n= 9 #exponent, from observed compressibilities of NaCl
e= 1.6*(10**(-19)) #charge of an electron, C
Po= 8.85*(10**(-12)) #Permittivity of free space, F/m
#Calculation
K=1.0/(4*(math.pi)*Po) #constant, N.m**2/C**2
Uo= -(K*alpha*(e**2)*(1.0-(1.0/n)))/(Ro*(10**(-9))) #Potential energy per ion pair, J
Uo= Uo/e #converting to eV
E1= 5.14 #Ionisation energy for Na, eV
E2= -3.61 #electron affinity of Cl, eV
E= E1+E2 #Electron transfer energy, eV
Ecohesive = (Uo +E) #per electron pair, eV
Ecohesive= Ecohesive/2.0 #for each ion, eV
#Result
print"The cohesive energy in NaCl is: ",round(Ecohesive,2),"eV"
print"\nWhich is not far from experimental value of -3.28 eV"
#Variable declaration
A= 1.0 #cross-sectional area of wire, mm**2
I= 1.0 #current in wire, A
n= 8.5*(10**28) # electrons/m**3
e= 1.6*(10**(-19)) #charge of an electron, C
#Calculation
Vdrift= I/(n*(A*(10**(-6)))*e) #m/s
#Result
print"The drift velocity of electrons in the copper wire is:%.2g"%Vdrift,"m/s"
print"\nNOTE:Calculation mistake in book.Wrongly written as 7.4*10^-4"
#Variable declaration
n= 8.48*(10**28) #free electron density, m**(-3)
Vfermi= 1.57*(10**6) #Fermi Velocity, m/s
rho= 1.72*(10**(-8)) #resistivity, ohm
e= 1.6*(10**(-19)) #charge of an electron, C
Me= 9.1*(10**(-31)) #mass of electron, kg
#Calculation
lamda= Me*Vfermi/(n*(e**2)*rho) #m
lamda= lamda*(10**9) #converting to nm
#Result
print"The mean free path is:",round(lamda,1),"nm"