In [1]:

```
import math
#Varible declaration
t0= 3600 # time interval on Earth, seconds
t= 3601.0 #time interval for spacecraft as measured from Earth, seconds
#Calculation
c= 2.998 *(10**8) #speed of light, m/s
v=c*math.sqrt((1-((t0/t)**2))) #relative velocity of spacecraft, m/s
#Result
print"The speed of the Spacecraft relative to Earth is:%.2g "%v,"m/s"
```

In [2]:

```
#Varible declaration
fg= 5.6*(10**14) #frequency of green color, Hz
fr= 4.8*(10**14) #frequency of red color, Hz
c= 3.0*(10**8) #velocity of light, m/s
#Calculation
v= c*((fg**2 - fr**2)/(fg**2 + fr**2)) #longitudinal speed of observer, m/s
v= v*3.6 #convert to km/h
R= 1.0 #rate at which fine is to be imposed per km/h, $
l= 80.0 #speed limit upto which no fine is to be imposed, km/h
fine= v-l # fine to be imposed, $
#Result
print"The fine imposed is:",fine,"$\n"
print"NOTE:Approx value of v is taken in book as 1.65*10^8,which is very less precise.\nTherefore,chnge in final answer"
```

In [3]:

```
import math
#Varible declaration
v= 6.12*(10**7) #receding velocity with respect to Earth, m/s
c= 3.0*(10**8) #velocity of light, m/s
L0= 500.0 #initial wavelength of spectral line, nm
#Calculation
L= L0*math.sqrt(((1+(v/c))/(1-(v/c)))) #final wavelength of spectral light, nm
Ls= L-L0 #shift in wavelength, nm
#Varible declaration
print"Shift in Green spectral line is: ",round(Ls),"nm"
```

In [4]:

```
import math
#Varible declaration
StartingAge= 20 #starting age for both Dick and Jane
c= 3*(10**8) #velocity of light, m/s
v= 0.8*c #rate of separation of Dick and Jane, m/s
t0= 1 #interval for emission of signals, yr
#Calculation
t1= t0*((1+v/c)/(1-v/c)) #interval for reception of signals on outward journey, yr
t1= t0*(math.sqrt((1+v/c)/(1-v/c))) #interval for reception of signals on outward journey, yr
t2= t0*(math.sqrt((1-v/c)/(1+v/c))) #interval for reception of signals on return trip, yr
#Dick's frame of reference
Tout1= 15 #duration of outward trip, yr
Tin1= 15 #duration of return trip, yr
JaneAge= StartingAge+(Tout1/t1)+(Tin1/t2) #Jane's age according to Dick
#Jane's frame of reference
Tout2= 25 #duration of outward trip, yr
d= 20 #delay in transmission of signal to Jane, caused by distance of the star, yr
Tin2= 5 #duration of return trip
DickAge= StartingAge+((Tout2+d)/t1)+(Tin2/t2) #Dick's age according to JAne
#Result
print"According to Dick, age of Jane is:",JaneAge,"years"
print"According to Jane, age of Dick is:",DickAge,"years"
```

In [5]:

```
import math
#Varible declaration
mf= 1 #mass of each entity, kg
c= 3*(10**8) #velocity of light, m/s
v= 0.6*c #velocity of fragments relative to original body, m/s
#Calculation
E0= 2*((mf*(c**2))/math.sqrt(1-((v/c)**2))) #Total energy of fragments
m= E0/(c**2) #mass of original body, kg
#Result
print"The total mass of the stationary body is: ",m,"kg"
```

In [6]:

```
import math
#Varible declaration
r=1.4 # Rate of arrival of Solar Energy at erath, kW per square meter
R=1.5*(10**11) #Radius of Earth, m
#Calculation
P=r*(4*math.pi*(R**2)) #Total power recieved by Earth, kW
P= P*(10**3) #W
C= 3*(10**8) #Velocity of light, m/s
E=P #Energy lost by Sun, J
m= E/(C**2) #Mass of Sun lost per second as energy, kg
#Result
print"Mass lost by sun per second, is:%.2g"%m,"kg"
```

In [7]:

```
import math
#Varible declaration
c= 3*(10**8) #Velocity of light, m/s
me= 0.511/(c**2) #mass of electron, MeV
mp=0 #mass of proton, MeV
p= 2.000/c #momenta for both particles, MeV
#Calculation
##Using Eq. 1.24 and 1.25, Page 31
Ee=math.sqrt(((me**2)*(c**4))+((p**2)*(c**2))) #Total energy of electron, MeV
Ep= p*c #Total energy of proton, MeV
#Result
print"Total energy of Electron is: ",round(Ee,3),"MeV"
print"Total energy of Photon is: ",Ep,"MeV"
```

In [8]:

```
#Varible declaration
c=3*(10**8) #velocity of light, m/s
VaE= 0.90*c #velocity of spacecraft alpha w.r.t Earth, m/s
VbA= 0.50*c #velocity of spacecraft beta w.r.t. Alpha, m/s
#Calculation
VbE= (VaE+VbA)/(1+((VaE*VbA)/(c**2))) #velocity of beta w.r.t Earth, m/s
VbE=VbE/c #Converting to percent of c
#Result
print"The required velocity of spacecraft Beta w.r.t. Earth is:",round(VbE,2),"c"
```