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
#> + a + 2aa + 5ab + 3acac + 6b + 7c + 4cc
rfalg(include.negative = TRUE)^2
#> free algebra element algebraically equal to
#> + CC + 3CBCbC + 6CBc + 2CA + 7CaBBB + 5Cba + 6B + 3BCbCC + 9BCbCBCbC + 18BCbCBc
#> + 6BCbCA + 21BCbCaBBB + 15BCbCba + 12BCbAB + 14BBB + 18BcBCbC + 36BcBc + 12BcA
#> + 42BcaBBB + 30Bcba + 24BccAB + 2AC + 4AB + 6ABCbC + 12ABc + 4AA + 10Aba +
#> 8AcAB + 7aBBBC + 21aBBBBCbC + 42aBBBBc + 14aBBBA + 49aBBBaBBB + 28aBBBcAB +
#> 35aBBa + 10b + 5baC + 15baBCbC + 30baBc + 35baaBBB + 25baba + 20bacAB + 20c +
#> 4cABC + 12cABBCbC + 24cABBc + 8cABA + 28cABaBBB + 16cABcAB
constant(rfalg())
#> [1] 0