r3vel: Random relativstic velocities

Description Usage Arguments Details Value Note Author(s) Examples

Description

Generates random three-velocities, optionally specifiying a magnitude

Usage

1
2
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()

Details

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

Value

Returns a vector of three velocities.

Note

It is not entirely trivial to sample uniformly from the unit ball or unit sphere, but it is not hard either.

Author(s)

Robin K. S. Hankin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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

RobinHankin/gyrogroup documentation built on Feb. 19, 2019, 3:20 a.m.