onion: Basic onion functions

onionR Documentation

Basic onion functions

Description

Construct, coerce to, test for, and print onions

Usage

octonion(length.out = NULL, Re = 0, i = 0, j = 0, 
    k = 0, l = 0, il = 0, jl = 0, kl = 0)
as.octonion(x, single = FALSE)
is.octonion(x)
quaternion(length.out = NULL,Re = 0, i = 0, j = 0, k = 0)
as.quaternion(x, single = FALSE)
is.quaternion(x)
is.onion(x)
as.onion(x,type,single=FALSE)
quaternion_to_octonion(from)
octonion_to_quaternion(from)
## S4 method for signature 'onion'
as.matrix(x)
## S4 method for signature 'onion'
as.numeric(x)

Arguments

length.out

In functions quaternion() and octonion(), the length of the onionic vector returned

Re

The real part of the onionic vector returned

i, j, k

In functions quaternion() and octonion(), component i,j,k respectively of the returned onion

l, il, jl, kl

In function octonion(), component l,il,jl,kl respectively of the returned octonion

x, from

Onion to be tested or printed

single

In functions as.octonion() and as.quaternion(), Boolean with default FALSE meaning to interpret x as a vector of reals to be coerced into an onion with zero imaginary part; and TRUE meaning to interpret x as a length 4 (or length 8) vector and return the corresponding single onion.

type

In function as.onion() a string either “quaternion” or “octonion” denoting the algebra to be forced into

Details

Functions quaternion() and octonion() use standard recycling where possible; rbind() is used.

Functions as.quaternion() and as.octonion() coerce to quaternions and octonions respectively. If given a complex vector, the real and imaginary components are interpreted as Re and i respectively.

The output of type() is accepted as the type argument of function as.onion(); thus as.onion(out,type=type(x)) works as expected.

Value

Generally return onions

Note

An onion is any algebra (over the reals) created by an iterated Cayley-Dickson process. Examples include quaternions, octonions, and sedenions. There does not appear to be a standard generic term for such objects (I have seen n-ion, anion and others. But “onion” is pronouncable and a bona fide English word).

Creating further onions—such as the sedenions—is intended to be straightforward.

There is a nice example of the onion package in use in the permutations package, under cayley.Rd. This also shows the quaternion group Q8, but from a different perspective.

Author(s)

Robin K. S. Hankin

Examples


x <- octonion(Re=1,il=1:3)
x
kl(x) <- 100
x

as.quaternion(diag(4))


# Cayley table for the quaternion group Q8:
a <- c(H1,-H1,Hi,-Hi,Hj,-Hj,Hk,-Hk)
names(a) <- c("+1","-1","+i","-i","+j","-j","+k","-k")

f <- Vectorize(function(x,y){names(a)[a==a[x]*a[y]]})
X <- noquote(outer(1:8,1:8, f))
rownames(X) <- names(a)
colnames(X) <- names(a)
X


RobinHankin/onion documentation built on April 20, 2024, 2:05 p.m.