import math
##Example 19.1
##calculation of potential barrier
##given values
e=1.6*10**-19.;
n=4.4*10**28.;##no of atoms per m**3
kT=.026*e;##temp eqvlnt at room temp
ni=2.4*10**19.;##no of intrinsic carriers per m**3
NA=n/10**6.;##no of acceptors
ND=n/10**6.;##no of donors
##calculation
V=(kT/e)*math.log(NA*ND/ni**2);
print'%s %.2f %s'%('potential barrier in volts is',V,'');
import math
##Example 19.2
##calculation of current
##given values
e=1.6*10**-19.;
kT=.026*e;##temp eqvlnt at room temp
Io=2*10**-7;##current flowing at room temp in A
V=.1;##forward bias voltage in volts
##calculation
I=Io*(math.e**(e*V/kT)-1);##in Ampere
print'%s %.2f %s'%('current flowing when forward bias applied(in microampere)is',I*10**6,'');