Skip to contents

Various functionality to deal with the 4-momentum of a photon

Usage

is.consistent.nullvec(N,TOL=1e-10)
as.photon(x,E=1)

Arguments

N

Four-momentum to be tested for nullness

TOL

tolerance

x

Vector of three-velocities

E

Energy, a scalar

Details

Returns the four-momentum of a photon.

Author

Robin K. S. Hankin

See also

Examples


## A bunch of photons all approximately parallel to the x-axis:
as.photon(as.3vel(cbind(0.9,runif(10)/1000,runif(10)/1000)))
#>       E       p_x          p_y          p_z
#>  [1,] 1 0.9999996 3.994784e-04 0.0007872044
#>  [2,] 1 0.9999991 9.380341e-04 0.0009674737
#>  [3,] 1 0.9999998 5.074990e-04 0.0003131250
#>  [4,] 1 1.0000000 1.989270e-04 0.0001924720
#>  [5,] 1 0.9999994 1.073565e-03 0.0001218555
#>  [6,] 1 0.9999995 7.926795e-04 0.0006513576
#>  [7,] 1 0.9999996 2.765113e-05 0.0009452455
#>  [8,] 1 0.9999992 6.960622e-04 0.0010239172
#>  [9,] 1 0.9999993 9.199119e-04 0.0007507349
#> [10,] 1 0.9999997 7.145209e-04 0.0003895423


## mirror ball:
jj <- matrix(rnorm(30),10,3)
disco <- sweep(matrix(rnorm(30),10,3),1,sqrt(rowSums(jj^2)),`/`)
p <- as.photon(c(1,0,0))
reflect(p,disco)
#>   E        p_x         p_y         p_z
#> x 1  0.2601284  0.51563383  0.81636693
#> x 1  0.9589687 -0.28324653 -0.01226286
#> x 1 -0.1877187  0.89461522 -0.40549391
#> x 1  0.6281797 -0.24266099  0.73926039
#> x 1  0.5715356  0.79840388 -0.18946863
#> x 1 -0.5506308 -0.20375508  0.80949959
#> x 1  0.1119910 -0.85470442 -0.50689089
#> x 1 -0.9146116  0.28754730  0.28425725
#> x 1 -0.8181715  0.04796493  0.57297010
#> x 1  0.4750710 -0.43927743  0.76245842

table(reflect(p,disco)[,2]>0) # should be TRUE with probability sqrt(0.5)
#> 
#> FALSE  TRUE 
#>     4     6 

## relativistic  disco; mirror ball moves at 0.5c:

B <- boost(as.3vel(c(0.5,0,0)))
p |> tcrossprod(B) |> reflect(disco) |> tcrossprod(solve(B))
#>           t           x           y            z
#> x 0.7533761  0.50675227  0.29770133  0.471329668
#> x 0.9863229  0.97264582 -0.16353246 -0.007079964
#> x 0.6040938  0.20818756  0.51650634 -0.234112019
#> x 0.8760599  0.75211979 -0.14010039  0.426812183
#> x 0.8571785  0.71435704  0.46095869 -0.109389765
#> x 0.4831231 -0.03375387 -0.11763805  0.467364806
#> x 0.7039970  0.40799398 -0.49346383 -0.292653594
#> x 0.3617961 -0.27640773  0.16601551  0.164115998
#> x 0.3939428 -0.21211435  0.02769257  0.330804440
#> x 0.8250237  0.65004736 -0.25361694  0.440205575