{
 "metadata": {
  "name": "Chapter16",
  "signature": "sha256:8da1ca227cbd2fcd5141a76f92c8c3cee05db901d462b1e82e4eb0345baf65a5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 16:Cosmology: Origin and Fate of Universe"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.1 Page 529"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "from math import log\n",
      "N2=0.25;N1=0.75;                                #various given values\n",
      "L2=1.0;L1=0.0;\n",
      "E1_E2=-4.7*(10**-4);                             #Energy difference\n",
      "\n",
      "#calculation\n",
      "a=(N2/N1); b=(((2*L2)+1)/((2*L1)+1));c=E1_E2; #various terms involved in the formula of ratio of population\n",
      "kT=(c/log(a/b));                              #value of k*T\n",
      "k=0.0000856;                                 #constant\n",
      "T=kT/k;                 #temperature of interstellar space\n",
      "\n",
      "#result\n",
      "print \"The temperature of interstellar space was found out to be in K\",round(T,3);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The temperature of interstellar space was found out to be in K 2.499\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.2 Page 536"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "mc2=940.0*10**6; k=8.6*10**-5; #various constants and given values in suitable units\n",
      "\n",
      "#calculation\n",
      "T= mc2/k;       #temperature of the photons\n",
      "\n",
      "#result\n",
      "print \"The temperature of the photons must be in K %.1e\" %round(T,3);\n",
      "\n",
      "#part2\n",
      "t=((1.5*10**10)/T)**2;       #age of universe when the photons have the above temperature\n",
      "\n",
      "#result\n",
      "print\"The age of the universe for the temperature of the photon to be as obtained above in seconds is %.0e\" %t;"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The temperature of the photons must be in K 1.1e+13\n",
        "The age of the universe for the temperature of the photon to be as obtained above in seconds is 2e-06\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.3 Page 539"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "from math import exp\n",
      "k=8.62*10**-5; #various values and constants\n",
      "T= 1.5*10**10;\n",
      "delE=1.3*10**6;\n",
      "\n",
      "#calculation\n",
      "a= delE/(k*T);  #exponent in boltzmann factor\n",
      "b=exp(-a);        #ratio of neutron to protons\n",
      "r=(1/(1+b))*100;     #relative number of protons\n",
      "\n",
      "#result\n",
      "print\"The percentage of protons is\",round(r),\" neutrons is \",round(100-r);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage of protons is 73.0  neutrons is  27.0\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}