{
 "metadata": {
  "name": "",
  "signature": "sha256:1888e774039c89bc21625752ef2171fa6b8e8f5f67497ebbdba82729676e8946"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "8: Special Theory of Relativity"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.1, Page number 171"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "L_0 = 1;     #For simplicity, we assume classical length to be unity(m)\n",
      "c = 1;       #For simplicity assume speed of light to be unity(m/s)\n",
      "\n",
      "#Calculation\n",
      "L = (1-1/100)*L_0;     #Relativistic length(m)\n",
      "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n",
      "v = math.sqrt(1-(L/L_0)**2)*c;    #Speed at which relativistic length is 1 percent of the classical length(m/s)\n",
      "v = math.ceil(v*10**4)/10**4;     #rounding off the value of v to 4 decimals\n",
      "\n",
      "#Result\n",
      "print \"The speed at which relativistic length is 1 percent of the classical length is\",v, \"c\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The speed at which relativistic length is 1 percent of the classical length is 0.1411 c\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.2, Page number 171"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;      #For simplicity assume speed of light to be unity(m/s)\n",
      "delta_t = 5*10**-6;    #Mean lifetime of particles as observed in the lab frame(s)\n",
      "\n",
      "#Calculation\n",
      "v = 0.9*c;    #Speed at which beam of particles travel(m/s)\n",
      "delta_tau = delta_t*math.sqrt(1-(v/c)**2);     #Proper lifetime of particle as per Time Dilation rule(s)\n",
      "\n",
      "#Result\n",
      "print \"The proper lifetime of particle is\",delta_tau, \"s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The proper lifetime of particle is 2.17944947177e-06 s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.3, Page number 171. theoritical proof"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.4, Page number 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;      #For simplicity assume speed of light to be unity(m/s)\n",
      "\n",
      "#Calculation\n",
      "v = 0.6*c;    #Speed with which the rocket leaves the earth(m/s)\n",
      "u_prime = 0.9*c;     #Relative speed of second rocket w.r.t. the first rocket(m/s)\n",
      "u1 = (u_prime+v)/(1+(u_prime*v)/c**2);     #Speed of second rocket for same direction of firing as per Velocity Addition Rule(m/s)\n",
      "u1 = math.ceil(u1*10**4)/10**4;     #rounding off the value of u1 to 4 decimals\n",
      "u2 = (-u_prime+v)/(1-(u_prime*v)/c**2);     #Speed of second rocket for opposite direction of firing as per Velocity Addition Rule(m/s)\n",
      "u2 = math.ceil(u2*10**4)/10**4;     #rounding off the value of u2 to 4 decimals\n",
      "\n",
      "#Result\n",
      "print \"The speed of second rocket for same direction of firing is\",u1,\"c\"\n",
      "print \"The speed of second rocket for opposite direction of firing is\",u2,\"c\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The speed of second rocket for same direction of firing is 0.9741 c\n",
        "The speed of second rocket for opposite direction of firing is -0.6521 c\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.5, Page number 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;     #For simplicity assume speed of light to be unity(m/s)\n",
      "L0 = 1;    #For simplicity assume length in spaceship's frame to be unity(m)\n",
      "tau = 1;     #Unit time in the spaceship's frame(s)\n",
      "\n",
      "#Calculation\n",
      "L = 1/2*L0;    #Length as observed on earth(m)\n",
      "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n",
      "v = math.sqrt(1-(L/L0)**2)*c;    #Speed at which length of spaceship is observed as half from the earth frame(m/s)\n",
      "t = tau/math.sqrt(1-(v/c)**2);    #Time dilation of the spaceship's unit time(s)\n",
      "v = math.ceil(v*10**4)/10**4;     #rounding off the value of v to 4 decimals\n",
      "\n",
      "#Result\n",
      "print \"The speed at which length of spaceship is observed as half from the earth frame is\",v, \"c\"\n",
      "print \"The time dilation of the spaceship unit time is\",t,\"delta_tau\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The speed at which length of spaceship is observed as half from the earth frame is 0.8661 c\n",
        "The time dilation of the spaceship unit time is 2.0 delta_tau\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.6, Page number 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 3*10**8;     #Speed of light in vacuum(m/s)\n",
      "t1 = 2*10**-7;      #Time for which first event occurs(s)\n",
      "t2 = 3*10**-7;      #Time for which second event occurs(s)\n",
      "x1 = 10;       #Position at which first event occurs(m)\n",
      "x2 = 40;       #Position at which second event occurs(m)\n",
      "\n",
      "#Calculation\n",
      "v = 0.6*c;       #Velocity with which S2 frame moves relative to S1 frame(m/s)\n",
      "L_factor = 1/math.sqrt(1-(v/c)**2);     #Lorentz factor\n",
      "delta_t = L_factor*(t2 - t1)+L_factor*v/c**2*(x1 - x2);     #Time difference between the events(s)\n",
      "delta_x = L_factor*(x2 - x1)-L_factor*v*(t2 - t1);       #Distance between the events(m)\n",
      "\n",
      "#Result\n",
      "print \"The time difference between the events is\",delta_t, \"s\" \n",
      "print \"The distance between the events is\",delta_x, \"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The time difference between the events is 5e-08 s\n",
        "The distance between the events is 15.0 m\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.7, Page number 173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 3*10**8;     #Speed of light in vacuum(m/s)\n",
      "tau = 2.6*10**-8;     #Mean lifetime the particle in its own frame(s)\n",
      "d = 20;     #Distance which the unstable particle travels before decaying(m)\n",
      "\n",
      "#Calculation\n",
      "#As t = d/v and also t = tau/sqrt(1-(v/c)^2), so that\n",
      "#d/v = tau/sqrt(1-(v/c)^2), solving for v\n",
      "v = math.sqrt(d**2/(tau**2+(d/c)**2));     #Speed of the unstable particle in lab frame(m/s)\n",
      "v = v/10**8;\n",
      "v = math.ceil(v*10)/10;     #rounding off the value of v to 1 decimal\n",
      "\n",
      "#Result\n",
      "print \"The speed of the unstable particle in lab frame is\",v,\"*10**8 m/s\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The speed of the unstable particle in lab frame is 2.8 *10**8 m/s\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.8, Page number 174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;     #For simplicity assume speed of light to be unity(m/s)\n",
      "me = 1;    #For simplicity assume mass of electron to be unity(kg)\n",
      "tau = 2.3*10**-6;     #Average lifetime of mu-meson in rest frame(s)\n",
      "t = 6.9*10**-6;       #Average lifetime of mu-meson in laboratory frame(s)\n",
      "e = 1.6*10**-19;     #Energy equivalent of 1 eV(J/eV)\n",
      "C = 3*10**8;     #Speed of light in vacuum(m/s)\n",
      "m_e = 9.1*10**-31;     #Mass of an electron(kg)\n",
      "\n",
      "#Calculation\n",
      "#Fromm Time Dilation Rule, tau = t*sqrt(1-(v/c)^2), solving for v\n",
      "v = c*math.sqrt(1-(tau/t)**2);     #Speed of mu-meson in the laboratory frame(m/s)\n",
      "v = math.ceil(v*10**5)/10**5;     #rounding off the value of v to 5 decimals\n",
      "m0 = 207*me;     #Rest mass of mu-meson(kg)\n",
      "m = m0/math.sqrt(1-(v/c)**2);      #Relativistic variation of mass with velocity(kg)\n",
      "m = math.ceil(m*10)/10;     #rounding off the value of m to 1 decimal\n",
      "T = (m*m_e*C**2 - m0*m_e*C**2)/e;     #Kinetic energy of mu-meson(eV)\n",
      "T = T*10**-6;        #Kinetic energy of mu-meson(MeV)\n",
      "T = math.ceil(T*100)/100;     #rounding off the value of T to 2 decimals\n",
      " \n",
      "#Result\n",
      "print \"The speed of mu-meson in the laboratory frame is\",v, \"c\"\n",
      "print \"The effective mass of mu-meson is\",m, \"me\"\n",
      "print \"The kinetic energy of mu-meson is\",T, \"MeV\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The speed of mu-meson in the laboratory frame is 0.94281 c\n",
        "The effective mass of mu-meson is 621.1 me\n",
        "The kinetic energy of mu-meson is 211.97 MeV\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.9, Page number 174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;      #For simplicity assume speed of light to be unity(m/s)\n",
      "m0 = 1;     #For simplicity assume rest mass to be unity(kg)\n",
      "\n",
      "#Calculation\n",
      "m = (20/100+1)*m0;     #Mass in motion(kg)\n",
      "#As m = m0/sqrt(1-(u/c)^2), solving for u\n",
      "u = math.sqrt(1-(m0/m)**2)*c;     #Speed of moving mass(m/s) \n",
      "u = math.ceil(u*10**3)/10**3;     #rounding off the value of u to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"The speed of moving body is\",u, \"c\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The speed of moving body is 0.553 c\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.10, Page number 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 3*10**8;     #Speed of light in vacuum(m/s)\n",
      "dE = 4*10**26;     #Energy radiated per second my the sun(J/s)\n",
      "\n",
      "#Calculation\n",
      "dm = dE/c**2;       #Rate of decrease of mass of sun(kg/s)\n",
      "dm = dm/10**9;\n",
      "dm = math.ceil(dm*10**3)/10**3;     #rounding off the value of dm to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"The rate of decrease of mass of sun is\",dm,\"*10**9 kg/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rate of decrease of mass of sun is 4.445 *10**9 kg/s\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.11, Page number 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;     #For simplicity assume speed of light to be unity(m/s)\n",
      "m0 = 9.1*10**-31;    #Mass of the electron(kg)\n",
      "E0 = 0.512;         #Rest energy of electron(MeV)\n",
      "T = 10;         #Kinetic energy of electron(MeV)\n",
      "\n",
      "#Calculation\n",
      "E = T + E0;     #Total energy of electron(MeV)\n",
      "# From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for p\n",
      "p = math.sqrt(E**2-m0**2*c**4)/c;      #Momentum of the electron(MeV)\n",
      "p = math.ceil(p*100)/100;     #rounding off the value of p to 2 decimals\n",
      "#As E = E0/sqrt(1-(u/c)^2), solving for u\n",
      "u = math.sqrt(1-(E0/E)**2)*c;     #Velocity of the electron(m/s)\n",
      "u = math.ceil(u*10**4)/10**4;     #rounding off the value of u to 4 decimals\n",
      "\n",
      "#Result\n",
      "print \"The momentum of the electron is\",p,\"/c MeV\"\n",
      "print \"The velocity of the electron is\",u, \"c\"\n",
      "\n",
      "#answer for velocity given in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The momentum of the electron is 10.52 /c MeV\n",
        "The velocity of the electron is 0.9989 c\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.12, Page number 175. theoritical proof"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.13, Page number 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 3*10**8;      #Speed of light in vacuum(m/s)\n",
      "E = 4.5*10**17;   #Total energy of object(J)\n",
      "px = 3.8*10**8;    #X-component of momentum(kg-m/s)\n",
      "py = 3*10**8;      #Y-component of momentum(kg-m/s)\n",
      "pz = 3*10**8;      #Z-component of momentum(kg-m/s)\n",
      "\n",
      "#Calculation\n",
      "p = math.sqrt(px**2+py**2+pz**2);     #Total momentum of the object(kg-m/s)\n",
      "#From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for m0\n",
      "m0 = math.sqrt(E**2/c**4 - p**2/c**2);    #Rest mass of the body(kg)\n",
      "m0 = math.ceil(m0*100)/100;     #rounding off the value of m0 to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"The rest mass of the body is\",m0, \"kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rest mass of the body is 4.63 kg\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.14, Page number 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 3*10**8;     #Speed of light in vacuum(m/s)\n",
      "m = 50000;       #Mass of high speed probe(kg)\n",
      "\n",
      "#Calculation\n",
      "u = 0.8*c;       #Speed of the probe(m/s)\n",
      "p = m*u/math.sqrt(1-(u/c)**2);     #Momentum of the probe(kg-m/s)\n",
      "\n",
      "#Result\n",
      "print \"The momentum of the high speed probe is\",p, \"kg-m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The momentum of the high speed probe is 2e+13 kg-m/s\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 8.15, Page number 177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "e = 1.6*10**-19;     #Electronic charge, C = Energy equivalent of 1 eV(J/eV)\n",
      "m0 = 9.11*10**-31;   #Rest mass of electron(kg)\n",
      "c = 3*10**8;     #Speed of light in vacuum(m/s)\n",
      "\n",
      "#Calculation\n",
      "u1 = 0.98*c;     #Inital speed of electron(m/s)\n",
      "u2 = 0.99*c;     #Final speed of electron(m/s)\n",
      "m1 = m0/math.sqrt(1-(u1/c)**2);    #Initial relativistic mass of electron(kg)\n",
      "m2 = m0/math.sqrt(1-(u2/c)**2);    #Final relativistic mass of electron(kg)\n",
      "dm = m2 - m1;     #Change in relativistic mass of the electron(kg)\n",
      "W = dm*c**2/e;      #Work done on the electron to change its velocity(eV)\n",
      "W = W*10**-6;      #Work done on the electron to change its velocity(MeV)\n",
      "W = math.ceil(W*100)/100;     #rounding off the value of W to 2 decimals\n",
      "#As W = eV, V = accelerating potential, solving for V\n",
      "V = W*10**6;     #Accelerating potential(volt)\n",
      "V = V/10**6;\n",
      "\n",
      "#Result\n",
      "print \"The change in relativistic mass of the electron is\",dm, \"kg\"\n",
      "print \"The work done on the electron to change its velocity is\",W, \"MeV\"\n",
      "print \"The accelerating potential is\",V, \"*10**6 volt\"\n",
      "\n",
      "#answers given in the book are wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in relativistic mass of the electron is 1.87996052912e-30 kg\n",
        "The work done on the electron to change its velocity is 1.06 MeV\n",
        "The accelerating potential is 1.06 *10**6 volt\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}