{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 9 : Special Theory of Relativity"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 1 , Page number 284"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Change in length in diameter= 6.37 *10**-2 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "l=2*6371        #Diameter of earth\n",
    "v=30            #velocity\n",
    "c=3*10**5       #velocity of light\n",
    "\n",
    "#Calculations\n",
    "dell=(l*v**2)/(2*c**2)/10**-5\n",
    "\n",
    "#Result\n",
    "print\"Change in length in diameter=\",round(dell,2),\"*10**-2 m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 2 , Page number 284"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The minimum speed v=  0.99999996247 c\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "delt=10               #time duration at earth\n",
    "delt1=1/365 \n",
    "\n",
    "#Calculations\n",
    "v=math.sqrt(1-(delt1/delt)**2)\n",
    "\n",
    "#Result\n",
    "print\"The minimum speed v= \",v,\"c\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 3 , Page number 285"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1) The time taken on earth (t) =  21.05 year\n",
      "(2) The time taken on spaceship  (t1) =  6.53 year\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "L0=20           #The distance of the star\n",
    "v=0.95          #velocity\n",
    "\n",
    "#Calculations\n",
    "t=L0/v\n",
    "L=L0*math.sqrt(1-v**2)\n",
    "L=round(L,1)\n",
    "t1=(L*3*10**8)/(v*3*10**8)\n",
    "\n",
    "#Result\n",
    "print\"(1) The time taken on earth (t) = \",round(t,2),\"year\"\n",
    "print\"(2) The time taken on spaceship  (t1) = \",round(t1,2),\"year\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 4 , Page number 285"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1) The height will be same and the length(L0)  =  6.25 m\n",
      "(2) The time elapsed on his friend's watch(t1) =  8.0 sec\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "L=5 #Lenth\n",
    "v=0.6 #velocity\n",
    "t=10 #time\n",
    "\n",
    "#Calculations\n",
    "L0=L/math.sqrt(1-v**2)\n",
    "t1=t*math.sqrt(1-v**2)\n",
    "\n",
    "#Result\n",
    "print\"(1) The height will be same and the length(L0)  = \",L0,\"m\"\n",
    "print\"(2) The time elapsed on his friend's watch(t1) = \",t1,\"sec\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}