import math
#variable declaration
E2 = 5.56*10**-19; # Higher Energy level in J
E1 = 2.36*10**-19; # Lower Energy level in J
h = 6.626*10**-34; # plancks constant in J.s
c = 3*10**8; # velocity of light in m
# Calculations
dE = E2 - E1; # Energy difference in J
lamda = (h*c)/float(dE); # wavelength in m
# Result
print'Wavelength of the photon = %d'%(lamda*10**10),'Å';
print' The colour of the photon is red';
import math
# Variable declaration
h = 6.63*10**-34; # plancks constant in J.s
c = 3*10**8; # velocity of light in m
E = 5.6; # bandgap in eV
e = 1.6*10**-19; # charge of electron coulombs
# Calculations
lamda = (h*c)/float(E*e) # wavelength in m
#output
print'Maximum Wavelength for which diamond is opaque is Imax = %d '%(lamda*10**10),'Å';
print'\n Note: Imax is wrongly printed as 220 Å in textbook';
import math
#variable declaration
h = 6.63*10**-34; # plancks constant
c = 3*10**8; # velocity of light
lamda = 0.6*10**-6; # wavelength in m
e = 1.6*10**-19; # charge of electron
EGap = 2.25; # energy in eV
EGas = 1.42; # energy in eV
#Calculations
E = (h*c)/float(lamda*e); # Energy in eV
p_change = (EGap - EGas)/float(100); #rate of energy gap
x = (E-EGas)/float(p_change); #mol % of GaP to be added to get an energy gap of E
# Result
print'Energy of radiation = %3.4f'%E,'eV';
print'Rate of energy gap varies with addition of GaP is %3.5f'%p_change,'eV/mol %';
print'mol percent to be added to get an energy gap of %3.4f'%E,'eV','is %3.2f'%x,'mol %';
import math
#variable declaration
h = 6.63*10**-34; #plancks constant in J.s
c = 3*10**8; # velocity of light in m
lamda = 1.1*10**-6; # wavelength in m
e = 1.6*10**-19; # charge of electron in coulombs
E2 = 0.4*10**-19; # energy level in joules
#Calculations
E3 = E2 + ((h*c)/float(lamda)); #energy in J
#Result
print'Energy of the metastable state E3 = %3.1e'%E3,'J';
import math
#variable declaration
c = 3*10**8; # velocity of light in m
L = 1.5; #length in m
n = 1.0204; # refractive index
BW = 1.5*10**9; # Bandwidth in Hz
# Calculations
dV = c/float(2*L*n); #frequency in Hz
N = BW/float(dV); # Number of optical nodes
# Result
print'Number of Optical modes = % d'%N;
import math
#variable declaration
n1 = 1.55; # refractive index of core
n2 = 1.53; # refractive index of cladding
# Calculations
NA = math.sqrt(n1**2 - n2**2);
#Result
print'Numerical aperture = %3.3f'%NA;
import math
#variable declaration
n1 = 1.33; #refractive index of water
n2 = 1; # refractive index of air
# Calculations
theta_c = math.asin((n2/n1))
theta_c_deg = theta_c*(180/float(math.pi)); # radian to degree conversion
# Result
print'For angles above %3.2f° ,there will be total internal reflection in water'%theta_c_deg ;