# 1: Theory of Relativity¶

## Example number 1.1, Page number 29¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
l0 = 50        #length of rocket ship(m)
l = 49.5       #length observed on ground(m)
c = 3*10**8    #velocity of light(m/sec)

#Calculation
#we know that l = l0*math.sqrt(1-((v**2)/(c**2)))
v = math.sqrt((c**2)*(1-((l/l0)**2)))     #speed(m/sec)
v = v*10**-7;
v=math.ceil(v*10**3)/10**3;   #rounding off to 3 decimals

#Result
print "speed of the rocket is",v, "*10**7 m/sec"

speed of the rocket is 4.233 *10**7 m/sec


## Example number 1.2, Page number 30¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
l0 = 1;               #assume length(m)
l = (99/100)*l0       #length observed on ground(m)
c = 1    #assume c = 1

#Calculation
#we know that l = l0*math.sqrt(1-((v**2)/(c**2)))
v = math.sqrt((c**2)*(1-((l/l0)**2)))     #speed(m/sec)
v=math.ceil(v*10**4)/10**4;   #rounding off to 4 decimals

#Result
print "speed of the rocket is",v,"c"
print "answer given in the book is wrong"

speed of the rocket is 0.1411 c
answer given in the book is wrong


## Example number 1.3, Page number 30¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
l0 = 120        #length of spaceship(m)
c = 1           #assume c = 1
v = 0.99*c;         #speed of spaceship(m/sec)

#Calculation
l = l0*math.sqrt(1-((v**2)/(c**2)));      #length of the observer(m)

#Result
print "length of the observer is",round(l),"m"

length of the observer is 17.0 m


## Example number 1.5, Page number 31¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
#surface area of elliptical lamina = 1/2 (area of circular lamina)

#Calculation
c = 3*10**8;        #velocity of light(m/sec)
#((math.pi*D**2)/4)*math.sqrt(1-(v**2/c**2)) = 1/2*math.pi*D**2/4
#math.sqrt(1-(v**2/c**2)) = 1/2
v = c*math.sqrt(1-(1/4));   #velocity(m/sec)
v = v*10**-8;
v=math.ceil(v*10)/10;   #rounding off to 1 decimal

#Result
print "velocity is",v,"*10**8 m/sec"

velocity is 2.6 *10**8 m/sec


## Example number 1.6, Page number 32¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
t0 = 2*10**-8;        #mean life of meson(sec)
c = 1;                #assume c = 1
v = 0.8*c;            #velocity of meson(m/sec)

#Calculation
t = t0/math.sqrt(1-(v**2/c**2));        #mean life with a particular velocity

#Result
print "mean life of meson with a velocity is",round(t/1e-8,3),"*10**-8 sec"

mean life of meson with a velocity is 3.333 *10**-8 sec


## Example number 1.7, Page number 32¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
t0 = 3;        #time period of pendulum(sec)
c = 1;                #assume c = 1
v = 0.95*c;            #velocity of observer(m/sec)

#Calculation
t = t0/math.sqrt(1-(v**2/c**2));        #time period measured by observer(sec)
t = math.ceil(t*100)/100;   #rounding off to 2 decimals

#Result
print "time period measured by observer is",t,"sec"

time period measured by observer is 9.61 sec


## Example number 1.8, Page number 33¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
t0 = 1;         #life time of particle(micro sec)
v = 2.7*10**8;         #velocity of particle(m/sec)
c = 3*10**8;          #velocity of light(m/sec)

#Calculation
t0 = t0*10**-6;        #life time of particle(sec)
t = t0/math.sqrt(1-(v**2/c**2));        #life time(sec)
t = round(t/1e-6,1)*10**-6;
x = v*t;              #distance travelled before disintegration(m)

#Result
print "life time is",t,"sec"
print "distance travelled before disintegration is",x,"m"
print "answer for distance given in the book is wrong"

life time is 2.3e-06 sec
distance travelled before disintegration is 621.0 m
answer for distance given in the book is wrong


## Example number 1.9, Page number 33¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
c = 1;          #assume c = 1
u = -0.85*c;          #speed of B
v = 0.75*c;           #speed of A

#Calculation
u_dash = (u-v)/(1-(u*v/c**2));      #velocity of B with respect to A
u_dash = math.ceil(u_dash*10**3)/10**3;   #rounding off to 3 decimals

#Result
print "velocity of B with respect to A is",u_dash,"c"
print "answer given in the book is wrong with respect to sign"

velocity of B with respect to A is -0.977 c
answer given in the book is wrong with respect to sign


## Example number 1.10, Page number 34¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
c = 1;          #assume c = 1
u_dash = 0.9*c;          #velocity of beta particle
v = 0.25*c;           #speed of A

#Calculation
u = (u_dash+v)/(1+(u_dash*v/c**2));       #speed of beta particle
u = math.ceil(u*10**2)/10**2;   #rounding off to 2 decimals

#Result
print "speed of beta particle is",u,"c"

speed of beta particle is 0.94 c


## Example number 1.11, Page number 34¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
mp = 1.6*10**-27;        #mass of proton(kg)
me = 9.1*10**-31;        #mass of electron(kg)
c = 3*10**8;          #velocity of light(m/sec)

#Calculation
m0 = me;
m = mp;
# we know that m = m0/math.sqrt(1-(v**2/c**2));
A = (m0/m)**2;
v_square = (1-A)*(c**2);
v = math.sqrt(v_square);        #speed of electron(m/sec)
v = v*10**-8;
v = math.ceil(v*10**7)/10**7;   #rounding off to 7 decimals

#Result
print "speed of electron is",v,"*10**8 m/sec"

speed of electron is 2.9999996 *10**8 m/sec


## Example number 1.12, Page number 35¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
m0 = 1;       #assume m0 = 1
m = 2.25*m0;

#Calculation
A = (m0/m)**2;
v_square = (1-A)*(c**2);
v = math.sqrt(v_square);        #speed of a body(m/sec)
v = v*10**-8;
v = math.ceil(v*10**3)/10**3;   #rounding off to 3 decimals

#Result
print "speed of the body is",v,"*10**8 m/sec"

speed of electron is 2.688 *10**8 m/sec


## Example number 1.13, Page number 35¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
c = 1;      #assume c = 1
v = 0.99*c;          #velocity of electron
m0 = 9.1*10**-31;        #mass(kg)

#Calculation
m = m0/math.sqrt(1-(v**2/c**2));        #mass of electron(kg)
m = m*10**31;

#Result
print "mass of the electron is",int(m),"*10**-31 kg"

mass of the electron is 64 *10**-31 kg


## Example number 1.14, Page number 35¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration


## Example number 1.15, Page number 36¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration


## Example number 1.16, Page number 37¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration

In [ ]: