#To calculate the relative population
#importing modules
import math
#Variable declaration
lamda = 590; #wavelength(nm)
h = 6.625*10**-34; #planck's constant
c = 3*10**8; #velocity of light(m/s)
k = 1.38*10**-23; #boltzmann's constant
T = 523; #temperature(Kelvin)
#Calculation
lamda = lamda*10**-9; #wavelength(m)
#n1byn2 = math.exp(-(E2-E1)/(k*T))
#but E2-E1 = h*new and new = c/lamda
#therefore n1byn2 = math.exp(-h*c/(lamda*k*T))
n1byn2 = math.exp(-h*c/(lamda*k*T));
#Result
print "relative population of Na atoms is",n1byn2
#To calculate the ratio of stimulated to spontaneous emission
#importing modules
import math
#Variable declaration
lamda = 590; #wavelength(nm)
h = 6.625*10**-34; #planck's constant
c = 3*10**8; #velocity of light(m/s)
k = 1.38*10**-23; #boltzmann's constant
T = 523; #temperature(Kelvin)
#Calculation
lamda = lamda*10**-9; #wavelength(m)
#n21dashbyn21 = 1/(math.exp(h*new/(k*T))-1)
#but new = c/lamda
#therefore n21dashbyn21 = 1/(math.exp(h*c/(lamda*k*T))-1)
A = math.exp(h*c/(lamda*k*T))-1;
n21dashbyn21 = 1/A;
#Result
print "ratio of stimulated to spontaneous emission is",n21dashbyn21
print "answer given in the book is wrong"
#To calculate the number of photons emitted
#importing modules
import math
#Variable declaration
lamda = 632.8; #wavelength of laser(nm)
h = 6.625*10**-34; #planck's constant
c = 3*10**8; #velocity of light(m/s)
p = 3.147; #output power(mW)
#Calculation
p = p*10**-3; #output power(W)
lamda = lamda*10**-9; #wavelength(m)
new = c/lamda; #frequency(Hz)
E = h*new; #energy of each photon(J)
Em = p*60; #energy emitted per minute(J/min)
N = Em/E; #number of photons emitted per second
#Result
print "number of photons emitted per second is",N