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
#> + 5accc + 2ba + 4c + ca + 7cbcb + 6cc + 3cca
coeffs(a)
#> A disord object with hash b37c1cae575a974384930b7e603f8638f2840c9e and elements
#> [1] 5 2 4 1 7 6 3
#> (in some order)
words(a) # NB: hash is identical to that of coeffs(a)
#> A disord object with hash b37c1cae575a974384930b7e603f8638f2840c9e and elements
#> [[1]]
#> [1] 1 3 3 3
#>
#> [[2]]
#> [1] 2 1
#>
#> [[3]]
#> [1] 3
#>
#> [[4]]
#> [1] 3 1
#>
#> [[5]]
#> [1] 3 2 3 2
#>
#> [[6]]
#> [1] 3 3
#>
#> [[7]]
#> [1] 3 3 1
#>
#> (in some order)
coeffs(a) <- 7 # replacement methods work
a
#> free algebra element algebraically equal to
#> + 7accc + 7ba + 7c + 7ca + 7cbcb + 7cc + 7cca
coeffs(a)
#> [1] 7 7 7 7 7 7 7