# Define 5 random three velocities:
v <- r3vel(5)
# convert to four-velocity:
as.4vel(v)
# Now convert 'v' to four-momentum, specifying rest mass:
vel_to_4mom(v) # 4mom of five objects with 3vel v, all unit mass
vel_to_4mom(v, 1:5) # 4mom of five objects with 3vel v, masses 1-5
vel_to_4mom(v[1],1:5) # 4mom of five objects with same 3vel, masses 1..5
# Now convert 'v' to four-momentum, specifying energy E:
p_to_4mom(v,E=1)
p_to_4mom(v,E=10) # slower
p_to_4mom(v,E=100) # even slower
# Four-momentum of objects moving closely parallel to the x-axis:
P <- vel_to_4mom(as.3vel(c(0.8,0,0)) + r3vel(7,0.01))
reflect(P)
reflect(P,c(1,1,1))
sum(P)
Run the code above in your browser using DataLab