{
 "metadata": {
  "name": "",
  "signature": "sha256:2f492bc2a6dad7cae3b696b117670d34888491ec5959ea22de590b83b18e09cd"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "1: Theory of Relativity"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.1, Page number 29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "l0 = 50        #length of rocket ship(m)\n",
      "l = 49.5       #length observed on ground(m)\n",
      "c = 3*10**8    #velocity of light(m/sec)\n",
      "\n",
      "#Calculation\n",
      "#we know that l = l0*math.sqrt(1-((v**2)/(c**2)))\n",
      "v = math.sqrt((c**2)*(1-((l/l0)**2)))     #speed(m/sec)\n",
      "v = v*10**-7;\n",
      "v=math.ceil(v*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"speed of the rocket is\",v, \"*10**7 m/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of the rocket is 4.233 *10**7 m/sec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.2, Page number 30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "l0 = 1;               #assume length(m)\n",
      "l = (99/100)*l0       #length observed on ground(m)\n",
      "c = 1    #assume c = 1\n",
      "\n",
      "#Calculation\n",
      "#we know that l = l0*math.sqrt(1-((v**2)/(c**2)))\n",
      "v = math.sqrt((c**2)*(1-((l/l0)**2)))     #speed(m/sec)\n",
      "v=math.ceil(v*10**4)/10**4;   #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print \"speed of the rocket is\",v,\"c\"\n",
      "print \"answer given in the book is wrong\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of the rocket is 0.1411 c\n",
        "answer given in the book is wrong\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.3, Page number 30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "l0 = 120        #length of spaceship(m)\n",
      "c = 1           #assume c = 1\n",
      "v = 0.99*c;         #speed of spaceship(m/sec)\n",
      "\n",
      "#Calculation\n",
      "l = l0*math.sqrt(1-((v**2)/(c**2)));      #length of the observer(m)\n",
      "\n",
      "#Result\n",
      "print \"length of the observer is\",round(l),\"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "length of the observer is 17.0 m\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.4, Page number 30 theoretical proof"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.5, Page number 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "#surface area of elliptical lamina = 1/2 (area of circular lamina)\n",
      "\n",
      "#Calculation\n",
      "c = 3*10**8;        #velocity of light(m/sec)\n",
      "#((math.pi*D**2)/4)*math.sqrt(1-(v**2/c**2)) = 1/2*math.pi*D**2/4\n",
      "#math.sqrt(1-(v**2/c**2)) = 1/2\n",
      "v = c*math.sqrt(1-(1/4));   #velocity(m/sec)\n",
      "v = v*10**-8;\n",
      "v=math.ceil(v*10)/10;   #rounding off to 1 decimal\n",
      "\n",
      "#Result\n",
      "print \"velocity is\",v,\"*10**8 m/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "velocity is 2.6 *10**8 m/sec\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.6, Page number 32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "t0 = 2*10**-8;        #mean life of meson(sec)\n",
      "c = 1;                #assume c = 1\n",
      "v = 0.8*c;            #velocity of meson(m/sec)\n",
      "\n",
      "#Calculation\n",
      "t = t0/math.sqrt(1-(v**2/c**2));        #mean life with a particular velocity\n",
      "\n",
      "#Result\n",
      "print \"mean life of meson with a velocity is\",round(t/1e-8,3),\"*10**-8 sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mean life of meson with a velocity is 3.333 *10**-8 sec\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.7, Page number 32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "t0 = 3;        #time period of pendulum(sec)\n",
      "c = 1;                #assume c = 1\n",
      "v = 0.95*c;            #velocity of observer(m/sec)\n",
      "\n",
      "#Calculation\n",
      "t = t0/math.sqrt(1-(v**2/c**2));        #time period measured by observer(sec)\n",
      "t = math.ceil(t*100)/100;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"time period measured by observer is\",t,\"sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "time period measured by observer is 9.61 sec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.8, Page number 33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "t0 = 1;         #life time of particle(micro sec)\n",
      "v = 2.7*10**8;         #velocity of particle(m/sec)\n",
      "c = 3*10**8;          #velocity of light(m/sec)\n",
      "\n",
      "#Calculation\n",
      "t0 = t0*10**-6;        #life time of particle(sec)\n",
      "t = t0/math.sqrt(1-(v**2/c**2));        #life time(sec)\n",
      "t = round(t/1e-6,1)*10**-6;             \n",
      "x = v*t;              #distance travelled before disintegration(m)\n",
      "\n",
      "#Result\n",
      "print \"life time is\",t,\"sec\"\n",
      "print \"distance travelled before disintegration is\",x,\"m\"\n",
      "print \"answer for distance given in the book is wrong\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "life time is 2.3e-06 sec\n",
        "distance travelled before disintegration is 621.0 m\n",
        "answer for distance given in the book is wrong\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.9, Page number 33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;          #assume c = 1\n",
      "u = -0.85*c;          #speed of B\n",
      "v = 0.75*c;           #speed of A\n",
      "\n",
      "#Calculation\n",
      "u_dash = (u-v)/(1-(u*v/c**2));      #velocity of B with respect to A\n",
      "u_dash = math.ceil(u_dash*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"velocity of B with respect to A is\",u_dash,\"c\"\n",
      "print \"answer given in the book is wrong with respect to sign\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "velocity of B with respect to A is -0.977 c\n",
        "answer given in the book is wrong with respect to sign\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.10, Page number 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;          #assume c = 1\n",
      "u_dash = 0.9*c;          #velocity of beta particle\n",
      "v = 0.25*c;           #speed of A\n",
      "\n",
      "#Calculation\n",
      "u = (u_dash+v)/(1+(u_dash*v/c**2));       #speed of beta particle\n",
      "u = math.ceil(u*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"speed of beta particle is\",u,\"c\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of beta particle is 0.94 c\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.11, Page number 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "mp = 1.6*10**-27;        #mass of proton(kg)\n",
      "me = 9.1*10**-31;        #mass of electron(kg)\n",
      "c = 3*10**8;          #velocity of light(m/sec)\n",
      "\n",
      "#Calculation\n",
      "m0 = me;\n",
      "m = mp;\n",
      "# we know that m = m0/math.sqrt(1-(v**2/c**2));\n",
      "A = (m0/m)**2;\n",
      "v_square = (1-A)*(c**2);\n",
      "v = math.sqrt(v_square);        #speed of electron(m/sec)\n",
      "v = v*10**-8;\n",
      "v = math.ceil(v*10**7)/10**7;   #rounding off to 7 decimals\n",
      "\n",
      "#Result\n",
      "print \"speed of electron is\",v,\"*10**8 m/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of electron is 2.9999996 *10**8 m/sec\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.12, Page number 35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "m0 = 1;       #assume m0 = 1\n",
      "m = 2.25*m0;\n",
      "\n",
      "#Calculation\n",
      "A = (m0/m)**2;\n",
      "v_square = (1-A)*(c**2);\n",
      "v = math.sqrt(v_square);        #speed of a body(m/sec)\n",
      "v = v*10**-8;\n",
      "v = math.ceil(v*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"speed of the body is\",v,\"*10**8 m/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of electron is 2.688 *10**8 m/sec\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.13, Page number 35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "c = 1;      #assume c = 1\n",
      "v = 0.99*c;          #velocity of electron\n",
      "m0 = 9.1*10**-31;        #mass(kg)\n",
      "\n",
      "#Calculation\n",
      "m = m0/math.sqrt(1-(v**2/c**2));        #mass of electron(kg)\n",
      "m = m*10**31;\n",
      "\n",
      "#Result\n",
      "print \"mass of the electron is\",int(m),\"*10**-31 kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mass of the electron is 64 *10**-31 kg\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.14, Page number 35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.15, Page number 36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 1.16, Page number 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 30
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}