Four velocities
fourvel.RdCreate and test for four-velocities.
Usage
as.4vel(u)
is.consistent.4vel(U, give=FALSE, TOL=1e-10)
inner4(U,V=U)
to3(U)Arguments
- u
A vector of three-velocities
- U,V
A vector of four-velocities
- give
In function
is.consistent.4vel(), Boolean withTRUEmeaning to return \(U\cdot U+c^2\), which is zero for a four-velocity, and defaultFALSEmeaning to return whether the four-velocity is consistent to numerical precision- TOL
Small positive value used for tolerance
Details
Function as.4vel() takes a three-velocity and returns a
four-velocity.
Given a four-vector \(V\), function inner4() returns the
Lorentz invariant \(V^iV_i=\eta_{ij}V^iV^j\). This
quantity is unchanged under Lorentz transformations. Note that function
inner4() works for any four-vector, not just four-velocities.
It will work for (eg) a four-displacement, a four-momentum vector or a
four-frequency. In electromagnetism, we could have a four-current or
a four-potential. If \(U\) is a four-velocity, then
\(U^iU_i=-c^2\); if \(U\) is a 4-displacement, then \(U^iU_i\) is
the squared interval. If \(P\) is the four-momentum of a photon
then \(P^iP_i=0\).
Function to3() is a low-level helper function used when
as.3vel() is given a four-velocity.
Function is.consistent.4vel() checks for four-velocities being
consistent in the sense that \(U^iU_i=-c^2\). Giving this
function a vector, for example, is.consistent.4vel(1:5), will
return an error.
Compare the functions documented here with boost(), which
returns a \(4\times 4\) transformation matrix (which also
includes rotation information).
Examples
a <- r3vel(10)
as.4vel(a) # a four-velocity
#> A vector of four-velocities (speed of light = 1)
#> t x y z
#> [1,] 1.075881 -0.389660255 0.01479755 -0.07393753
#> [2,] 1.803134 -0.278264930 -1.00876432 1.07529303
#> [3,] 1.252070 0.751268944 0.05064054 0.02664360
#> [4,] 1.155579 -0.009211468 -0.16467223 0.55512340
#> [5,] 4.898861 0.616188783 -1.07658729 -4.63250633
#> [6,] 2.698658 -2.326281454 -0.33930196 0.86950880
#> [7,] 2.435266 -1.633167767 -1.39156737 -0.57168464
#> [8,] 1.707531 0.460130562 -0.60417358 1.15711616
#> [9,] 1.737318 -0.334341873 1.28482113 0.50569274
#> [10,] 1.124769 0.463450013 -0.14627545 0.17006881
as.3vel(as.4vel(a))-a # zero to numerical precision
#> A vector of three-velocities (speed of light = 1)
#> x y z
#> [1,] 2.007979e-17 -2.509973e-19 5.019946e-18
#> [2,] 0.000000e+00 -9.024148e-17 0.000000e+00
#> [3,] -8.702369e-17 -2.719490e-18 -4.079235e-18
#> [4,] 5.791217e-19 1.389892e-17 -1.853190e-17
#> [5,] 0.000000e+00 0.000000e+00 -2.664407e-15
#> [6,] 0.000000e+00 0.000000e+00 0.000000e+00
#> [7,] 0.000000e+00 0.000000e+00 1.646050e-16
#> [8,] 4.046296e-17 -8.092592e-17 1.618518e-16
#> [9,] -4.188698e-17 0.000000e+00 0.000000e+00
#> [10,] 1.755687e-17 0.000000e+00 -2.194609e-17
inner4(as.4vel(a)) # -1 to numerical precision
#> [1] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
stopifnot(all(is.consistent.4vel(as.4vel(a))))
## check Lorentz invariance of dot product:
U <- as.4vel(r3vel(10))
V <- as.4vel(r3vel(10))
B <- boost(as.3vel(1:3/10))
frame1dotprod <- inner4(U, V)
frame2dotprod <- inner4(U %*% B, V %*% B)
max(abs(frame1dotprod-frame2dotprod)) # zero to numerical precision
#> [1] 1.776357e-15