Function `signature()` in the `clifford` package
Robin K. S. Hankin
Source:vignettes/signature.Rmd
signature.Rmd
signature
## function (p, q = 0)
## {
## if (missing(p)) {
## s <- getOption("signature")
## if (is.null(s)) {
## s <- c(.Machine$integer.max, 0)
## }
## showsig(s)
## class(s) <- "sigobj"
## return(s)
## }
## else {
## s <- c(p, q)
## m <- getOption("maxdim")
## if (!is.null(m)) {
## if (p + q > m) {
## stop("signature requires p+q <= maxdim")
## }
## }
## p <- min(s[1], .Machine$integer.max)
## q <- min(s[2], .Machine$integer.max)
## stopifnot(is_ok_sig(s))
## options(signature = c(p, q))
## showsig(s)
## return(invisible(s))
## }
## }
To cite the clifford
package in publications please use
Hankin (2022b). This short document
discusses signature()
in the clifford
R
package. As an example we might wish to work in \(\operatorname{Cl}(1,2)\):
signature(1,2)
Thus \(e_1^2=+1\), and \(e_2^2=e_3^2=-1\):
## [1] 1 -1 -1
We might ask what \(e_4\) would evaluate to, and this is assumed to be zero as is \(e_i^2\) for \(i\geqslant 4\):
## [1] 0 0
If we wish to set paranoid-level safety measures, we would set option
maxdim
to prevent accidentally working with too-large
values of \(i\):
options(maxdim = 4)
Now we work with a four-dimensional vector space in which \(e_1^2=+1,e_2^2=e_3^2=-1,e_4^2=0\), but now \(e_5\) is undefined:
## [1] 1 -1 -1 0
e(5)
## Error in is_ok_clifford(terms, coeffs): option maxdim exceeded
The operation of signature()
is modelled on the
sol()
function in the lorentz
package (Hankin 2022a). Thus, if given no arguments we
return the signature:
## [1] 1 2
However, the default value is to use an infinite signature which corresponds to \(e_i^2=1\forall i\):
## [1] Inf 0
Function signature()
returns an object of (trivial)
class sigobj
which has a bespoke print method. For
technical reasons an infinite signature is not allowed but is
represented internally by a near-infinite integer, specifically
.Machine$integer.max
:
## structure(c(2147483647, 0), class = "sigobj")