{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11: Theory of Relativity"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.5, Page 11.19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "# Given \n",
      "x = 100 # in meter\n",
      "y = 10 # in meter\n",
      "z = 5  # in meter\n",
      "t = 1e-4 # in sec\n",
      "# coordinates of point in frame F\n",
      "v = 2.7e8 # velocity of frame F_ w.r.t. frame F in m/sed\n",
      "c=3e8 # speed of light in m/sec\n",
      "\n",
      "#Calculations\n",
      "# according to Galilean transformation\n",
      "x__ = x-v*t\n",
      "y__=y\n",
      "z__=z\n",
      "t__=t\n",
      "# according to Lorentz transformation\n",
      "x_ = (x-v*t)/sqrt(1-(v/c)**2)\n",
      "y_=y\n",
      "z_=z\n",
      "t_=(t-(v*x/c**2))/sqrt(1-(v/c)**2)\n",
      "\n",
      "#Results\n",
      "print \"Coordinate of the event in reference frame F_ using \\n(a)Galilean transformation-x=%.f m, y=%.f m, z = %.f m, t = %.e sec\"%(x__,y__,z__,t__) \n",
      "print \"(b)Lorentz transformation-x=%.f m,y =%.f m, z = %.f m, t=%.e sec \"%(x_,y_,z_,t_)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coordinate of the event in reference frame F_ using \n",
        "(a)Galilean transformation-x=-26900 m, y=10 m, z = 5 m, t = 1e-04 sec\n",
        "(b)Lorentz transformation-x=-61713 m,y =10 m, z = 5 m, t=2e-04 sec \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.6, Page 11.19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "r = 4 # ratio of mass of particle to the rest mass\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - (1 / r)**2)\n",
      "\n",
      "#Result\n",
      "print \"Speed of particle is %.e meter/sec\"%v"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of particle is 3e+08 meter/sec\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.7, Page 11.20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "r = 1.2 # ratio of mass of particle to the rest mass\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - (1 / r)**2)\n",
      "\n",
      "#Results\n",
      "print \"Speed of particle is %.3f c\"%(v/3e8)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of particle is 0.553 c\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.9, Page 11.20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "E = 2 # kinetic energy of electron in Mev\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - (1 / (1 + (1.6e-19 * 2e6) / (9.1e-31 * 3e8**2)))**2)\n",
      "m = (9.1e-31) / sqrt(1 - (v / 3e8)**2)\n",
      "\n",
      "#Results\n",
      "print \"Speed of electron is %.2f c\\nMass of electron is %.2e kg\"%(v/3e8,m)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of electron is 0.98 c\n",
        "Mass of electron is 4.47e-30 kg\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.11, Page 11.21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "r = 2.25 # ratio of mass of particle to the rest mass\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - (1 / r)**2)\n",
      "\n",
      "#Result\n",
      "print \"Speed of particle is %.2e meter/sec\"%v"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of particle is 2.69e+08 meter/sec\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.12, Page 11.22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "r = 2. # ratio of kinetic energy of body to its rest mass\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - (1 / (r + 1))**2)\n",
      "\n",
      "#Result\n",
      "print \"Velocity of particle is %.2f c\"%(v/3e8)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of particle is 0.94 c\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.13, Page 11.22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "r = 11. # ratio of mass of particle to the rest mass of electron\n",
      "\n",
      "#Calculations\n",
      "KE = (r - 1) * 9.1e-31 * 3e8**2 / (1.6e-19)\n",
      "m = 3e8 * sqrt(1 - (1 / r)**2) * 9.1e-31 * 11\n",
      "\n",
      "#Result\n",
      "print \"Kinetic energy of electron is %.1f MeV\\nMomentum of particle is %.2e N-sec\"%(KE/1e6,m)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Kinetic energy of electron is 5.1 MeV\n",
        "Momentum of particle is 2.99e-21 N-sec\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.14, Page 11.23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "m = 1.67e-27  # mass of electron in kg\n",
      "m_ = 9.1e-31 # rest mass of electron in kg\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - (m_ / m)**2)\n",
      "\n",
      "#Result\n",
      "print \"Velocity of electron is %.3e meter/sec\"%v"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of electron is 3.000e+08 meter/sec\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.15, Page 11.23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "E = 0.1 # kinetic speed of electron in Mev\n",
      "\n",
      "#Calculations\n",
      "v_ = sqrt(2 * (E * 1.6e-13) / 9.1e-31)\n",
      "v = 3e8 * sqrt(1 - (1 / (1 + (1.6e-13 * E) / (9.1e-31 * 3e8**2)))**2)\n",
      "\n",
      "#Results\n",
      "print \"Speed according to classical mechanics is %.2e meter/sec\\nSpeed according to relativistic mechanics is %.2e meter/sec\"%(v_,v)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed according to classical mechanics is 1.88e+08 meter/sec\n",
        "Speed according to relativistic mechanics is 1.64e+08 meter/sec\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.17, Page 11.24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "r1 = 3. # ratio of kinetic energy of body to its rest mass in first case\n",
      "r2 = 1. # ratio of kinetic energy of body to its rest mass in second case\n",
      "\n",
      "#Calculations\n",
      "v1 = 3e8 * sqrt(1 - (1 / (r1 + 1))**2)\n",
      "v2 = 3e8 * sqrt(1 - (1 / (r2 + 1))**2)\n",
      "\n",
      "#Results\n",
      "print \"Velocity of particle if kinetic energy is %d times of rest mass energy  is %.2e meter/sec\\nVelocity of particle if kinetic energy is %.1e times of rest mass energy  is %e meter/sec\"%(r1,v1,r2,v2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of particle if kinetic energy is 3 times of rest mass energy  is 2.90e+08 meter/sec\n",
        "Velocity of particle if kinetic energy is 1.0e+00 times of rest mass energy  is 2.598076e+08 meter/sec\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.19, Page 11.25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "E = 1.5 # kinetic energy of electron in Mev\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - (1 / (1 + (1.6e-19 * 2e6) / (9.1e-31 * 3e8**2)))**2)\n",
      "m = (E * 1.6e-13 / (3e8)**2) + 9.1e-31\n",
      "\n",
      "#Results\n",
      "print \"Speed of electron is %.2e meter/sec\\nMass of electron is %.1e kg\"%(v,m)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of electron is 2.94e+08 meter/sec\n",
        "Mass of electron is 3.6e-30 kg\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.20, Page 11.26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "r = 3. / 2 # ratio of mass of metre stick to the rest mass of metre stick\n",
      "\n",
      "#Calculations\n",
      "l = 1 * (1. / r)\n",
      "\n",
      "#Result\n",
      "print \"Length of meter stick is %.2f meter if mass is %.2f times of its rest mass\"%(l,r)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length of meter stick is 0.67 meter if mass is 1.50 times of its rest mass\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.21, Page 11.26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "# Given \n",
      "r = 1. / 2 # ratio of area of circular lamina in frame S_ to the ratio of area of circular lamina in frame S\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - r**2)\n",
      "\n",
      "#Result\n",
      "print \"Velocity of frame S_ w.r.t. frame S is %.1e meter/sec\"%v"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of frame S_ w.r.t. frame S is 2.6e+08 meter/sec\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.22, Page 11.27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import * \n",
      "# Given \n",
      "t = 1 # lose in time in an hour in minute\n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - ((60. - t) / 60)**2)\n",
      "\n",
      "#Result\n",
      "print \"Speed of clock is %.2e meter/sec\"%v"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of clock is 5.45e+07 meter/sec\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.23, Page 11.27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "# Given \n",
      "t_ = 2.5e-8 # proper life of pi+ mesons in sec\n",
      "v = 2.4e8 # velocity of beam of mesons in m/sec\n",
      "r = 1. / exp(2) # ratio of final flux to initial flux of the meson beam\n",
      "\n",
      "#Calculations\n",
      "t = t_ / sqrt(1 - (v / 3e8)**2)\n",
      "T = t * log(1. / r)\n",
      "d = T * v\n",
      "\n",
      "#Result\n",
      "print \"Distance travel by the beam is %.2f meter\"%d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Distance travel by the beam is 20.00 meter\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.24, Page 11.27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "v = 1.8e8 # velocity of space ship away from the earth in m/sec\n",
      "v1 = 2.1e8 # velocity of rocket w.r.t. space ship away from the earth in first case in m/sec\n",
      "v2 = -2.1e8 # velocity of rocket w.r.t. space ship away from the earth in second case in m/sec\n",
      "\n",
      "#Calculations\n",
      "u1 = (v1 + v) / (1 + ((v1 * v) / (3e8)**2))\n",
      "u2 = (v2 + v) / (1 + ((v2 * v) / (3e8)**2))\n",
      "\n",
      "#Results\n",
      "print \"Velocity of rocket w.r.t. earth in first case = %.2f c away from the earth\\nVelocity of rocket w.r.t. earth in second case = %.2f c away from the earth \"%(u1/3e8,u2/3e8)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of rocket w.r.t. earth in first case = 0.92 c away from the earth\n",
        "Velocity of rocket w.r.t. earth in second case = -0.17 c away from the earth \n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.25, Page 11.28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "l = 1 # length of the rod in meter\n",
      "v = 1.8e8 # speed of rod along its length in meter/sec\n",
      "\n",
      "#Calculations\n",
      "L = l * sqrt(1- (v / 3e8)**2)\n",
      "\n",
      "#Result\n",
      "print \"Length as it appear to the observer is %.1f meter\"%L"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length as it appear to the observer is 0.8 meter\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.26, Page 11.28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "l = 2 # length of the rod in meter\n",
      "v = 2.7e8 # speed of rod along its length in meter/sec\n",
      "\n",
      "#Calculations\n",
      "L = l * sqrt(1- (v / 3e8)**2)\n",
      "\n",
      "#Result\n",
      "print \"Length as it appear to the observer is %.3f meter\"%L"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length as it appear to the observer is 0.872 meter\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.27, Page 11.28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "l = 100. # consider the length of the rod in meter\n",
      "v = 2.4e8 # speed of rod in meter/sec\n",
      "theta = pi / 3 # direction of velocity of rod along its length in radian\n",
      "\n",
      "#Calculations\n",
      "Lx = l * cos(theta)\n",
      "Ly = l * sin(theta)\n",
      "L_x = Lx * sqrt(1 - (v / 3e8)**2)\n",
      "L_y = Ly \n",
      "L = sqrt(L_x**2 + L_y**2)\n",
      "p_l = ((l - L) / l) * 100 \n",
      "\n",
      "#Result\n",
      "print \"Percentage length contraction is %.1f percent\"%p_l"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage length contraction is 8.3 percent\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.28, Page 11.29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "# Given \n",
      "r = 0.5 # ratio of length of rod when it is in motion to the length of the rod when it is in rest \n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - r**2)\n",
      "\n",
      "#Result\n",
      "print \"Speed of the rod relative to observer is %.3f c\"%(v/3e8)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of the rod relative to observer is 0.866 c\n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.29, Page 11.29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "l = 5 # length of the rod in meter\n",
      "v = 1.8e8 # speed of rod in meter/sec\n",
      "theta = pi / 6 # direction of velocity of rod along its length in radian\n",
      "\n",
      "#Calculations\n",
      "Lx = l * cos(theta)\n",
      "Ly = l * sin(theta)\n",
      "L_x = Lx * sqrt(1 - (v / 3e8)**2)\n",
      "L_y = Ly \n",
      "L = sqrt(L_x**2 + L_y**2)\n",
      "orientation = atan(L_y / L_x) * (180 / pi)\n",
      "\n",
      "#Results\n",
      "print \"Length of the rod in moving frame is %.2f meter\\nOrientation of the rod is %.2f degree\"%(L,orientation)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length of the rod in moving frame is 4.27 meter\n",
        "Orientation of the rod is 35.82 degree\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.30, Page 11.30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "T = 17.8e-9 # half-life of prticle at rest in sec\n",
      "v = 2.4e8 # speed of particle in meter/sec\n",
      "\n",
      "#Calculations\n",
      "t = T / (sqrt(1 - (v / 3e8)**2))\n",
      "\n",
      "#Result\n",
      "print \"New half-life of particle is %.2f nanosec\"%(t/1e-9)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "New half-life of particle is 29.67 nanosec\n"
       ]
      }
     ],
     "prompt_number": 56
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.31, Page 11.30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "T = 24 # no. of hours in a day\n",
      "v = 1e8 # speed of spaceship in meter/sec\n",
      "\n",
      "#Calculations\n",
      "t = T * (sqrt(1 - (v / 3e8)**2))\n",
      "T_ = T - t\n",
      "m=(T_-1)*60\n",
      "s=(m-22)*60\n",
      "\n",
      "#Result\n",
      "print \"Time lost per day is %d hours %d minute %d sec\"%(T_,m,s)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time lost per day is 1 hours 22 minute 21 sec\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.32, Page 11.30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "T = 4. # no. of year when rocket is moving corresponding to one year \n",
      "\n",
      "#Calculations\n",
      "v = 3e8 * sqrt(1 - (1 / T)**2)\n",
      "\n",
      "#Result\n",
      "print \"Speed of rocket is %.2f c\"%(v/3e8)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of rocket is 0.97 c\n"
       ]
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.33, Page 11.31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "d = 4 # distance of star from the earth in light years\n",
      "v = 3e8 * sqrt(0.9999) # speed of rocket in meter/sec\n",
      "\n",
      "#Calculations\n",
      "t = (2 * d * 3e8) / v\n",
      "T_ = t * sqrt(1 - (v / 3e8)**2)\n",
      "\n",
      "#Result\n",
      "print \"Time taken by the rocket is %.2f year\"%T_"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken by the rocket is 0.08 year\n"
       ]
      }
     ],
     "prompt_number": 61
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.34, Page 11.31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "t = 2e-7 # life time of particle when it is moving in sec\n",
      "v = 2.8e8 # speed of particle in meter/sec\n",
      "\n",
      "#Calculations\n",
      "T_ = t * sqrt(1 - (v / 3e8)**2)\n",
      "\n",
      "#Result\n",
      "print \"Proper life time of particle is %.2e sec\"%T_"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Proper life time of particle is 7.18e-08 sec\n"
       ]
      }
     ],
     "prompt_number": 62
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.35, Page 11.31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "v1 = 2.7e8 # velocity of first electron beam in meter/sec\n",
      "v2 = -2.7e8 # velocity of second electron beam in meter/sec\n",
      "\n",
      "#Calculations\n",
      "u = v1 - v2\n",
      "u_ = (v1 - v2) / (1 - (v1 * v2) / (3e8)**2)\n",
      "\n",
      "#Results\n",
      "print \"Velocity of electrons beam w.r.t. another electron beam according to Newtonian mechanics is %.1f c\\nVelocity of electrons beam measured by the observer moving with other electron beam = %.2f c\"%(u/3e8,u_/3e8)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of electrons beam w.r.t. another electron beam according to Newtonian mechanics is 1.8 c\n",
        "Velocity of electrons beam measured by the observer moving with other electron beam = 0.99 c\n"
       ]
      }
     ],
     "prompt_number": 63
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.37, Page 11.32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "E = 900 # total relativistic energy of proton in Mev\n",
      "m = 1.63-27 # rest mass of proton in kg\n",
      "c = 3e8 # velocity of photon in meter/sec\n",
      "\n",
      "#Calculations\n",
      "m_ = (E * 1.6e-13) / (c)**2\n",
      "\n",
      "#Results\n",
      "print \"Relativistic mass of proton is %.2e kg\\nHere relativistic mass is same as rest mass\\n hence proton is at rest and speed and kinetic energy of proton will be zero\"%(m_)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Relativistic mass of proton is 1.60e-27 kg\n",
        "Here relativistic mass is same as rest mass\n",
        " hence proton is at rest and speed and kinetic energy of proton will be zero\n"
       ]
      }
     ],
     "prompt_number": 64
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.38, Page 11.32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "E = 5.4e6 # energy liberates during dynamite explosion in J/kg\n",
      "c = 3e8 # velocity of photon in meter/sec\n",
      "\n",
      "#Calculations\n",
      "E_ = 1 * c**2 # energy liberated by 1 kg content in J\n",
      "f = E / E_\n",
      "\n",
      "#Result\n",
      "print \"Fraction of total energy content in it is %.1e per kg\"%f"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fraction of total energy content in it is 6.0e-11 per kg\n"
       ]
      }
     ],
     "prompt_number": 65
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.39, Page 11.32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import * \n",
      "# Given \n",
      "k = 1.02 # kinetic energy of electron in Mev\n",
      "E_ = 0.51 # rest mass energy of electron in Mev\n",
      "c = 3e8 # velocity of photon in meter/sec\n",
      "\n",
      "#Calculations\n",
      "E = k + E_\n",
      "v = c * sqrt(1 - (E_ / E)**2)\n",
      "\n",
      "#Result\n",
      "print \"Speed of the electron is %.2e meter/sec\"%v"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of the electron is 2.83e+08 meter/sec\n"
       ]
      }
     ],
     "prompt_number": 66
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.40, Page 11.33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "E = 1400 # solar energy receives by the earth in W/square meter\n",
      "d = 1.5e11 # distance between earth and the sun in meter\n",
      "c = 3e8 # velocity of photon in meter/sec\n",
      "\n",
      "#Calculations\n",
      "E_ = 4 * pi * d**2 * E\n",
      "m = E_ / c**2\n",
      "\n",
      "#Result\n",
      "print \"Rate of decrement of mass of the sun is %.2e kg/sec\"%m"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of decrement of mass of the sun is 4.40e+09 kg/sec\n"
       ]
      }
     ],
     "prompt_number": 67
    }
   ],
   "metadata": {}
  }
 ]
}