lorentz (version 1.0-2)

r3vel: Random relativstic velocities

Description

Generates random three-velocities, optionally specifiying a magnitude

Usage

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

Arguments

n

Number of three-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()

Value

Returns a vector of three velocities.

Details

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

Examples

Run this code
# NOT RUN {
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)

sol(299792458)
sound <- 343      # speed of sound in SI
r3vel(100,343)    # random 3-velocities with speed=343


sol(1)   # return to default c=1

# }

Run the code above in your browser using DataLab