Function signature() in the clifford package

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 Cl (1, 2):

signature(1,2)

Thus e12 = +1, and e22 = e32 = −1:

c(drop(e(1)^2),drop(e(2)^2),drop(e(3)^2))
## [1]  1 -1 -1

We might ask what e4 would evaluate to, and this is assumed to be zero as is ei2 for i ≥ 4:

c(drop(e(4)^2),drop(e(100)^2))
## [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 e12 = +1, e22 = e32 = −1, e42 = 0, but now e5 is undefined:

c(drop(e(1)^2),drop(e(2)^2),drop(e(3)^2),drop(e(4)^2))
## [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:

signature()
## [1] 1 2

However, the default value is to use an infinite signature which corresponds to ei2 = 1∀i:

options(maxdim=NULL)
signature(Inf)
signature()
## [1] Inf   0

Function signature() returns an object of (trivial) class sigobj which has a bespoke print method, print.sigobj(). For technical reasons an infinite signature is not allowed but is represented internally by a near-infinite integer, specifically .Machine$integer.max:

dput(signature())
## structure(c(2147483647, 0), class = "sigobj")

References

Hankin, R. K. S. 2022a. “A Systematic Search for a Three-Velocity Gyrodistributive Law in Special Relativity with the Lorentz R Package.” arXiv. https://doi.org/10.48550/ARXIV.2212.07005.
———. 2022b. “Clifford Algebra in R.” arXiv. https://doi.org/10.48550/ARXIV.2209.13659.