In [7]:

```
# Finding Number of electron hole pairs
import math
# Variable Declaration
A = 4*10**-6; # Receiving area of photo detector
I = 200; # Intensity in W/m^2
h = 6.625*10**-34; # planck's constant
c = 3*10**8; # vel. of light in m/s
lamda = 0.4*10**-6; # wavelength of light in m
#Calculations
v = c/lamda; # frequency
NOP = I*A/(h*v) # number of photons
#since each photon generates an electron hole pair, the number of photons is equal to number of electron hole pairs
# Result
print 'Number of electron hole pairs = %3.2e '%NOP;
```

In [11]:

```
# Finding Wavelength
import math
# Variable Declaration
Eg = 2.8; # bandgap energy in eV
h = 6.625*10**-34; # plank's constant
c = 3*10**8; # vel. of light in m/s
q = 1.602*10**-19; # charge of electron
# Calculations
E = Eg*q # eV to joules conversion
lamda = h*c/E; # wavelength
#Result
print 'wavelength = %3.1f' %(lamda*10**10), 'Å(Blue Colour)';
```

In [12]:

```
# Finding Energy bandgap
import math;
# Variable Declaration
h = 6.625*10**-34; # plank's constant
c = 3*10**8; # vel. of light in m/s
lamda = 1.55*10**-6; # wavelength of light in m
q = 1.6*10**-19; # charge of electron
#Calculations
Eg = (h*c)/lamda; # band gap energy in joules
E = Eg/q # bang gap energy in eV
# Result
print 'Energy bandgap Eg = %3.4f'%E, 'eV';
```

In [14]:

```
# Finding Number of photons required to do one Joule of work
import math
# Variable Declaration
h = 6.625*10**-34; # plank's constant
c = 3*10**8; # vel. of light in m/s
lamda = 4961*10**-10; # wavelength of light in m
# Calculations
E = (h*c)/lamda; # energy in joules
N = 1/E
# Result
print 'Number of photons required to do one Joule of work = %3.4e'%N,'/m^3';
```

In [15]:

```
# Finding Wavelength Limit
# import math
# Variable Declaration
E = 0.02; # ionisation energy in eV
h = 6.625*10**-34; # plank's constant
c = 3*10**8; # vel. of light in m/s
q = 1.6*10**-19; # charge of electron
# Calculations
lamda = h*c/(E*q) # long wavelength limit in m
# Result
print 'long wavelength limit = %3.3e' %lamda,' m';
```

In [18]:

```
# Finding Wavelength
import math;
# Variable Declaration
E = 1.44; # Bandgap energy in eV
h = 6.625*10**-34; # plank's constant
c = 3*10**8; # vel. of light in m/s
q = 1.6*10**-19; # charge of electron
# Calculations
lamda = h*c/(E*q) # Wavelength of GaAs laser
# Result
print 'Wavelength of GaAs laser = %3.1f'%(lamda*10**10),' Å';
```

In [21]:

```
# Finding Energy of the first excited state
import math;
# Variable Declaration
h = 6.625*10**-34; # planck's constant
c = 3*10**8; # vel. of light in m/s
lamda = 5890*10**-10; # wavelength of light in m
q = 1.6*10**-19; # charge of electron
# Calculations
Eg = (h*c)/lamda; # energy in joules
E = Eg/q # energy in eV
# Result
print 'Energy of the first excited state = %3.3f' %E,'eV';
```

In [24]:

```
# Finding The ratio between the stimulated emission and apontaneous emission
import math;
# Variable Declaration
h = 6.625*10**-34; # planck's constant
c = 3*10**8; # vel. of light in m/s
lamda = 5890*10**-10; # wavelength of light in m
k = 1.38*10**-23; # Boltzmann constant
Tc = 280 # Temperature in centigrades
# Calculations
T = Tc+273; # temperature in kelvin
R = 1/((math.exp((h*c)/(k*T*lamda))) - 1); # ratio of stimulated emission to spontaneous emission
# Result
print 'The ratio between the stimulated emission and apontaneous emission = %3.3e' %R;
```

In [25]:

```
# Finding The No. of Photons emitted per minute
import math;
# Variable Declaration
h = 6.625*10**-34; # planck's constant
c = 3*10**8; # vel. of light in m/s
lamda = 6328*10**-10; # wavelength of He-Ne laser source in m
q = 1.6*10**-19; # charge of electron
P = 3*10**-3 # output power of the He-Ne source in watts or J/sec
# Calculations
v = c/lamda # frequency of the photon emitted by the laser beam
E = h*v; # energy of a photon in joules
Po = P*60; # conversion from J/sec to J/min
N = Po/E; # No of photons emitted per minute
# Result
print 'The No. of Photons emitted per minute = %3.3e' %N, 'photons/minute';
```

In [26]:

```
# Finding The No. of Photons emitted per hour
import math;
# Variable Declaration
h = 6.625*10**-34; # planck's constant
c = 3*10**8; # vel. of light in m/s
lamda = 9.6*10**-6; # wavelength of CO2 laser source in m
q = 1.6*10**-19; # charge of electron
P = 10*10**3 # output power of the CO2 laser source in watts or J/sec
# Calculations
v = c/lamda # frequency of the photon emitted by the laser beam
E = h*v; # energy of a photon in joules
Po = P*60*60; # conversion fro J/sec to J/hour
N = Po/E; # No of photons emitted per hour
# Result
print 'The No. of Photons emitted per hour = %3.3e'%N,' photons/hour';
```

In [32]:

```
import math;
# Variable Declaration
h = 6.625*10**-34; # planck's constant
c = 3*10**8; # vel. of light in m/s
lamda = 10*10**-2; # wavelength for microwave region in m
T = 300 # Temperature in Kelvin
Kb = 1.38*10**-23 # Boltzmann constant
# Calculations
# let R = Rsp/Rst
R = math.exp((h*c)/(lamda*Kb*T)) - 1 ; # ratio of spontaneous to stimulated emission
if R<1:
print 'Since the spontaneous emission is lesser than stimulated emission \n hence MASER action is possible at thermal equilibrium'
```

In [37]:

```
import math;
# Variable Declaration
h = 6.625*10**-34; # planck's constant
c = 3*10**8; # vel. of light in m/s
lamda = 5000*10*8-10; # wavelength for optical region in m
T = 300 # Temperature in Kelvin
Kb = 1.38*10**-23 # Boltzmann constant
# Calculations
# let R = Rsp/Rst
R = math.exp((h*c)/(lamda*Kb*T)) - 1; # ratio of spontaneous to stimulated emission
if R<1:
print 'Since the spontaneous emission is lesser than stimulated emission \n hence LASER action is possible at thermal equilibrium'
else:
print 'Since the spontaneous emission is more predominant than stimulated emission\nhence LASER action is not possible at optical frequencies under thermal equilibrium';
```

In [38]:

```
import math
# Variable Declaration
h = 6.625*10**-34; # plank's constant
c = 3*10**8; # vel. of light in m/s
lamda = 5511.11*10**-10; # wavelength of green LED light in m
q = 1.6*10**-19; # charge of electron
# Calculations
Eg = (h*c)/lamda; # band gap energy in joules
E = Eg/q # bang gap energy in eV
# Result
print ' Eg = %3.2f' %E,'eV';
```