#variable declaration
x=50.0
y=20.0
z=10.0 #x,y,z cordinates in meters(frame s)
t=5.0*10**(-8) #time in seconds(frame s)
velocity=0.6*3*10**8 #velocity of observer in s' frame relative to s in meter/second
c=3.0*10.0**8 #speed of light in meter/second
Beta=0.6
Gamma=1.0/((1.0-Beta**2)**(1.0/2.0))
#Calculation
xdash=Gamma*(x-(velocity*t)) #value of x cordinate in frame s' in meters
ydash=y #value of y cordinate in frame s' in meters
zdash=z #value of z cordinate in frame s' in meters
tdash=Gamma*(t-((velocity*x)/(c**2))) #value of t in frame s' in seconds
#Result
print"\nValue of space time cordinates in frame s`:\n\t x`=",xdash," m\n\t y`=",ydash,"m\n\t z`=",zdash,"m\n\t t`=",tdash,"s"
#variable declaration
x1=20.0 #position of event 1 in meters(frame s)
t1=2.0*10**(-8) #time of event 1 in seconds(frame s)
x2=60.0 #position of event 2 in meters(frame s)
t2=3.0*10**(-8) #time of event 2 in seconds(frame s)
c=3.0*10**8 #speed of light in meter/second
v=0.6*c #speed of frame s' relative to frame s (meter/second)
Beta=0.6
Gamma=1.0/((1.0-Beta**2.0)**(1.0/2.0))
#Calculation
#part(i)
separation=Gamma*((x2-x1)-v*(t2-t1)) #spatial separation of the events in frame s' (meter)
#part(ii)
interval=Gamma*((t2-t1)-(v*(x2-x1))/(c**2)) #time interval between the two events in frame s' (second)
#Result
print"\nIn frame s`:\n\t (i)spatial separation=",separation,"m\n\t (ii)time interval=",interval,"s"
#variable declaration
x1=24.0 #position of event 1 in meters(frame s)
t1=8.0*10**(-8) #time of event 1 in seconds(frame s)
x2=48.0 #position of event 2 in meters(frame s)
t2=4.0*10**(-8) #time of event 2 in seconds(frame s)
c=3.0*10**8 #speed of light in meter/second
#calculation
v=((c**2)*(t2-t1))/(x2-x1) #velocity of the frame s' (meter/second)
#Result
print"\nvelocity of the frame s` =",v/(3*10**8),"c"
import numpy
#variable declaration
interval_s=1.0 #time difference between two events in frame s (second)
interval_sdash=4.0 #time difference between two events in frame s' (second)
separation_s=0.0 #spatial separation of two events in frame s (meter)
c=3.0*10**8 #speed of light (meter/second)
v=numpy.random.rand() #assign a random value to unknown velocity(meter/second)
import math
#calculation
Gamma=interval_sdash/(interval_s-(v*(separation_s))/(c**2)) #calculating gamma
separation=-2.0*(((Gamma**2.0)-1)**(1.0/2.0))*c #spatial separation in s' (meter)
#Result
print"\nspatial separation of the events in frame s` =",separation/(3*10**8*math.sqrt(15)),"c sqrt(15)"
import numpy
#variable declaration
interval_s=0.0 #time difference between two events in frame s (second)
separation_s=1.0 #spatial separation of two events in frame s (meter)
separation_sdash=2.0 #spatial separation of two events in frame s' (meter)
c=3*10**8 #speed of light (meter/second)
v=numpy.random.rand() #assign a random value to unknown velocity of frame s' with respect to frame s (meter/second)
#calculation
Gamma=separation_sdash/(separation_s-(v*interval_s)) #calculating value of Gamma
Beta=(1-1/(Gamma**2))**(1/2) #calculating value of Beta
v=Beta*c #velocity of s' with respect to s (meter/second)
interval_sdash=Gamma*(interval_s-((v*separation_s)/(c**2))) #time interval between the events in frame s' (second)
#Result
print"\nThe time interval between the events in frame s` =",interval_sdash/(3*10**8),"X0"
#variable declaration
IbyI_not=.99 #ratio of moving length and rest length
c=3*10**8 #speed of light (meter/second)
#calculation
Beta=(1-IbyI_not**2)**(1/2.0) #calculating value of Beta
v=Beta*c #velocity of rocket ship (meter/second)
#Result
print"\nThe velocity of the rocket ship = %.2e"%(v/(3*10**8)),"c"
#variable declaration
l_dash=1.0 #length of the rod in frame s' (meter)
Theta_dash_degree=45.0 #angle of the rod with x-axis in frame s' (degree)
Beta=1/2.0 #value of Beta
import math
#calculation
Theta_dash_radian=Theta_dash_degree*(math.pi/180.0) #conversion of angle Theta in radian from degree (radian)
l=((l_dash**2)*((math.sin(Theta_dash_radian))**2+((1-(Beta**2))*((math.cos(Theta_dash_radian))**2))))**(1.0/2.0) #length of the rod in frame s (meter)
tan_theta=math.tan(Theta_dash_radian)/((1.0-Beta**2)**(1.0/2.0)) #tan of angle of rod with x-axis in frame s
theta=math.atan(tan_theta) #angle of rod with x-axis in frame s (degree)
#Result
print"\nThe length of the rod =",round(l,2),"m\nInclination of rod with x-axis =",round(math.degrees(theta))," degree"
#variable declaration
c=3*10**8 #speed of light (meter/second)
#calculation
Beta=(1-((1/1.25)**2))**(1.0/2.0) #calculating Beta (1.25 comes from the fact that in frame s' density of bloc is 25% greater than frame s)
v=Beta*c #velocity of the reference frame s'
#Result
print"\nBeta =",Beta
print"NOTE solved in book:\nThe velocity of the frame s` = %.1e"%v," m/s"
#Variable declaration
del_tao=1436.0 #min
del_t=1440.0 #min
#Calculation
def f(b):
return(del_t-del_tao/(math.sqrt(1-b**2)))
from scipy.optimize import fsolve
be=fsolve(f,0.5)
#Result
print"Beta=",be[0],"=1/(sqrt(180))"
#variable declaration
deltaTow=1*10**(-6) #mean proper lifetime of particle (second)
Beta=0.9 #value of Beta
v=2.7*10**8 #velocity of particle (meter/second)
#Calculation
#part(i)
deltaT=deltaTow/((1-Beta**2)**(1.0/2.0)) #lifetime of the particle in the laboratory frame (second)
#part(ii)
d=v*deltaT #distance traversed by the particle in the laboratory before disintegration (meter)
#Result
print"\nIn laboratory frame:\n\t(i)Lifetime of the particle = %.2e"%deltaT,"s\n"
print"\t(ii)Distance traversed by the particle = %.2g"%d," m"
#variable declaration
d=3.0 #km
d=d*1000.0 #[m]
c=3.0*10**8 #m/s speed of light
#Calculation
v=0.99*c #muon velocity
b=(v**2)/(c**2)
del_t=d/v
del_tao=del_t*math.sqrt(1-0.99**2)
#In moun's frame,
d_dash=d*math.sqrt(1-0.99**2)
#Result
print"(i)Proper lifetime of the muon= %.1e"%del_tao,"s"
print"(ii)In muon's frame,distance travelled by it is %.3e"%d_dash,"m"
#variable declaration
import sympy
c=sympy.Symbol("c")
u1=0.6*c #speed of Beta particle 1 in lab frame (meter/second)
u2=-0.8*c #speed of Beta particle 2 in lab frame (meter/second)
v=u1 #velocity of frame s' where frame s' is attached to the first Beta particle (meter/second)
#Calculation
u2_dash=(u2-v)/(1-((u2*v)/c**2)) #velocity of 2nd Beta particle relative to the 1st Beta particle (meter/second)
#Result
print"The velocity of 2nd Beta particle relative to the 1st Beta particle =",round(u2_dash/c,3)*c
#variable declaration
m0=1.0 #let rest mass of particle to be 1 (kg)
m=3.0*m0 #moving mass of particle (kg)
import sympy #speed of light (meter/second)
c=sympy.Symbol("c")
#calculation
Beta=(1-(m0/m)**2)**(1.0/2.0) #Calculation fo Beta
v=Beta*c #speed of particle (meter/second)
#Result
print"The speed of The particle =",round(v/c,3)*c,"=((2*sqrt 2)/3)c"
#Variable declaration
RestEnergy=0.51 #energy of electron if the electron is at rest (Mev)
T=2 #kinetic energy of electron (Bev)
#Calculation
#E=T=pc
from sympy import Symbol
c=Symbol("c") #speed of light (meter/second)
p=(T/c) #momentum of electron neglecting rest energy relative to kinetic energy (Bev*second/meter)
#Result
print"The momentum of the electron =",p,"BeV/c"
#Variable declaration
n=0.01 #fractional increase in momentum
c=3*10**8 #speed of light (meter/second)
#Calculation
Beta=(n*(2-n))**(1.0/2.0) #calculation of Beta
v=Beta*c #velocity of particle (meter/second)
#Result
print"\nBeta =",round(Beta,2)
#Variable declaration
RestEnergy=0.51 #rest energy of electron (Mev)
T=1.0 #potential difference i.e. kinetic energy (Mev)
c=3*10**8 #speed of light (meter/second)
#Calculation
Beta=(1-(RestEnergy/(T+RestEnergy))**2)**(1.0/2.0) #calculation of Beta
v=Beta*c #speed of electron (meter/second)
#Result
print"The speed of the electron,Beta =",round(Beta,4)
print"Note: In the book answer of Beta is wrong"
#Variable declaration
RestEnergy=0.51 #rest energy of electron (Mev)
T=2000.0 #potential difference i.e. kinetic energy (Mev)
#Calculation
import math
#part(i)effective mass of electron in terms of its rest mass
EffectiveMass=1+(T/RestEnergy) #ratio of effective mass of electron and rest mass
#part(ii)speed of electron in terms of the speed of light
Beta=(1-(1/EffectiveMass)**2)**(1.0/2.0) #Calculatio of Beta
import sympy
eff_mass=sympy.Symbol("3923")
beta=((1-(1/eff_mass)**2))**(1.0/2.0) #Calculatio of Beta
#Result
print"The effective mass of electron in terms of its rest mass is",round(EffectiveMass)
print"The speed of electron =",beta,"c is speed of light"
print"OR after solving:"
print"Speed of electron=%.2f"%Beta,"c"
print"\nNote: Wrong answer in book"
#Variable declaration
c=3*10**8 #speed of light(meter/second)
v1=0.6*c #initial velocity of particle (meter/second)
v2=0.8*c #final velocity of particle (meter/second)
#Calculation
#Classically
W_Classic=0.5*((v2/c)**2-(v1/c)**2) #ratio of work and m0*c**2 (mo is the rest mass of particle and c is the speed of light)
#Relativistically
W_Relative=(1/(1-(v2/c)**2)**(1.0/2.0))-(1/(1-(v1/c)**2)**(1.0/2.0)) #ratio of work and m0*c**2 (mo is the rest mass of particle and c is the speed of light)
#Result
print"\nWork required:\n\t Classically: Work =",W_Classic,"*m0*c**2\n\t Relativistically: Work =",round(W_Relative,3),"*m0*c**2\nWhere m0:rest mass of particle & c:speed of light"
#Variable declaration
h=6.63*10**-34 #planck's constant (joule*second)
c=3*10**8 #speed of light (meter/second)
lambda1=5000*10**-10 #wavelength (meter)
lambda2=0.1*10**-10 #wavelength (meter)
#Calculation
#part(i): wavelength=5000 Å
m1=h/(lambda1*c) #effective mass of photon of wavelength 5000 Å
#part(ii): wavelength=0.1 Å
m2=h/(lambda2*c) #effective mass of photon of wavelength 0.1 Å
#Result
print"Effective mass of photon:\n\t(i) mass =",m1,"kg\n\t(ii) mass =",m2,"kg"
#Variable declaration
RestEnergy=0.51 #rest energy of electron (Mev)
#Calculation
E=2*RestEnergy #minimum energy of gamma ray photon (Mev)
#Result
print"\nMinimum energy required =",E,"Mev"
#Variable declaration
c=3*10**8 #Speed of sound (meter/second)
M=1.97*10**30 #Mass of sun (kg)
R=1.5*10**11 #Mean radius of the earth orbit (meter)
sigma=1.4*10**3 #Solar energy received by the earth (joule/meter**2*second)
#Calculation
import math
loss=(4*math.pi*R**2*sigma)/(M*c**2) #Fractional loss of mass of the sun per second
#Result
print"\nThe fractional loss of mass of the sun= %.e"%loss,"s**-1"