{
 "metadata": {
  "name": "",
  "signature": "sha256:c4aa0414ffd05acf8e49e96b92516d863d2c0354ef81a7502c4540359e267fb8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 15: General Relativity"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.1, Page 562"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "g = 9.8;    # Acceleration due to gravity, m/sec^2\n",
      "H = 10000;    # Altitude of the aeroplane above the surface of earth, m\n",
      "c = 3.00e+008;    # Speed of light in free space, m/s\n",
      "T = 45*3600;    # Time taken by the airplane to from eastward to westward trip, s\n",
      "\n",
      "#Calculations\n",
      "delta_T_G = g*H*T/(c**2*1e-009);    # Time difference in the two clocks due to gravitational redshift, ns\n",
      "C = 4e+007;    # Circumference of the earth, m \n",
      "v = 300;        # Speed of the jet airplane, m/s\n",
      "T0 = C/v;    # Time of flight of jet airplane very near the surface of the earth, s\n",
      "bita = v/c;    # Boost parameter\n",
      "# As from special relativity time dilation relation, T = T0*sqrt(1-bita^2), solving for T0 - T = delta_T_R, we have\n",
      "delta_T_R = T0*(1-math.sqrt(1-bita**2))/1e-009;    # Time difference in the two clocks due to special relativity, ns\n",
      "\n",
      "#Result\n",
      "print \"The gravitational time dilation effect of %d ns is larger than the approximate %4.1f ns of that of special relativity.\"%(math.ceil(delta_T_G), delta_T_R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The gravitational time dilation effect of 177 ns is larger than the approximate 66.7 ns of that of special relativity.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.2, Page 567"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "c = 3.00e+008;    # Speed of light in free space, m/s\n",
      "G = 6.67e-011;    # Newton's gravitational constant, N-Sq.m/per kg square\n",
      "M_S = 2.0e+030;    # Mass of the sun, kg\n",
      "M_E = 6.0e+024;    # Mass of the earth, kg\n",
      "\n",
      "#Calculations\n",
      "r_S = 2*G*M_S/(c**2*1e+003);    # Schwarzschild radius for sun, km\n",
      "r_E = 2*G*M_E/(c**2*1e-003);    # Schwarzschild radius for earth, mm\n",
      "\n",
      "#Results\n",
      "print \"The Schwarzschild radius for sun = %d km\"%math.ceil(r_S)\n",
      "print \"The Schwarzschild radius for earth = %d mm\"%math.ceil(r_E)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Schwarzschild radius for sun = 3 km\n",
        "The Schwarzschild radius for earth = 9 mm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.3, Page 568"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import scipy\n",
      "from scipy.integrate import quad\n",
      "\n",
      "#Variable declaration\n",
      "c = 3.00e+008;    # Speed of light in free space, m/s\n",
      "G = 6.67e-011;    # Newton's gravitational constant, N-Sq.m/per kg square\n",
      "h = 6.62e-034;    # Planck's constant, Js\n",
      "\n",
      "#Calculations\n",
      "h_bar = h/(2*math.pi);    # Reduced Planck's constant, Js\n",
      "sigma = 5.67e-008;    # Stefan-Boltzmann constant, W per Sq.m per K^4\n",
      "k = 1.38e-023;    # Boltzmann constant, J/K\n",
      "M0 = 1.99e+030;    # Mass of the sun, kg\n",
      "alpha = 2*sigma*h_bar**4*c**6/((8*math.pi)**3*k**4*G**2);    # A constant, kg^3/s\n",
      "T = lambda M: 1/alpha*M**2\n",
      "t,err = scipy.integrate.quad(T,0, 3*M0)\n",
      "\n",
      "#Result\n",
      "print \"The time required for the 3-solar-mass black hole to evaporate = %3.1e y\"%(t/(365.25*24*60*60))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The time required for the 3-solar-mass black hole to evaporate = 5.7e+68 y\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}