# Example No. 3.1
# To calculate the Einstein A and B coefficients
# Page no.99
import math
# Given data
tsp=2*10**-9; # Spontaneous lifetime associated with 2 → 1 transition in seconds
deltaE=2.4*10**(-19); # The energy difference between the levels
h=1.054*10**(-34); # The distance between two levels
omega=deltaE/h; # Frequency in rad/sec
v=1.25*10**8; # The velocity of light in the medium in m/s
# The Einstein A and B coefficients
A=(1/tsp)*10**-8; # Einstein coefficient A
B=(((1/tsp)*math.pi**2*v**3)/(h*omega**3))*10**-21; # Einstein coefficient B
# Displaying the result in command window
print "\n Einstein coefficient A = ",round(A)," X 10**8 s**(-1)"
print "\n Einstein coefficient B = ",round(B,2)," X 10**21 m**3/J.s**2"
# The answers are varrying due to round off error
# Example no. 3.2
# To calculate (a) the wavelength of light emitted, (b) the ratio of spontaneous emission rate to stimulated emission rate, (c) the ratio of stimulated emission rate to absorption rate, and (d) the population density of the excited level.
# Page no. 100
import math
# Given data
deltaE=1.26*10**-19; # The energy difference between two levels
h=1.054*10**(-34); # The distance between two levels
c=3*10**8; # The speed of ligth in m/s
kB=1.38*10**(-23); # The Boltzmann’s constant J/K
T=300; # The absolute temperature in Kelvin
N1=10**19; # The population density in the ground state in cm**(-3)
# (a)The wavelength of light emitted
h=2*math.pi*h; # The distance between two levels in J.s
f=deltaE/h; # The frequency in Hz
lambdaa=(c/f)*10**6; # The wavelength of ligth emitted in micrometer
# Displaying the result in command window
print "\n The wavelength of ligth emitted = ",round(lambdaa,2)," micrometer"
# The calculation of this answer is wrong in the book
# (b)The ratio of spontaneous emission rate to stimulated emission rate
RspRst=(exp(deltaE/(kB*T))-1); # The ratio of spontaneous emission rate to stimulated emission rate
# Displaying the result in command window
print "\n The ratio of spontaneous emission rate to stimulated emission rate = ",round(RspRst*10**-13,2)," X 10**13"
# The calculation of this answer is wrong in the book
# (c)The ratio of stimulated emission rate to absorption rate
RstRab=(exp(-deltaE/(kB*T))); # The ratio of stimulated emission rate to absorption rate
# Displaying the result in command window
print "\n The ratio of stimulated emission rate to absorption rate = ",round(RstRab*10**14,2)," X 10**-14"
# The calculation of this answer is wrong in the book
# (d)The population density of the excited level
N2=(N1*exp(-deltaE/(kB*T))); # The population density of the excited level in cm**(-3)
# Displaying the result in command window
print "\n The population density of the excited level = ",round(N2*10**-5,2)," X 10**5 cm**(-3)"
# The calculation of this answer is wrong in the book
# Example No. 3.3
# To calculate the longitudinal mode spacing and the minimum gain required for laser oscillation
# Page no. 106
import math
# Given data
c=3*10**8; # The speed of ligth in air
L=500*10**(-6); # The distance between mirrors
n=3.5; # The refractive index
inlossdB=50; # The internal loss in dB/cm
R1=0.3; # The reflectivity of ligth wave which is reflected at A
R2=0.3; # The reflectivity of ligth wave which is reflected at B
# The longitudinal mode spacing
deltaf=(c/(2*n*L))*10**-9; # The longitudinal mode spacing
L=0.05; # The distance between mirrors in cm
amir=(1/(2*L))*math.log(1/(R1*R2)); # The loss due to mirrors per cm
aint=math.log(10**(inlossdB/10)); # The coefficient of internal loss due to scattering
# The minimum gain required
g=aint+amir; # The minimum gain required for laser oscillation
# Displaying the result in command window
print "\n The longitudinal mode spacing = ",round(deltaf,2)," GHz"
print "\n The minimum gain required for laser oscillation per cm = ",round(g,2)," cm**-1"
# Example no. 3.4
# To calculate the energy density.
# Page no. 107
import math
# Given data
P=20*10**(-3); # The mean power in W
A=100*10**(-12); # The area perpendicular to the direction of light propagation in m**2
n=3.2; # Refractive index of gain medium
c=3*10**8; # Speed of ligth in m/s
I=P/A; # The optical intensity in W/m**2
# The energy density
u=(n*I)/c; # The energy density in J/m**3
# Displaying the result in command window
print "\n The energy density = ",round(u,2)," J/m**3"
# Example no.3.5
# To calculate the frequency of the electromagnetic wave emitted by stimulated emission.
# Page no.110
import math
# Given data
E=10**(-4); # The energy difference between two levels in eV
E=10**(-4)*1.602*10**(-19); # The energy difference between two levels in J
h=1.054*10**(-34); # The distance between two levels
# The frequency of the electromagnetic wave emitted by stimulated emission.
f=(E/(2*math.pi*h))*10**-9; # The frequency of the electromagnetic wave emitted by stimulated emission in GHz
# Displaying the result in command window
print "\n The frequency of the electromagnetic wave emitted by stimulated emission = ",round(f)," GHz"
# Example 3.6
# To calculate the band-gap energy.
# Page no.123
import math
# Given data
m=9.109*10**(-31); # The electron rest mass in kg
meff1=0.07*m; # The effective mass of an electron in the conduction band
meff2=0.5*m; # The effective mass of an electron in the valence band
mr=(meff1*meff2)/(meff1+meff2); # The reduced mass
hkl=7.84*10**(-26); # The electron momentum in kg.m/s
lambdaa=0.8*10**(-6); # The wavelength of electromagnetic wave in m
h=1.054*10**(-34); # The distance between two levels
c=3*10**8; # Speed of ligth in m/s
hw=(h*2*math.pi*c)/lambdaa; # The poton energy in J
# The band-gap energy.
Eg=hw-(hkl**2/(2*mr)); # The band-gap energy in J
# Displaying the result in command window
print "\n The band-gap energy = ",round(Eg*10**19,2)," X 10**-19 J"
# Example no.3.7
# To calculate (a) the photon lifetime, (b) the threshold current, and (c) the current required to generate a mean photon density of 8.5 × 10**21 m−3
# Page no.130
import math
# Given data
w=3*10**(-6); # The active area width in meter
d=0.3*10**(-6); # The active area thickness in meter
L=500*10**(-6); # The length
Te=1*10**(-9); # Electron lifetime
Neth=0.8*10**(24); # Threshold electron density
aint=46*10**2; # Internal cavity loss in m**-1
n=3.5; # Refrective index of the medium
R1=0.65; # The reflectivity of ligth wave which is reflected at A
R2=0.65; # The reflectivity of ligth wave which is reflected at B
# (a)The photon lifetime
amir=(1/(2*L))*math.log(1/(R1*R2)); # The loss due to mirrors per m
c=3*10**8; # Speed of ligth in m/s
v=c/n; # Speed of ligth in medium (m/s)
Tp=1/(v*(aint+amir)); # The photon lifetime in sec
# Displaying the result in command window
print "\n The photon lifetime = ",round(Tp*10**12,2)," ps"
# (b)The threshold current
V=w*d*L; #The active volume in m**3
q=1.602*10**(-19); #The electron charge in C
Te=10**-9; #The electron lifetime in sec
Ith=(Neth*q*V)/Te; #The threshold current in mA
# Displaying the result in command window
print "\n The threshold current = ",round(Ith*10**3,1)," mA"
# The answer calculated in book is wrong
# (c)The current required to generate a mean photon density of 8.5 × 10**21 m−3
Nph=8.5*10**21; #Mean photon density
Tph=Tp; #The photon lifetime in sec
I=(Ith+(Nph*q*V)/Tph); #The current required to generate a mean photon density of 8.5 × 10**21 m−3
# Displaying the result in command window
print "\n The current required to generate a mean photon density of 8.5 × 10**21 m**-3 = ",round(I*10**3,2)," mA"
# The answer calculated in book is wrong
# Example no.3.8
# To find the wavelength of the light emitted
# Page no.133
import math
# Given data
RspRst=2*10**14; # The ratio of spontaneous emission rate to stimulated emission rate
T=30; # Temperature in degree celcius
kB=1.38*10**(-23); # The Boltzmann’s constant J/K
h=1.054*10**(-34); # The distance between two levels
c=3*10**8; # Speed of ligth in air
T=T+273; # Temperature in Kelvin
w=(math.log(RspRst)*kB*T)/h; # Frequency in Rad
# The wavelength of the light emitted
lambdaa=(2*math.pi*c)/w; # The wavelength of the light emitted
# Displaying the result in command window
print "\n The wavelength of the light emitted = ",round(lambdaa*10**6,2)," micrometer"
# Example no.3.9
# To calculate a) the frequency separation between modes (b) the wavelength separation between modes
# Page no.133
import math
# Given data
lambdaa=1.3*10**-6; # Laser diode operating wavelength
L=300*10**-6; # Cavity length
n=3.5; # Refractive index of active region
c=3*10**8; # Speed of ligth in air (m/s)
# a)The frequency separation between modes
deltaf=c/(2*n*L); # The frequency separation between modes in GHz
# Displaying the result in command window
print "\n The frequency separation between modes = ",round(deltaf*10**-9,1)," GHz"
# (b)The wavelength separation between modes
deltalambda=(lambdaa**2*deltaf)/c; # The wavelength separation between modes
# Displaying the result in command window
print "\n The wavelength separation between modes = ",round(deltalambda*10**9,1)," nanometer"
# The wrong unit is givan in book
# Example no.3.10
# To calculate the effective mass of the electron in the valence band.
# Page no.134
import math
# Given data
Eg=1.18; # Band gap in eV
Eg=1.18*1.602*10**-19; # Band gap in J
hk1=9*10**-26; # The crystal momentum in Kg.m/s
h=1.054*10**(-34); # The distance between two levels
f=3.94*10**14; # Light wave of frequency
m=9.109*10**(-31); # The electron rest mass in kg
mr=(hk1)**2/(2*(h*2*math.pi*f-Eg)); # The reduced mass in kg
meff1=0.07*m; # The effective mass of an electron in the conduction band
# The effective mass of the electron in the valence band.
meff2=(mr*meff1)/(meff1-mr); # The effective mass of the electron in the valence band.
# Displaying the result in command window
print "\n The effective mass of the electron in the valence band = ",round(meff2*10**31,2)," X 10**-31 kg"
# The answer is varrying due to round-off error
# Example no.3.11
# To calculate (a) the optical gain coefficient Γg required to balance the cavity loss and (b) the threshold electron density Ne
# Page no.135
import math
# Given data
L=320*10**-6; # Cavity length
R1=0.35; # The reflectivity of ligth wave which is reflected at A
R2=0.35; # The reflectivity of ligth wave which is reflected at B
aint=10**3; # Internal cavity loss in m**-1
c=3*10**8; # Speed of ligth in air
Go=1.73*10**-12; # Gain coefficient in m**3/s
Neo=3.47*10**23; # The value of the carrier density at which the gain coefficient becomes zero in m**-3
n=3.3; # Refractive index of medium
# (a) the optical gain coefficient Γg required to balance the cavity loss
amir=(1/(2*L))*math.log(1/(R1*R2)); # The loss due to mirrors per m
acav=amir+aint; # The total cavity loss coefficient
gammag=acav; # The optical gain coefficient in m**-1
# Displaying the result in command window
print "\n The optical gain coefficient = ",round(gammag*10**-3,2)," X 10**3 m**-1"
#(b) the threshold electron density Ne
v=c/n; # Velocity of ligth in medium
Tph=1/(v*acav); # The photon lifetime in sec
Neth=Neo+1/(Go*Tph); # The threshold electron density Ne
# Displaying the result in command window
print "\n The threshold electron density = ",round(Neth*10**-23,2)," X 10**23 m**-3"