Learn R Programming

lorentz (version 1.1-1)

r3vel: Random relativistic velocities

Description

Generates random three-velocities or four-velocities, optionally specifiying a magnitude

Usage

r3vel(n=7, r = NA)
r4vel(...)
rboost(r = NA)

Value

Returns a vector of three- or four- velocities.

Arguments

n

Number of three- or four- velocities to generate

r

Absolute value of the three-velocities, with default NA meaning to sample uniformly from the unit ball

...

Arguments passed to r3vel()

Author

Robin K. S. Hankin

Details

Function r3vel() returns a random three-velocity. Function r4vel() is a convenience wrapper for as.4vel(r3vel()).

Function rboost() returns a random \(4\times 4\) Lorentz boost matrix, drawn from the connected component. If given r=0, then a transform corresponding to a random rotation will be returned.

Examples

Run this code

r3vel()

a <- r3vel(10000)
b <- r3vel(1000,0.8)
u <- as.3vel(c(0,0,0.9))

pairs(unclass(u+a),asp=1)
pairs(unclass(a+u),asp=1)

is.consistent.boost(rboost())

sol(299792458)    # switch to SI units
sound <- 343      # speed of sound in metres per second
r3vel(100,343)    # random 3-velocities with speed = 343 m/s

sol(1)   # return to default c=1

Run the code above in your browser using DataLab