Construct, coerce to, test for, and print onions
octonion(length.out = NULL, names = NULL, Re = 0, i = 0, j = 0,
k = 0, l = 0, il = 0, jl = 0, kl = 0)
as.octonion(x, single = FALSE, names=NULL)
is.octonion(x)
quaternion(length.out = NULL, names = NULL, Re = 0, i = 0, j = 0, k = 0)
as.quaternion(x, single = FALSE, names=NULL)
is.quaternion(x)
is.onion(x)
as.onion(x,type,names=NULL,single=FALSE)
type(x)
In functions quaternion()
and
octonion()
, the length of the onionic vector returned.
In functions quaternion()
and octonion()
,
the names of the octonionic vector returned.
The real part of the onionic vector returned.
Component \(i\) of the onionic vector returned.
Component \(j\) of the onionic vector returned.
In function octonion()
, component \(k\) of the
octonionic vector returned.
In function octonion()
, component \(l\) of the
octonionic vector returned.
In function octonion()
, component \(il\) of the
octonionic vector returned.
In function octonion()
, component \(jl\) of the
octonionic vector returned.
In function octonion()
, component \(kl\) of the
octonionic vector returned.
Onion to be tested or printed
In functions as.octonion()
and
as.quaternion()
, a Boolean variable with
default FALSE
meaning to interpret x
as a vector of
reals to be coerced into an onionic vector with zero imaginary
part; and TRUE
meaning to interpret x
as a length 4
(or length 8) vector and return the corresponding single onion.
In function as.onion()
a string either
“quaternion
” or “octonion
” denoting the
algebra to be forced into
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.
# NOT RUN {
x <- octonion(Re=1,il=1:3)
x
kl(x) <- 100
x
as.quaternion(diag(4))
# }
Run the code above in your browser using DataCamp Workspace