#Relative Speed of approach
c = 1 # For the sake of simplicity, assume c = 1, m/s
u = 0.87*c # Velocity of approach of spaceship A towards spaceship B, m/s
v = -0.63*c # Velocity of approach of spaceship B towards spaceship A, m/s
V = (u - v)/(1 - (u*v)/c**2) # Velocity Addition Rule giving relative speed of approach of particles, m/s
print "The relative speed of approach of particles = %6.4fc" %V
#Relative Speed of spaceships
c = 1 # For the sake of simplicity, assume c = 1, m/s
u = 0.9*c # Velocity of approach of spaceship A towards spaceship B, m/s
v = -0.9*c # Velocity of approach of spaceship B towards spaceship A, m/s
V = (u - v)/(1 - (u*v)/c**2) # Velocity Addition Rule giving relative speed of approach of spaceships, m/s
print "The relative speed of B w.r.t. A = %5.3fc"% V
#Relativistic length contraction
L0 = 1.0 # Actual length of the metre stick, m
rel_mass = 3.0/2 # Relative mass of stick w.r.t. rest its mass
# As m = m0/sqrt(1 - (v/c)**2) and L = L0*sqrt(1 - (v/c)**2)
# Thus L/m = (L0/m0)*(1 - (v/c)**2), solving for L
# L = (m0/m)*L0 i.e.
L = 1/rel_mass*L0 # Apparent length of the metre rod, m
print "The apparent length of the metre rod = %5.3f m" %L
# Result
# The apparent length of the metre rod = 0.667 m
#Mass-Energy Equivalence
U = 7.5e+011 # Total electrical energy generated in a country, kWh
kWh = 1000*3600 # Conversion factor for kilowatt-hour into joule, J/kWh
c = 3e+08 # Speed of light, m/s
m = (U*kWh)/c**2 # Mass equivalent of energy, kg
print "The mass converted into energy = %2d kg" % m
# Result
# The mass converted into energy = 30 kg
#Energy equivalent of mass
m = 1 # Mass of a substance, kg
c = 3e+08 # Speed of light, m/s
U = m*c**2 # Energy equivalent of mass, J
print "The energy equivalent of mass = %1.0e J"% U
from math import sqrt
#Relativistic variation of mass with speed
m0 = 1e-024 # Mass of a particle, kg
v = 1.8e+08 # Speed of the particle, m/s
c = 3e+08 # Speed of light, m/s
m = m0/sqrt(1-(v/c)**2) # Mass of the moving particle, kg
print "The mass of moving particle = %4.2e kg"% m
#Increase in mass of water
c = 3e+08 # Speed of light, m/s
T1 = 273 # Initial temperature of water, K
T2 = 373 # Final temperature of water, K
M = 1e+06 # Mass of water, kg
C = 1e+03 # Specific heat of water, cal/kg-K
J = 4.18 # Joule's mechanical equivalent of heat, cal/joule
U = M*C*(T2 - T1)*J # Increase in energy of water, J
m = U/c**2 # Increase in mass of water, kg
print "The increase in mass of water = %4.2e kg"% m
from math import sqrt
#Ratio of rest mass and mass in motion
c = 1 # For convenience, speed of light is assumed to be unity, m/s
v = 0.5*c # Velocity of moving particle, m/s
# As m0 = m*sqrt(1 - (v/c)**2), and m0/m = rel_mass, we have
rel_mass = sqrt(1 - (v/c)**2) # Ratio of rest mass and the moving mass
print "The ratio of rest mass and the mass in motion = %6.4f kg"% rel_mass
# Result
# The ratio of rest mass and the mass in motion = 0.8660 kg
#Heat equivalent of mass
c = 3e+08 # Speed of light, m/s
J = 4.18 # Joule's equivalent of heat, joule per calorie
m = 4.18e-03 # Mass of the substance, kg
U = m*c**2 # Energy equivalent of mass, J
Q = U/J # Heat equivalent of mass, calorie
print "The heat equivalent of mass = %1.0e cal"% Q
# Result
# The heat equivalent of mass = 9e+013 cal
from math import sqrt
#Variation of space and time
L = 0.5 # Shortened length of the rod, m
L0 = 1 # Actual length of the rod, m
t0 = 1 # Actual time on the spaceship, s
c = 3e+08 # Speed of light, m/s
v = sqrt(1 - (L/L0)**2)*c # Speed of the spaceship, m/s
t = t0/sqrt(1 - (v/c)**2) # Dilated time for stationary observer, s
print "The speed of light = %5.3e m/s"% v
print "The time dilation corresponding to 1 s on the spaceship = %d s"% round(t)
#Mean lifetime of a moving meason
c = 1 # For convenience, speed of light is assumed to be unity
t0 = 2e-08 # Mean life time of pi-meson at rest, s
v = 0.8*c # Velocity of moving pi-meason, m/s
t = t0/sqrt(1-(v/c)**2) # Mean lifetime of moving pi-meason, s
print "The mean lifetime of moving meason = %4.2e s"% t
#Velocity of one atomic mass unit
c = 1.0 # For convenience, speed of light is assumed to be unity, m/s
m0 = 1.0 # For convenience, rest mass is assumed to be unity
# Here 2*m0*c**2 = m*c**2 - m0*c**2 = KE which gives
m = 3*m0 # Atomic mass in motion, kg
# As m = m0/sqrt(1 - (v/c)**2), solving for v
v = sqrt(1 - (m0/m)**2)*c # Velocity of one atomic mass, m/s
print "The velocity of one atomic mass = %5.3fc"% v
# Result
# The velocity of one atomic mass = 0.943c
#Speed of an electron for an equivalent proton mass
c = 3e+08 # Speed of light, m/s
m0 = 1 # For convenience, rest mass of an electron is assumed to be unity
m = 2000*m0 # Rest mass of a proton, units
# As m = m0/sqrt(1 - (v/c)**2), solving for v
v = sqrt(1 - (m0/m)**2)*c # Speed of the moving electron, m/s
print "The speed of the moving electron = %4.2e m/s (approx.)"% v
#Speed at total energy twice the rest mass energy
c = 1 # Speed of light is assumed to be unity, m/s
m0 = 1.0 # For convenience, rest mass of the particle is assumed to be unity, kg
m = 2*m0 # Mass of the moving particle when m*c**2 = 2*m0*c**2, kg
# As m = m0/sqrt(1 - (v/c)**2), solving for v
v = sqrt(1 - (m0/m)**2)*c # Speed of the moving particle, m/s
print "The speed of the moving particle = %5.3fc"% v
#Relative velocity and mass
c = 3e+08 # Speed of light, m/s
u = 2e+08 # Speed of first particle, m/s
v = -2e+08 # Speed of second particle, m/s
u_prime = (u - v)/(1 - u*v/c**2) # Velocity addition rule giving relative velocity, m/s
m0 = 3e-025 # Rest mass of each particle, kg
m = m0/sqrt(1 - (u_prime/c)**2) # Mass of one particle relative to the other, kg
print "The relative speed of one particle w.r.t the other = %5.3e m/s"% u_prime
print "The mass of one particle relative to the other = %3.1e kg"% m
#Relativistic variation of density with velocity
c = 1 # Speed of light is assumed to be unity for convenience, m/s
v = 0.9*c # Speed of moving frame, m/s
rho_0 = 19.3e+03 # Density of gold in rest frame, kg metre per cube
L0 = 1 # Actual length is assumed to be unity, m
m0 = 1 # Rest mass of gold is assumed to be unity, kg
V0 = m0/rho_0 # Volume of gold in rest frame, metre cube
L = L0*sqrt(1 - (v/c)**2) # Relativistic Length Contraction Formula, m
y = 1 # Width of gold block is assumed to be unity, m
z = 1 # Height of gold block is assumed to be unity, m
V = L*y*z*V0 # Volume of gold as observed from moving frame, metre cube
m = m0/sqrt(1 - (v/c)**2) # Mass of gold as observed from moving frame, kg
rho = m/V # Density of gold as observed from moving frame, kg per metre cube
print "The density of gold as observed from moving frame = %5.1fe+003 kg per metre cube"% (rho/1e+03)
#Electrons accelerated to relativistic speeds
U = 1.0e+09*1.6e-019 # Kinetic energy of the electrons, J
# As U = m*c**2, solving for m
m = U/c**2 # Mass of moving electrons, kg
m0 = 9.1e-031 # Rest mass of an electron, kg
mass_ratio = m/m0 # Ratio of a moving electron mass to its rest mass
c = 3e+08 # Speed of light, m/s
# As m = m0/sqrt(1 - (v/c)**2), Relativistic mass of electron, kg, solving for v, we have
v = sqrt(1 - (m0/m)**2)*c # Velocity of moving electron, m/s
vel_ratio = v/c # Ratio of electron velocity to the velocity of light
U0 = m0*c**2 # Rest mass energy of electron, J
ene_ratio = U/U0 # Ratio of electron energy to its rest mass energy
print "The ratio of a moving electron mass to its rest mass %4.2e" %(mass_ratio)
print "The ratio of electron velocity to the velocity of light = 1 - %5.3e" %((1-vel_ratio**2)/2)
print "The ratio of electron energy to its rest mass energy = %5.3e"%(ene_ratio)
# Result
# The ratio of a moving electron mass to its rest mass 1.95e+003
# The ratio of electron velocity to the velocity of light = 1 - 1.310e-007
# The ratio of electron energy to its rest mass energy = 1.954e+003
#Electron speed equivalent of twice its rest mass
m0 = 9.1e-031 # Rest mass of an electron, kg
m = 2*m0 # Mass of moving electron, kg
c = 3e+08 # Speed of light, m/s
# As m = m0/sqrt(1 - (v/c)**2), Relativistic mass of electron, kg, solving for v, we have
v = sqrt(1 - (m0/m)**2)*c # Velocity of moving electron, m/s
print "The speed of electron so that its mass becomes twice its rest mass = %5.3e m/s"% v
from math import sqrt
#Electron speed equivalent of twice its rest mass
m0 = 9.1e-031 # Rest mass of an electron, kg
m = 2*m0 # Mass of moving electron, kg
c = 3e+08 # Speed of light, m/s
# As m = m0/sqrt(1 - (v/c)**2), Relativistic mass of electron, kg, solving for v, we have
v = sqrt(1 - (m0/m)**2)*c # Velocity of moving electron, m/s
print "The speed of electron so that its mass becomes twice its rest mass = %5.3e m/s"%v
from math import sqrt
#Fractional speed of electron
m0 = 9.1e-031 # Rest mass of an electron, kg
c = 3e+08 # Speed of light, m/s
E = 0.5*1e+06*1.6e-019 # Kinetic energy of electron, J
# As E = (m - m0)*c**2, solving for m
m = E/c**2+m0 # Mass of moving electron, kg
# As m = m0/sqrt(1 - (v/c)**2), Relativistic mass of electron, kg, solving for v, we have
v = sqrt(1 - (m0/m)**2)*c # Velocity of moving electron, m/s
print "The speed of electron relative to speed of light = %5.3f"%(v/c)
#Effective mass and speed of electron
c = 3e+08 # Speed of light, m/s
e = 1.6e-019 # Electron-volt equivalent of 1 joule, eV/joule
U = 2*1e+06*e # Total energy of electron, J
# As E = (m - m0)*c**2, solving for m
m = U/c**2 # Effective mass of electron, kg
m0 = 0.511*1e+06*e/c**2 # Rest mass of the electron, kg
# As m = m0/sqrt(1 - (v/c)**2), Relativistic mass of electron, kg, solving for v, we have
v = sqrt(1 - (m0/m)**2)*c # Velocity of moving electron, m/s
print "The effective mass of electron = %4.1e kg"% m
print "The relativistic speed of electron = %4.2fc m"% (v/c)
#Energy released in fission
c = 3.0e+08 # Speed of light, m/s
e = 1.6e-019 # Charge on an electron, coulomb
r0 = 1.2e-015 # Equilibrium nuclear radius, m
A = 238.0 # Twice the mass of each fragment
q1 = 46.0*e # Charge on first fragment, coulomb
q2 = 46.0*e # Charge on second fragment, coulomb
R = r0*(A/2)**(1.0/3)
d = 2*R # Distance between two fragments, m
U = q1*q2*9e+09/d # Energy released in fission, J
print "The energy released in fission of U(92,238) = %3d MeV"%(U/(e*1e+06))
# Result
# The energy released in fission of U(92,238) = 258 MeV
from math import sqrt
#Relativistic speed form relativistic mass
c = 3e+08 # Speed of light, m/s
m0 = 1.0/2 # Rest mass of the particle, MeV/c**2
m = 1/sqrt(2) # Relativistic mass of the particle, MeV/c**2
# As m = m0/sqrt(1 - (v/c)**2), Relativistic mass of electron, kg, solving for v, we have
v = sqrt(1 - (m0/m)**2)*c # Relativistic velocity of particle, m/s
print "The relativistic velocity of particle = %4.2e m/s"%(v)
# Result
# The relativistic velocity of particle = 2.12e+008 m/s
from math import sqrt
#Decay of muon
c = 3e+08 # Speed of light, m/s
v = 0.992*c # Relativistic speed of muon, m/s
S = 60*1e+03 # Distance travelled by muon before it decays, m
t_prime = S/v # Time measured by observer on earth (Dilated Time), s
t = t_prime*sqrt(1 - (v/c)**2) # Time measured by muon in its own frame, s
s = v*t # Distance covered by the muon in its own frame of reference, m
print "The time measured by observer on earth (Dilated Time) = %5.3e s"% t_prime
print "The time measured by muon in its own frame = %4.2e s"% t
print "The distance covered by the muon in its own frame of reference = %4.2f km"%(s/1e+03)
# Result
# The time measured by observer on earth (Dilated Time) = 2.016e-004 s
# The time measured by muon in its own frame = 2.55e-005 s
# The distance covered by the muon in its own frame of reference = 7.57 km
from math import sqrt
#Decay of unstable particlec = 3e+08 # Speed of light, m/s
v = 0.9*c # Relativistic speed of unstable particle, m/s
t0 = 1e-06 # Time of decay of unstable particle in rest frame, s
t = t0/sqrt(1 - (v/c)**2) #Time of decay of unstable particle in moving frame, s
s = v*t # Distance travelled by unstable particle before it decays in moving frame, m
print "The distance travelled before the unstable particle decays = %4.2e m"% s
# Result
# The distance travelled before the unstable particle decays = 6.19e+002 m