In [2]:

```
from math import log
thetaM=4.26 #work function
chi=4.01 #electron affinity
thetaBN=thetaM-chi
print "The barrier height for N-type material is,"
print " Theta_BN = Theta_M - Chi = %0.2f V"%thetaBN
thetaIN=thetaBN-((((1.38*10**-23)*300)/(1.6*10**-19)))*log((2.8*10**25)/(4*10**17))
print "The built-in potential is given by,"
print " Theta_IN = Theta_BN - (kT/q)*ln(NC/ND) =%0.2f V"%thetaIN
# answer in the textbook is wrong, even if we take log10 we get a answer 0.047.
```