accessor.RdAccessor methods for free algebra objects
words(x)
coeffs(x, drop=TRUE)
coeffs(x) <- valueObject of class freealg
Numeric vector of length 1
Boolean, with default TRUE meaning to drop the
disord attribute, as per disordR::drop() and
FALSE meaning to consistently return a disord object
irregardless
Access or set the different parts of a freealg object. The
constant term is technically a coefficient but is documented under
constant.Rd.
“Pure” extraction and replacement (as in a[i] and
a[i] <- value is implemented experimentally. The code for
extraction is cute but not particularly efficient.
There is an extended discussion of disordR discipline in the
context of algebras in the mvp package at accessor.Rd.
a <- rfalg()
a
#> free algebra element algebraically equal to
#> + 5a + 6abac + 7ac + acac + 9b
coeffs(a)
#> A disord object with hash e9e1fa682e647dd3331605799e36ce251d5bbb97 and elements
#> [1] 5 6 7 1 9
#> (in some order)
words(a) # NB: hash is identical to that of coeffs(a)
#> A disord object with hash e9e1fa682e647dd3331605799e36ce251d5bbb97 and elements
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 1 2 1 3
#>
#> [[3]]
#> [1] 1 3
#>
#> [[4]]
#> [1] 1 3 1 3
#>
#> [[5]]
#> [1] 2
#>
#> (in some order)
coeffs(a) <- 7 # replacement methods work
a
#> free algebra element algebraically equal to
#> + 7a + 7abac + 7ac + 7acac + 7b
coeffs(a)
#> [1] 7 7 7 7 7