Ops.3vec: Arithmetic Ops Group Methods for 3vel objects

Description Usage Arguments Details Value Examples

Description

Arithmetic operations for three-velocities

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class '3vel'
Ops(e1, e2)
## S3 method for class '4vel'
Ops(e1, e2)
massage3(u,v)
neg3(u)
prod3(u,v=u)
add3(u,v)
dot3(v,r)

Arguments

e1,e2,u,v

Objects of class “3vel”, three-velocities

r

Scalar value for circle-dot multiplication

Details

The function Ops.3vel() passes unary and binary arithmetic operators “+”, “-” and “*” to the appropriate specialist function.

The most interesting operators are “+” and “*”, which are passed to add3() and dot3() respectively. These are defined, following Ungar, as:

see PDF

and

see PDF

where u and v are three-vectors and r a scalar. Function dot3() has special dispensation for zero velocity and does not treat NA entries entirely consistently.

Arithmetic operations, executed via Ops.4vel(), are not defined on four-velocities.

The package is designed so that natural R idiom may be used for three velocity addition, see the examples section.

Value

Returns an object of class 3vel, except for prod3() which returns a numeric vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
u <- as.3vel(c(-0.7, 0.1,-0.1))
v <- as.3vel(c( 0.1, 0.2, 0.3))
w <- as.3vel(c( 0.5, 0.2,-0.3))

x <- r3vel(10)   # random three velocities
y <- r3vel(10)   # random three velocities


u+v   # add3(u,v)
u-v   # add3(u,neg3(v))

-v    # neg3(v)

gyr(u,v,w)

## package is vectorized:


u+x
x+y

f <- gyrfun(u,v)
g <- gyrfun(v,u)

f(g(x)) - x    # should be zero by eqn10
g(f(x)) - x


(u+v) - f(v+u)                     # zero by eqn 10
(u+(v+w)) - ((u+v)+f(w))           # zero by eqn 11
((u+v)+w) - (u+(v+g(w)))           # zero by eqn 11


## NB, R idiom is unambiguous.  But always always ALWAYS use brackets.

## Ice report in lat 42.n to 41.25n Long 49w to long 50.30w saw much
## heavy pack ice and great number large icebergs also field
## ice.  Weather good clear

## -u+v == (-u) + v == neg3(u) + v == add3(neg3(u),v)

## u+v+w == (u+v)+w == add3(add3(u,v),w)

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