# Chapter 16:Cosmology: Origin and Fate of Universe¶

## Example 16.1 Page 529¶

In :
#initiation of variable
from math import log
N2=0.25;N1=0.75;                                #various given values
L2=1.0;L1=0.0;
E1_E2=-4.7*(10**-4);                             #Energy difference

#calculation
a=(N2/N1); b=(((2*L2)+1)/((2*L1)+1));c=E1_E2; #various terms involved in the formula of ratio of population
kT=(c/log(a/b));                              #value of k*T
k=0.0000856;                                 #constant
T=kT/k;                 #temperature of interstellar space

#result
print "The temperature of interstellar space was found out to be in K",round(T,3);

The temperature of interstellar space was found out to be in K 2.499


## Example 16.2 Page 536¶

In :
#initiation of variable
mc2=940.0*10**6; k=8.6*10**-5; #various constants and given values in suitable units

#calculation
T= mc2/k;       #temperature of the photons

#result
print "The temperature of the photons must be in K %.1e" %round(T,3);

#part2
t=((1.5*10**10)/T)**2;       #age of universe when the photons have the above temperature

#result
print"The age of the universe for the temperature of the photon to be as obtained above in seconds is %.0e" %t;

The temperature of the photons must be in K 1.1e+13
The age of the universe for the temperature of the photon to be as obtained above in seconds is 2e-06


## Example 16.3 Page 539¶

In :
#initiation of variable
from math import exp
k=8.62*10**-5; #various values and constants
T= 1.5*10**10;
delE=1.3*10**6;

#calculation
a= delE/(k*T);  #exponent in boltzmann factor
b=exp(-a);        #ratio of neutron to protons
r=(1/(1+b))*100;     #relative number of protons

#result
print"The percentage of protons is",round(r)," neutrons is ",round(100-r);

The percentage of protons is 73.0  neutrons is  27.0