# 4vel: Four velocities In RobinHankin/gyrogroup: The Lorentz Transform in Relativistic Physics

## Description

Create and test for four-velocities.

## Usage

 ```1 2 3 4``` ```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 with `TRUE` meaning to return U.U+c^2, which is zero for a four-velocity, and default `FALSE` meaning 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^i.V_i. This quantity is unchanged under Lorentz transforms. Note that function `inner()` 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=-1; 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.U=-1. Giving this function a vector as in `is.consistent.4vel(1:5)` will return an error.

There is a class “`4vel`”; but the emphasis is on three-velocities. Compare the functions documented here with `boost()`, which returns a 4*4 transformation matrix (which also includes rotation information).

## Author(s)

Robin K. S. Hankin

`boost`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```a <- r3vel(10) as.4vel(a) # a four-velocity as.3vel(as.4vel(a))-a # should be small inner4(as.4vel(a)) # should be -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 %*% B, V %*% B) frame2dotprod <- inner4(U %*% B, V %*% B) max(abs(frame1dotprod-frame2dotprod)) # should be small ```