Random relativistic velocities
r3vel.RdGenerates random three-velocities or four-velocities, optionally specifiying a magnitude
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.
Note
If the speed of light is infinite, these functions require a specified
argument for r.
It is not entirely trivial to sample uniformly from the unit ball or unit sphere, but it is not hard either.
Examples
r3vel()
#> A vector of three-velocities (speed of light = 1)
#> x y z
#> [1,] -0.1717926 -0.35944973 0.2867692
#> [2,] -0.5756681 0.01594304 -0.4258907
#> [3,] 0.4964704 0.02355573 -0.8467643
#> [4,] -0.4693461 -0.45678854 0.6972598
#> [5,] 0.2967440 0.16700705 -0.5398859
#> [6,] 0.2927752 -0.80985427 -0.1199808
#> [7,] 0.1366098 0.08116753 0.4696290
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())
#> [1] TRUE
sol(299792458) # switch to SI units
#> [1] 299792458
sound <- 343 # speed of sound in metres per second
r3vel(100,343) # random 3-velocities with speed = 343 m/s
#> A vector of three-velocities (speed of light = 299792458)
#> x y z
#> [1,] -200.2002195 -60.3799222 -271.8880967
#> [2,] -269.5107055 -206.4962726 -48.7059446
#> [3,] -200.9015116 145.1899252 -237.0811428
#> [4,] -222.9571964 -118.8267185 -231.9898695
#> [5,] 271.0710787 -166.6453342 -128.0578107
#> [6,] -326.7156279 -32.8043703 -99.1452054
#> [7,] 0.6571765 88.0386903 -331.5083063
#> [8,] 167.1621621 150.1706583 -259.1420169
#> [9,] -120.8995477 -83.6301894 309.9004530
#> [10,] 187.7939173 -282.1988171 -52.4048878
#> [11,] -109.1324069 -91.3507931 312.0803588
#> [12,] -283.9026443 192.0260515 13.2016720
#> [13,] 131.6985705 -157.1532622 -274.9678867
#> [14,] 120.2380853 319.7902393 -30.4303420
#> [15,] 231.4134483 253.1719957 0.8697855
#> [16,] -53.8973644 -239.5817398 -239.4674593
#> [17,] 14.4945628 31.2018314 341.2702058
#> [18,] 289.2158328 180.9100455 -35.7037461
#> [19,] -82.9041710 -225.3863458 -244.9018039
#> [20,] 68.8252150 177.6947820 -285.1958173
#> [21,] 245.9550061 -237.9706294 22.9153779
#> [22,] 10.9365679 -184.2854272 -289.0817753
#> [23,] -61.1548670 -222.9388787 -253.3916704
#> [24,] 224.1149912 -219.4918411 138.7256371
#> [25,] -245.6392277 -149.0276366 187.3529647
#> [26,] -278.1466626 198.8587516 -27.1777667
#> [27,] -316.3065087 -63.1383690 116.6736427
#> [28,] -293.6583269 157.5177950 81.2522694
#> [29,] 190.3211425 -107.2831451 -264.4185877
#> [30,] -2.2221735 271.5606217 209.5206212
#> [31,] 146.0051262 -181.0177146 -252.1191983
#> [32,] -103.1493296 284.0475010 162.2536070
#> [33,] 250.0363911 -192.3415215 134.6682674
#> [34,] 50.4533834 339.1803800 7.7540916
#> [35,] 95.5431531 46.5187559 -326.1234601
#> [36,] 62.4903065 -234.0622730 242.8143611
#> [37,] -315.7474918 10.7842281 -133.5523188
#> [38,] 209.6173551 -216.1271254 -164.3125987
#> [39,] 85.2519089 90.5783113 -319.6508745
#> [40,] 2.4643883 -238.4541302 -246.5411823
#> [41,] -147.7155147 -278.0749613 -136.0273597
#> [42,] 279.1687341 183.3671995 78.0402975
#> [43,] 276.1017311 176.9740721 100.4838886
#> [44,] 39.5506973 318.7353664 -120.3848353
#> [45,] -217.5315978 -181.6907231 -193.1773410
#> [46,] -189.5233145 -251.6365077 135.6797011
#> [47,] 227.3832621 -71.2314407 -246.7223824
#> [48,] -247.7408332 -15.8137541 236.6926377
#> [49,] 281.5670855 192.1328214 38.1307658
#> [50,] -294.9147680 64.0721971 163.0001017
#> [51,] 306.6753502 85.9246811 127.3427610
#> [52,] 206.2407041 -243.9715774 124.8664943
#> [53,] 269.9749933 125.1127848 170.6144604
#> [54,] -144.0253575 99.4211137 294.9934551
#> [55,] 49.3198382 135.8893722 311.0476363
#> [56,] 209.5728550 270.4033560 24.7031070
#> [57,] 154.4194922 -224.9225676 -207.8784718
#> [58,] 219.5527314 165.7946948 -204.8358302
#> [59,] -127.8892224 -184.1041800 -259.6131693
#> [60,] 112.7666997 309.3262013 -96.1767779
#> [61,] 55.2166206 90.0360705 326.3336189
#> [62,] 205.3759527 196.1407465 192.3500082
#> [63,] -171.5250023 29.0951911 -295.6038624
#> [64,] 42.8275552 32.1633288 338.7924450
#> [65,] -295.3610492 155.6000771 -78.7366918
#> [66,] -227.1353382 -126.5232792 -223.7194626
#> [67,] 239.7339110 -86.8708974 -229.4125086
#> [68,] 16.1575253 273.9839993 -205.7199614
#> [69,] -2.6943718 -4.9539639 342.9536391
#> [70,] 219.0893974 17.8808789 -263.3042159
#> [71,] 52.2790765 202.0808565 272.1749908
#> [72,] -191.0033976 11.4349807 -284.6681284
#> [73,] 231.8769148 177.4598813 -179.9724614
#> [74,] 210.3683526 245.0364634 -115.5477730
#> [75,] -332.5067609 -80.3941135 -25.0008097
#> [76,] -341.3136488 -7.2201102 -33.1943238
#> [77,] -6.6458446 -255.4210832 -228.8337890
#> [78,] -88.8264751 242.8297505 225.3720693
#> [79,] -109.2926421 0.2223587 -325.1216218
#> [80,] 264.1849557 10.3745504 218.5124205
#> [81,] 8.6191754 280.3734607 -197.3966371
#> [82,] 108.7956526 -94.9056233 -311.1357078
#> [83,] -339.7132588 5.7544213 47.0190221
#> [84,] -307.4374124 -56.0816213 -141.3721655
#> [85,] -21.0230432 -264.8700136 216.9122116
#> [86,] -224.6214147 129.3569264 224.6352725
#> [87,] -123.0241166 141.5310740 -287.1985756
#> [88,] -261.5111378 207.5142874 78.7321113
#> [89,] -33.0348762 -268.0430389 -211.4488739
#> [90,] -71.3302337 27.0678898 -334.4074268
#> [91,] 20.6401397 -188.3528039 -285.9129341
#> [92,] -152.4798532 -141.8631307 272.5321018
#> [93,] 164.7812858 91.1869833 -286.6723948
#> [94,] 265.4737181 215.2010973 29.3460851
#> [95,] -93.0767044 -19.8192017 -329.5344084
#> [96,] -193.9281896 -152.2128049 238.4787606
#> [97,] -193.1255231 -223.0345670 -174.9488904
#> [98,] -264.2067446 193.1226169 102.7007837
#> [99,] -42.3691783 311.4393033 137.3295783
#> [100,] -323.8640446 41.2249825 105.1740531
sol(1) # return to default c=1
#> [1] 1