Learn R Programming

lorentz (version 1.1-1)

gam: Gamma correction

Description

Lorentz gamma correction term in special relativity

Usage

# S3 method for 3vel
speed(u)
# S3 method for 4vel
speed(u)
speedsquared(u)
gam(u)
gamm1(u)
# S3 method for 3vel
gam(u)
# S3 method for 3cel
gam(u)
# S3 method for 4vel
gam(u)
# S3 method for 3vel
gamm1(u)
# S3 method for 4vel
gamm1(u)
gam_ur(d)

Arguments

u

Speed: either a vector of speeds or a vector of three-velocities or four-velocities

d

In function gam_ur(), deficit of speed; speed of light minus speed of object

Author

Robin K. S. Hankin

Details

Function speed(u) returns the speed of a 3vel object or 4vel object.

Function gam(u) returns the Lorentz factor $$\frac{1}{\sqrt{1-\mathbf{u}\cdot\mathbf{u}/c^2}}$$

Function gamm1(u) returns the Lorentz factor minus 1, useful for slow speeds when larger accuracy is needed (much like expm1()); to see the R idiom, type “gamm1.3vel” at the commandline. Function gamm1() is intended to work with 3vel objects or speeds. The function will take a 4-velocity, but this is not recommended as accuracy is lost (all it does is return the time component of the 4-velocity minus 1).

Function gam_ur() is used for the ultrarelativistic case where speeds are very close to the speed of light (the function is named for “gamma, ultrarelativistic”). Its argument d is the deficit, that is, \(c-v\) where \(v\) is the speed of the transformation. Algebraically, gam_ur(c-v) == gam(v), but if d is small compared to c the result is more accurate.

Function speedsquared(u) returns the square of the speed of a 3vel object. Use this to avoid taking a needless square root.

Examples

Run this code

gam(seq(from=0,by=0.1,len=10))
gam(r3vel(6,0.7))


x <- as.3vel(c(0.1,0.4,0.5))
speed(x)

gam(speed(x))  # works, but slow and inaccurate
gam(x)         # recommended: avoids needless coercion



## Use SI units and deal with terrestrial speeds.  Use gamm1() for this.
sol(299792458)
sound <- 343 # speed of sound in SI
gam(sound)
gam(sound)-1  
gamm1(sound)   # gamm1() gives much higher precision

snail <- as.3vel(c(0.00275,0,0)) # even the world's fastest snail...
gamm1(snail)                     # ...has only a small relativistic correction


## For the ultrarelativistic case of speeds very close to the speed of
## light, use gam_ur():

sol(1)           # revert to relativistic units

gam(0.99) - gam_ur(0.01) # zero to numerical accuracy

omgp <- 4.9e-24  # speed deficit of the Oh-My-God particle
gam(1-omgp)      # numeric overflow
gam_ur(omgp)     # large but finite

Run the code above in your browser using DataLab