# 1: The special theory of relativity¶

## Example number 1.2, Page number 10¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
c=1;   #assume
udash=0.9*c;   #speed of 2nd rocket
v=0.6*c;   #speed of 1st rocket

#Calculation
u1=(udash+v)/(1+(udash*v/(c**2)));   #speed of 2nd rocket in same direction
u2=(-udash+v)/(1-(udash*v/(c**2)));   #speed of 2nd rocket in opposite direction

#Result
print "speed of 2nd rocket in same direction is",round(u1,3),"*c"
print "speed of 2nd rocket in opposite direction is",round(u2,3),"*c"

speed of 2nd rocket in same direction is 0.974 *c
speed of 2nd rocket in opposite direction is -0.652 *c


## Example number 1.3, Page number 12¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
#given L0-L/L0=0.01.so L=0.99*L0
LbyL0=0.99;
c=1;   #assume

#Calculation
v2=(c**2)*(1-(LbyL0)**2);
v=math.sqrt(v2);    #speed

#Result
print "speed is",round(v,3),"*c"

speed is 0.141 *c


## Example number 1.4, Page number 12¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
d=20;   #distance(m)
c=3*10**8;   #speed of light(m/s)

#Calculation
#delta_t=d/v
v2=(c**2)/(1+(delta_tow*c/d)**2);
v=math.sqrt(v2);   #speed of unstable particle(m/s)

#Result
print "speed of unstable particle is",round(v/10**8,1),"*10**8 m/s"

speed of unstable particle is 2.8 *10**8 m/s


## Example number 1.5, Page number 13¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
c=1;   #assume
v=0.9*c;   #speed of beam

#Calculation

#Result
print "proper lifetime of particles is",round(delta_tow*10**6,2),"*10**-6 s"

proper lifetime of particles is 2.18 *10**-6 s


## Example number 1.6, Page number 15¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
c=1;   #assume
m0bym=100/120;    #ratio of masses

#Calculation
v=c*math.sqrt(1-(m0bym**2));     #speed of body

#Result
print "speed of body is",round(v,3),"*c"

speed of body is 0.553 *c


## Example number 1.7, Page number 17¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
c=3*10**8;   #speed of light(m/s)
deltaE=4*10**26;   #energy of sun(J/s)

#Calculation
deltam=deltaE/c**2;   #change in mass(kg)

#Result
print "change in mass is",round(deltam/10**9,2),"*10**9 kg"

change in mass is 4.44 *10**9 kg


## Example number 1.8, Page number 17¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
c=1;   #assume
T=10;   #kinetic energy(MeV)
m0c2=0.512;   #rest energy of electron(MeV)

#Calculation
E=T+m0c2;   #total energy(MeV)
p=math.sqrt((E**2)-(m0c2**2))/c;    #momentum of electron(MeV/c)
v=c*math.sqrt(1-(m0c2/E)**2);    #velocity of electron(c)

#Result
print "momentum of electron is",round(p,1),"MeV/c"
print "velocity of electron is",round(v,4),"*c"

momentum of electron is 10.5 MeV/c
velocity of electron is 0.9988 *c