Arith: Methods for Function Arith in package Onion

Description Usage Arguments Details Value Note Author(s) Examples

Description

Methods for Arithmetic functions for onions: +, -, *, /, ^

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15

Arguments

z,e1,e2,a,b,o,o1,o2,n,q1,q2,p

onions or numeric vectors

Details

The package implements the Arith group of S4 generics so that idiom like A + B*C works as expected with onions.

Functions like onion_inverse() and onion_plus_onion() are low-level helper functions. The only really interesting operation is multiplication; functions octonion_prod_octonion() and quaternion_prod_quaternion() dispatch to C.

Names are implemented and the rules are inherited (via harmonize_oo() and harmonize_on()) from rbind().

Value

generally return an onion

Note

Previous versions of the package included the option to use native R rather than the faster compiled C code used here. But this was very slow and is now discontinued.

Author(s)

Robin K. S. Hankin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
a <- rquat()
b <- rquat()
a
Re(a)
j(a) <- 0.2
a*b
b*a  # quaternions are noncommutative


x <- as.octonion(matrix(rnorm(40),nrow=8))
y <- roct()
z <- roct()


x*(y*z) - (x*y)*z  # octonions are nonassociative [use associator()]

onion documentation built on Feb. 11, 2021, 9:06 a.m.