Chapter 16: Cosmology and Modern Astrophysics - The Beginning and the End

Example 16.1, Page 581

In [1]:
import math

#Variable declaration
H0 = 22;    # Value of Hubble constant, km/s per million ly
parsec = 3.26;    # The value of 1 parsec, light years

#Calculations&Result
print "The value of Hubble constant = %d km/s per Mpc"%math.ceil(H0*parsec)
The value of Hubble constant = 72 km/s per Mpc

Example 16.2, Page 583

In [2]:
#Variable declaration
M = 1;    # Let the current mass of the universe be unity
m_u = 1;    # Mass equivalent of 1 amu, u
N_n = 2;    # Number of neutrons in helium
N_p = 2;    # Number of protons in helium

#Calculations
M_p = 0.75*M*m_u;    # Total mass of protons
M_He = 0.25*M*m_u;    # Total mass of helium
N_fp = M_p/M_He*(N_n + N_p);    # Total number of free protons for every He-4
N_P = N_fp + N_p;    # Total number of protons per He-4
ratio = N_P/N_n;    # Current ratio of protons to the neutrons in the universe

#Result
print "The current ratio of protons to the neutrons in the universe = %d"%ratio
The current ratio of protons to the neutrons in the universe = 7

Example 16.3, Page 607

In [3]:
import math

#Variable declaration
m_n = 939.566;    # Rest mass of the neutron, MeV/c^2
m_p = 938.272;    # Rest mass of the proton, MeV/c^2
e = 1.6e-019;    # Energy equivalent of 1 eV, J
c = 1;    # For simplicity assume speed of light of light to be unity
T = 1e+010;    # Temperature of the universe, K

#Calculations
delta_m = m_n - m_p;    # Mass difference between a proton and a neutron, MeV/c^2
k = 1.38e-023;    # Boltzmann constant, J/k
# As from Maxwell-Boltzmann distribution from thermodynamics, N = exp(-m*c^2/(k*T)), so
ratio = math.exp(delta_m*c**2*1e+006*e/(k*T));    # Ratio of protons to neutrons in the universe at 10 billion kelvin

#Result
print "The ratio of protons to neutrons in the universe at 10 billion kelvin = %3.1f"%ratio
The ratio of protons to neutrons in the universe at 10 billion kelvin = 4.5

Example 16.4, Page 589

In [4]:
import math

#Variable declaration
M = 1.99e+030;    # Mass of the sun, kg
G = 6.67e-011;    # Universal gravitational constant, N-Sq.m/kg^2
k = 1.38e-023;    # Boltzmann constant, J/K
R = 6.96e+008;    # Radius of the sun, m
m = 1.67e-027;    # Rest mass of the proton, kg

#Calculations
PE = 3./5*(G*M**2/R);    # Self potential energy of the sun, J
# As KE = 1./3*(M/m_p)*m_p*v**2, solving for v
v = math.sqrt(2*PE/M);    # Velocity of a proton inside the sun, m/s
# From kinetic theory of gases, v = sqrt(3*k*T/m), solving for T
T = m*v**2/(3*k);    # The mean temperature of the sun, K

#Result
print "The mean temperature of the sun = %1.0e K"%T
The mean temperature of the sun = 9e+06 K

Example 16.5, Page 590

In [5]:
import math

#Variable declaration
M_sun = 1.99e+030;    # Mass of the sun, kg
m_n = 1.675e-027;    # Rest mass of the neutron, kg
h = 6.62e-034;    # Planck's constant, Js

#Calculations
h_bar = h/(2*math.pi);    # Planck's constant, Js
G = 6.67e-011;    # Universal gravitational constant, N-Sq.m/kg^2
N = 2*M_sun/m_n;    # Number of neutrons in the neutron star
V = (6.5*h_bar**2/(N**(1./3)*m_n**3*G))**3;    # Volume of the neutron star, metre cube
R = (3./(4*math.pi)*V)**(1./3);    # The radius of neutron star, m

#Result
print "The radius of the neutron star of 2 solar masses = %d km"%math.ceil(R/1e+003)
The radius of the neutron star of 2 solar masses = 11 km

Example 16.7, Page 598

In [6]:
#Variable declaration
c = 1;    # For simplicity assume speed of light to be unity, m/s
d = 1.6e+005;    # Distance of the supernova 1987A from the earth, ly
m = 16;    # Mass of heavier neutrino, eV/c^2;
E = 20e+006;    # Energy of the neutrino, eV

#Calculations
delta_t = d/(2*c)*(m/E)**2;    # Difference between the travel times of the lighter and the massive neutrinos, y

#Result
print "The difference between the travel times of the lighter and the massive neutrinos = %3.1f s"%(delta_t*(365.25*24*60*60))
The difference between the travel times of the lighter and the massive neutrinos = 1.6 s

Example 16.8, Page 602

In [7]:
import math

#Variable declaration
c = 3.00e+008;    # Speed of light, m/s
H = 22;    # Hubble constant, km/s per million ly
G = 6.67e-011;    # Universal gravitational constant, N-Sq.m/kg^2

#Calculations
rho_c = 3/(8*math.pi)*H**2/G*1e+003/(c*365.25*24*60*60*1e+006)**2;    # The critical density of the universe, g/cc

#Result
print "The critical density of the universe = %3.1e g/cc"%rho_c
The critical density of the universe = 9.7e-30 g/cc

Example 16.9, Page 604

In [8]:
#Variable declaration
H0 = 71;    # Hubble constant, km/s per Mpc

#Calculations
tau = 1./H0*1e+006*3.26*9.46e+012/3.16e+007;    # The upper limit of the age of the universe, y

#Result
print "The upper limit of the age of the universe = %4.2e y"%tau
The upper limit of the age of the universe = 1.37e+10 y