In [7]:

```
from math import *
# Given
x = 100 # in meter
y = 10 # in meter
z = 5 # in meter
t = 1e-4 # in sec
# coordinates of point in frame F
v = 2.7e8 # velocity of frame F_ w.r.t. frame F in m/sed
c=3e8 # speed of light in m/sec
#Calculations
# according to Galilean transformation
x__ = x-v*t
y__=y
z__=z
t__=t
# according to Lorentz transformation
x_ = (x-v*t)/sqrt(1-(v/c)**2)
y_=y
z_=z
t_=(t-(v*x/c**2))/sqrt(1-(v/c)**2)
#Results
print "Coordinate of the event in reference frame F_ using \n(a)Galilean transformation-x=%.f m, y=%.f m, z = %.f m, t = %.e sec"%(x__,y__,z__,t__)
print "(b)Lorentz transformation-x=%.f m,y =%.f m, z = %.f m, t=%.e sec "%(x_,y_,z_,t_)
```

In [12]:

```
from math import *
# Given
r = 4 # ratio of mass of particle to the rest mass
#Calculations
v = 3e8 * sqrt(1 - (1 / r)**2)
#Result
print "Speed of particle is %.e meter/sec"%v
```

In [14]:

```
from math import *
# Given
r = 1.2 # ratio of mass of particle to the rest mass
#Calculations
v = 3e8 * sqrt(1 - (1 / r)**2)
#Results
print "Speed of particle is %.3f c"%(v/3e8)
```

In [16]:

```
# Given
E = 2 # kinetic energy of electron in Mev
#Calculations
v = 3e8 * sqrt(1 - (1 / (1 + (1.6e-19 * 2e6) / (9.1e-31 * 3e8**2)))**2)
m = (9.1e-31) / sqrt(1 - (v / 3e8)**2)
#Results
print "Speed of electron is %.2f c\nMass of electron is %.2e kg"%(v/3e8,m)
```

In [18]:

```
# Given
r = 2.25 # ratio of mass of particle to the rest mass
#Calculations
v = 3e8 * sqrt(1 - (1 / r)**2)
#Result
print "Speed of particle is %.2e meter/sec"%v
```

In [22]:

```
from math import *
# Given
r = 2. # ratio of kinetic energy of body to its rest mass
#Calculations
v = 3e8 * sqrt(1 - (1 / (r + 1))**2)
#Result
print "Velocity of particle is %.2f c"%(v/3e8)
```

In [24]:

```
from math import *
# Given
r = 11. # ratio of mass of particle to the rest mass of electron
#Calculations
KE = (r - 1) * 9.1e-31 * 3e8**2 / (1.6e-19)
m = 3e8 * sqrt(1 - (1 / r)**2) * 9.1e-31 * 11
#Result
print "Kinetic energy of electron is %.1f MeV\nMomentum of particle is %.2e N-sec"%(KE/1e6,m)
```

In [30]:

```
from math import *
# Given
m = 1.67e-27 # mass of electron in kg
m_ = 9.1e-31 # rest mass of electron in kg
#Calculations
v = 3e8 * sqrt(1 - (m_ / m)**2)
#Result
print "Velocity of electron is %.3e meter/sec"%v
```

In [33]:

```
from math import *
# Given
E = 0.1 # kinetic speed of electron in Mev
#Calculations
v_ = sqrt(2 * (E * 1.6e-13) / 9.1e-31)
v = 3e8 * sqrt(1 - (1 / (1 + (1.6e-13 * E) / (9.1e-31 * 3e8**2)))**2)
#Results
print "Speed according to classical mechanics is %.2e meter/sec\nSpeed according to relativistic mechanics is %.2e meter/sec"%(v_,v)
```

In [39]:

```
from math import *
# Given
r1 = 3. # ratio of kinetic energy of body to its rest mass in first case
r2 = 1. # ratio of kinetic energy of body to its rest mass in second case
#Calculations
v1 = 3e8 * sqrt(1 - (1 / (r1 + 1))**2)
v2 = 3e8 * sqrt(1 - (1 / (r2 + 1))**2)
#Results
print "Velocity of particle if kinetic energy is %d times of rest mass energy is %.2e meter/sec\nVelocity of particle if kinetic energy is %.1e times of rest mass energy is %e meter/sec"%(r1,v1,r2,v2)
```

In [40]:

```
from math import *
# Given
E = 1.5 # kinetic energy of electron in Mev
#Calculations
v = 3e8 * sqrt(1 - (1 / (1 + (1.6e-19 * 2e6) / (9.1e-31 * 3e8**2)))**2)
m = (E * 1.6e-13 / (3e8)**2) + 9.1e-31
#Results
print "Speed of electron is %.2e meter/sec\nMass of electron is %.1e kg"%(v,m)
```

In [43]:

```
# Given
r = 3. / 2 # ratio of mass of metre stick to the rest mass of metre stick
#Calculations
l = 1 * (1. / r)
#Result
print "Length of meter stick is %.2f meter if mass is %.2f times of its rest mass"%(l,r)
```

In [45]:

```
from math import *
# Given
r = 1. / 2 # ratio of area of circular lamina in frame S_ to the ratio of area of circular lamina in frame S
#Calculations
v = 3e8 * sqrt(1 - r**2)
#Result
print "Velocity of frame S_ w.r.t. frame S is %.1e meter/sec"%v
```

In [47]:

```
from math import *
# Given
t = 1 # lose in time in an hour in minute
#Calculations
v = 3e8 * sqrt(1 - ((60. - t) / 60)**2)
#Result
print "Speed of clock is %.2e meter/sec"%v
```

In [48]:

```
from math import *
# Given
t_ = 2.5e-8 # proper life of pi+ mesons in sec
v = 2.4e8 # velocity of beam of mesons in m/sec
r = 1. / exp(2) # ratio of final flux to initial flux of the meson beam
#Calculations
t = t_ / sqrt(1 - (v / 3e8)**2)
T = t * log(1. / r)
d = T * v
#Result
print "Distance travel by the beam is %.2f meter"%d
```

In [49]:

```
# Given
v = 1.8e8 # velocity of space ship away from the earth in m/sec
v1 = 2.1e8 # velocity of rocket w.r.t. space ship away from the earth in first case in m/sec
v2 = -2.1e8 # velocity of rocket w.r.t. space ship away from the earth in second case in m/sec
#Calculations
u1 = (v1 + v) / (1 + ((v1 * v) / (3e8)**2))
u2 = (v2 + v) / (1 + ((v2 * v) / (3e8)**2))
#Results
print "Velocity of rocket w.r.t. earth in first case = %.2f c away from the earth\nVelocity of rocket w.r.t. earth in second case = %.2f c away from the earth "%(u1/3e8,u2/3e8)
```

In [50]:

```
from math import *
# Given
l = 1 # length of the rod in meter
v = 1.8e8 # speed of rod along its length in meter/sec
#Calculations
L = l * sqrt(1- (v / 3e8)**2)
#Result
print "Length as it appear to the observer is %.1f meter"%L
```

In [51]:

```
from math import *
# Given
l = 2 # length of the rod in meter
v = 2.7e8 # speed of rod along its length in meter/sec
#Calculations
L = l * sqrt(1- (v / 3e8)**2)
#Result
print "Length as it appear to the observer is %.3f meter"%L
```

In [52]:

```
from math import *
# Given
l = 100. # consider the length of the rod in meter
v = 2.4e8 # speed of rod in meter/sec
theta = pi / 3 # direction of velocity of rod along its length in radian
#Calculations
Lx = l * cos(theta)
Ly = l * sin(theta)
L_x = Lx * sqrt(1 - (v / 3e8)**2)
L_y = Ly
L = sqrt(L_x**2 + L_y**2)
p_l = ((l - L) / l) * 100
#Result
print "Percentage length contraction is %.1f percent"%p_l
```

In [53]:

```
from math import *
# Given
r = 0.5 # ratio of length of rod when it is in motion to the length of the rod when it is in rest
#Calculations
v = 3e8 * sqrt(1 - r**2)
#Result
print "Speed of the rod relative to observer is %.3f c"%(v/3e8)
```

In [55]:

```
from math import *
# Given
l = 5 # length of the rod in meter
v = 1.8e8 # speed of rod in meter/sec
theta = pi / 6 # direction of velocity of rod along its length in radian
#Calculations
Lx = l * cos(theta)
Ly = l * sin(theta)
L_x = Lx * sqrt(1 - (v / 3e8)**2)
L_y = Ly
L = sqrt(L_x**2 + L_y**2)
orientation = atan(L_y / L_x) * (180 / pi)
#Results
print "Length of the rod in moving frame is %.2f meter\nOrientation of the rod is %.2f degree"%(L,orientation)
```

In [56]:

```
from math import *
# Given
T = 17.8e-9 # half-life of prticle at rest in sec
v = 2.4e8 # speed of particle in meter/sec
#Calculations
t = T / (sqrt(1 - (v / 3e8)**2))
#Result
print "New half-life of particle is %.2f nanosec"%(t/1e-9)
```

In [58]:

```
from math import *
# Given
T = 24 # no. of hours in a day
v = 1e8 # speed of spaceship in meter/sec
#Calculations
t = T * (sqrt(1 - (v / 3e8)**2))
T_ = T - t
m=(T_-1)*60
s=(m-22)*60
#Result
print "Time lost per day is %d hours %d minute %d sec"%(T_,m,s)
```

In [60]:

```
from math import *
# Given
T = 4. # no. of year when rocket is moving corresponding to one year
#Calculations
v = 3e8 * sqrt(1 - (1 / T)**2)
#Result
print "Speed of rocket is %.2f c"%(v/3e8)
```

In [61]:

```
from math import *
# Given
d = 4 # distance of star from the earth in light years
v = 3e8 * sqrt(0.9999) # speed of rocket in meter/sec
#Calculations
t = (2 * d * 3e8) / v
T_ = t * sqrt(1 - (v / 3e8)**2)
#Result
print "Time taken by the rocket is %.2f year"%T_
```

In [62]:

```
from math import *
# Given
t = 2e-7 # life time of particle when it is moving in sec
v = 2.8e8 # speed of particle in meter/sec
#Calculations
T_ = t * sqrt(1 - (v / 3e8)**2)
#Result
print "Proper life time of particle is %.2e sec"%T_
```

In [63]:

```
# Given
v1 = 2.7e8 # velocity of first electron beam in meter/sec
v2 = -2.7e8 # velocity of second electron beam in meter/sec
#Calculations
u = v1 - v2
u_ = (v1 - v2) / (1 - (v1 * v2) / (3e8)**2)
#Results
print "Velocity of electrons beam w.r.t. another electron beam according to Newtonian mechanics is %.1f c\nVelocity of electrons beam measured by the observer moving with other electron beam = %.2f c"%(u/3e8,u_/3e8)
```

In [64]:

```
# Given
E = 900 # total relativistic energy of proton in Mev
m = 1.63-27 # rest mass of proton in kg
c = 3e8 # velocity of photon in meter/sec
#Calculations
m_ = (E * 1.6e-13) / (c)**2
#Results
print "Relativistic mass of proton is %.2e kg\nHere relativistic mass is same as rest mass\n hence proton is at rest and speed and kinetic energy of proton will be zero"%(m_)
```

In [65]:

```
# Given
E = 5.4e6 # energy liberates during dynamite explosion in J/kg
c = 3e8 # velocity of photon in meter/sec
#Calculations
E_ = 1 * c**2 # energy liberated by 1 kg content in J
f = E / E_
#Result
print "Fraction of total energy content in it is %.1e per kg"%f
```

In [66]:

```
from math import *
# Given
k = 1.02 # kinetic energy of electron in Mev
E_ = 0.51 # rest mass energy of electron in Mev
c = 3e8 # velocity of photon in meter/sec
#Calculations
E = k + E_
v = c * sqrt(1 - (E_ / E)**2)
#Result
print "Speed of the electron is %.2e meter/sec"%v
```

In [67]:

```
from math import *
# Given
E = 1400 # solar energy receives by the earth in W/square meter
d = 1.5e11 # distance between earth and the sun in meter
c = 3e8 # velocity of photon in meter/sec
#Calculations
E_ = 4 * pi * d**2 * E
m = E_ / c**2
#Result
print "Rate of decrement of mass of the sun is %.2e kg/sec"%m
```