Skip to contents

Create and test for three-velocities, 3vel objects.

Usage

`3vel`(n)
threevel(n)
as.3vel(x)
is.3vel(x)
# S3 method for class 'vec'
length(x)
# S3 method for class 'vec'
names(x)
# S3 method for class 'vec'
names(x) <- value

Arguments

n

In function 3vel(), number of three velocities to create

x,value

Vectors of three-velocities

Note

Class vel is a virtual class containing classes 3vel and 4vel.

Function threevel() is a convenience wrapper for 3vel().

Author

Robin K. S. Hankin

Examples


U <- r4vel(7)
as.4vel(as.3vel(U)) # equal to U, to numerical precision
#> A vector of four-velocities (speed of light = 1)
#>             t          x           y           z
#> [1,] 1.064703 -0.1833323 -0.11490066 -0.29458388
#> [2,] 1.605891 -0.2380188  1.09445012 -0.56957103
#> [3,] 1.531751  1.0052932  0.27313544 -0.51092442
#> [4,] 1.470881  0.2312934  0.79681907 -0.68925516
#> [5,] 1.176000  0.3292251  0.38785069  0.35236209
#> [6,] 1.447224 -0.1489111 -0.07563792  1.03274541
#> [7,] 4.610187 -1.7265427 -4.15603697  0.01507325

x <- as.3vel(1:3/4)
u <- as.3vel(matrix(runif(30)/10,ncol=3))

names(u) <- letters[1:10]

x+u
#> A vector of three-velocities (speed of light = 1)
#>           x         y         z
#> a 0.2597718 0.5158907 0.7476896
#> b 0.2768156 0.5141190 0.7457377
#> c 0.2768905 0.4931028 0.7563018
#> d 0.2760703 0.4927556 0.7557733
#> e 0.2698025 0.5067994 0.7519004
#> f 0.2664772 0.5017437 0.7524056
#> g 0.2732694 0.5151106 0.7433626
#> h 0.2457273 0.5113966 0.7601225
#> i 0.2642481 0.5231799 0.7397257
#> j 0.2513454 0.5193550 0.7501683
u+x  # not equal
#> A vector of three-velocities (speed of light = 1)
#>           x         y         z
#> a 0.2735983 0.5364798 0.7280095
#> b 0.3225594 0.5281792 0.7169743
#> c 0.3234748 0.4694404 0.7528619
#> d 0.3213007 0.4694689 0.7527158
#> e 0.3025877 0.5084397 0.7381889
#> f 0.2939971 0.4971759 0.7451529
#> g 0.3127736 0.5334447 0.7142916
#> h 0.2302470 0.5199656 0.7591552
#> i 0.2866642 0.5578141 0.7052698
#> j 0.2480313 0.5452824 0.7326692