rfalg.RdGenerate random elements of the free algebra, intended as quick
“get you going” examples of freealg objects
rfalg(n=7, distinct=3, maxsize=4, include.negative=FALSE)
rfalgg(n=30, distinct=8, maxsize=7, include.negative=FALSE)
rfalggg(n=100, distinct=26, maxsize=30, include.negative=FALSE)Number of terms to generate
Number of distinct symbols to use
Maximum number of symbols in any word
Boolean, with default FALSE meaning to
use only positive symbols (lower-case letters) and TRUE
meaning to use upper-case letters as well, corresponding to the
inverse of the lower-case symbols
Terms are automatically simplified; for example,
aaBaAbaC will be simplified to aaaC.
Functions rfalgg() and rfalggg() return successively
more complicated freealg objects.
rfalg()
#> free algebra element algebraically equal to
#> + 3a + 4aa + 7ab + 2aba + 5acac + cbab + 6cc
rfalg(include.negative = TRUE)^2
#> free algebra element algebraically equal to
#> + CC + 3CCAAA + 4CBCbC + 7CBc + 2CA + 3CAAAC + 9CAAACAAA + 12CAAABCbC +
#> 21CAAABc + 6CAAAA + 18CAAAba + 15CAAAcAB + 6Cba + 7B + 4BCbCC + 12BCbCCAAA +
#> 16BCbCBCbC + 28BCbCBc + 8BCbCA + 24BCbCba + 20BCbAB + 21BAAA + 28BcBCbC +
#> 49BcBc + 14BcA + 42Bcba + 35BccAB + 2AC + 6ACAAA + 5AB + 8ABCbC + 14ABc + 4AA +
#> 12Aba + 10AcAB + 12b + 6baC + 18baCAAA + 24baBCbC + 42baBc + 36baba + 30bacAB +
#> 30c + 5cABC + 15cABCAAA + 20cABBCbC + 35cABBc + 10cABA + 25cABcAB
constant(rfalg())
#> [1] 0