{
 "metadata": {
  "name": "",
  "signature": "sha256:467ef5c6562d2c93b60e422b9b9a8c5a34323da84f6c33e87f513c3c578db36d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "1: The special theory of relativity"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.2, Page number 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c=1;   #assume\n",
      "udash=0.9*c;   #speed of 2nd rocket\n",
      "v=0.6*c;   #speed of 1st rocket\n",
      "\n",
      "#Calculation\n",
      "u1=(udash+v)/(1+(udash*v/(c**2)));   #speed of 2nd rocket in same direction\n",
      "u2=(-udash+v)/(1-(udash*v/(c**2)));   #speed of 2nd rocket in opposite direction\n",
      "\n",
      "#Result\n",
      "print \"speed of 2nd rocket in same direction is\",round(u1,3),\"*c\"\n",
      "print \"speed of 2nd rocket in opposite direction is\",round(u2,3),\"*c\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of 2nd rocket in same direction is 0.974 *c\n",
        "speed of 2nd rocket in opposite direction is -0.652 *c\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.3, Page number 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "#given L0-L/L0=0.01.so L=0.99*L0\n",
      "LbyL0=0.99;\n",
      "c=1;   #assume\n",
      "\n",
      "#Calculation\n",
      "v2=(c**2)*(1-(LbyL0)**2);\n",
      "v=math.sqrt(v2);    #speed\n",
      "\n",
      "#Result\n",
      "print \"speed is\",round(v,3),\"*c\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed is 0.141 *c\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.4, Page number 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "delta_tow=2.6*10**-8;   #mean lifetime at rest(s)\n",
      "d=20;   #distance(m)\n",
      "c=3*10**8;   #speed of light(m/s)\n",
      "\n",
      "#Calculation\n",
      "#delta_t=d/v\n",
      "v2=(c**2)/(1+(delta_tow*c/d)**2);\n",
      "v=math.sqrt(v2);   #speed of unstable particle(m/s)\n",
      "\n",
      "#Result\n",
      "print \"speed of unstable particle is\",round(v/10**8,1),\"*10**8 m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of unstable particle is 2.8 *10**8 m/s\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.5, Page number 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "delta_t=5*10**-6;   #mean lifetime(s)\n",
      "c=1;   #assume\n",
      "v=0.9*c;   #speed of beam\n",
      "\n",
      "#Calculation\n",
      "delta_tow=delta_t*math.sqrt(1-(v/c)**2);   #proper lifetime of particles(s)\n",
      "\n",
      "#Result\n",
      "print \"proper lifetime of particles is\",round(delta_tow*10**6,2),\"*10**-6 s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "proper lifetime of particles is 2.18 *10**-6 s\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.6, Page number 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c=1;   #assume\n",
      "m0bym=100/120;    #ratio of masses\n",
      "\n",
      "#Calculation\n",
      "v=c*math.sqrt(1-(m0bym**2));     #speed of body\n",
      "\n",
      "#Result\n",
      "print \"speed of body is\",round(v,3),\"*c\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of body is 0.553 *c\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.7, Page number 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c=3*10**8;   #speed of light(m/s)\n",
      "deltaE=4*10**26;   #energy of sun(J/s)\n",
      "\n",
      "#Calculation\n",
      "deltam=deltaE/c**2;   #change in mass(kg)\n",
      "\n",
      "#Result\n",
      "print \"change in mass is\",round(deltam/10**9,2),\"*10**9 kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "change in mass is 4.44 *10**9 kg\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.8, Page number 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c=1;   #assume\n",
      "T=10;   #kinetic energy(MeV)\n",
      "m0c2=0.512;   #rest energy of electron(MeV)\n",
      "\n",
      "#Calculation\n",
      "E=T+m0c2;   #total energy(MeV)\n",
      "p=math.sqrt((E**2)-(m0c2**2))/c;    #momentum of electron(MeV/c)\n",
      "v=c*math.sqrt(1-(m0c2/E)**2);    #velocity of electron(c)\n",
      "\n",
      "#Result\n",
      "print \"momentum of electron is\",round(p,1),\"MeV/c\"\n",
      "print \"velocity of electron is\",round(v,4),\"*c\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "momentum of electron is 10.5 MeV/c\n",
        "velocity of electron is 0.9988 *c\n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}