In [1]:

```
#Electron concentration
V=0.1 # Voltage in volts
I=5e-3 # Current in ampere
l_a=7e8 # Length to cross-sectional area ratio in metre inverse
mu=0.05 # Electron mobility in metre square per volt second
q=1.6e-19 # Charge on an electron in coulombs
n=(l_a*I)/(V*q*mu)# #Electron concentration in inverse metres cube
n=n*1e-6# #Electron concentration in inverse centimetres cube
print "Electon concentration = %0.3e cm**-3"%n
```

In [2]:

```
#Electric field intensity, Voltage
l=3e-3 # Length of the bar in metres
a=50*10*1e-12 # Cross-sectional area in metres square
I=2e-6 # Current in amperes
rho=2.3e3 # Resistivity in ohm metres
E=I*rho/a # Electric field intensity in volt per metres
V=E*l # Voltage across the bar in volt
print "Electic field intensity = %0.2e V/m"%E
print "Voltage across the bar = %0.2f V"%V
# ans wrong in the book.
```

In [3]:

```
#Electron concentration, Hole concentration, Conductivity, Voltage
l=3e-3 # Length on Si sample in metres
a=5e-9 # Cross-sectional area of Si sample in metres square
ND=5e20 # Donor concentration in inverse metres cube
I=2e-6 # Current flowing through the bar in amperes
ni=1.45e16 # Intrinsic carrier concentration in inverse metres cube
mu_n=0.15 # Mobility of electrons in metres square per volt second
q=1.6e-19 # Charge on an electron in coulombs
n=ND # Electron concentration in inverese metres cube
p=ni*ni/n # Hole concentration in inverese metres cube
sigma=q*n*mu_n# # Conductivity of Si sample in inverse ohm metres
V=(I*l)/(a*sigma) # Voltage across the bar in volts
n=n*1e-6 # Electron concentration in inverese centimetres cube
p=p*1e-6 # Hole concentration in inverese centimetres cube
sigma=sigma*0.01 # Conductivity of Si sample in inverse ohm centimetres
print "Electron concentration = %0.e cm**-3"%n
print "Hole concentration = %0.2e cm**-3"%p
print "Conductivity of Si sample = %0.2f ohm**-1 cm**-1"%sigma
print "Voltage across the bar = %0.2f V"%V
```

In [4]:

```
from math import log
#Contact difference of potential
N=5e22 # Number of acceptor or donor atoms per metres cube of step graded p-n junction
ni=1.45e16 # Intrinsic carrier concentration in inverse metres cube
VT=25e-3 # Voltage equivalent to temperatue at room temperature in volts
Vo=VT*log(N**2/ni**2) # Contact difference of potential in volts
Vo=Vo*1e3 # Contact difference of potential in milivolts
print "Contact difference of potential = %0.2f mV"%Vo
```

In [6]:

```
from math import log
#Potential barrier
rho_p=0.05 # Resistivity of p side of step-graded junction in ohm metres
rho_n=0.025 # Resistivity of n side of step-graded junction in ohm metres
mu_p=475e-4 # Mobility of holes in metres square per volt second
mu_n=1500e-4 # Mobility of holes in metres square per volt second
ni=1.45e16 # Intrinsic carrier concentration in atoms per metres cube
q=1.6e-19 # Charge on an electron in coulombs
VT=25e-3 # Voltage equivalent to temperatue at room temperature in volts
NA=1/(q*mu_p*rho_p) # Acceptor concentration in atoms per metres cube
ND=1/(q*mu_n*rho_n) # Donor concentration in atoms per metres cube
Vo=VT*log(NA*ND/ni**2) # Contact difference of potential in volts
Vo=Vo*1e3 # Contact difference of potential in milivolts
print "Contact difference of potential = %0.2f mV"%Vo
```