Skip to contents

Creates a vector of random free objects. Intended as a quick “get you going” example of free group objects

Usage

rfree(n = 7, size = 4, number = size, powers = seq(from = -size, to = size))
rfreee(n = 30, size = 8, number = size, powers = seq(from = -size, to = size))
rfreeee(n = 40, size = 25, number = size, powers = seq(from = -size, to = size))

Arguments

n

Length of random vector to generate

size

Maximum length of each element

number

How many distinct letters to sample from

powers

Powers in resulting polynomial. An integer n is interpreted (via sample()) as seq_len(n)

Details

The auxiliary arguments specify the general complexity of the returned object with small meaning simpler.

Functions rfreee() and rfreeee() give, by default, successively more complicated expressions.

Author

Robin K. S. Hankin

See also

Examples


rfree()
#> [1] b^-3.a^-4           c.b^4.a^-2.c^-2     a^-3.c^-1.a^-2     
#> [4] a^2.c^-1.d^-4       d^-3.c^-2.a^-1.c^-1 b^3.a^6            
#> [7] a                  

abelianize(rfree())
#> [1] a^3.b^4.c^-3 a^3.b^4.d^3  a^2.c^-4     c^4.d^-6     a^-1.d^3    
#> [6] a^3.c        a^4.c^-4.d  

rfree(10,2)
#>  [1] a^-1.b    0         a^2       a^-2      a^-1      0         a^-1.b^-2
#>  [8] b^-1      a^-1      b^-1     
rfree(10,30,26)
#>  [1] y^-21.r^5.b^28.w^20.x^-21.l^14.j^-27.n^-18.a^-29.v^-23.i^16.u^30.y^-5.x^-23.f^10.h^-30.q^-8.h^-2.t^-6.k^-2.y.p^29.b^4.w^-10.g^-5.j^12.y^-2.z^-19.h^4       
#>  [2] w^-8.h^-9.a.k^29.u^20.j^-27.b^-25.n^-6.r^20.u^-12.p^-7.a^18.c^-4.i^-20.h^23.j^7.d^23.s^-15.z^27.o^-28.s^27.f^21.x^-16.f^4.e^8.c^-22.t^26                   
#>  [3] b^-19.g^17.n^12.u^-3.r^-16.w^-4.v^-20.t^12.o^-21.m^-19.i.q^-24.j^-10.n^8.r^-20.f^-13.c^-20.x^7.r^20.v^27.c^-20.j^-30.f^-18.d^-8.y^16.v^25.m^-26            
#>  [4] n^25.j^-25.h^27.q^16.e^8.s^-26.l^-14.i^-16.a^-7.y^-13.l^27.i^4.r^-11.w^22.n^-13.e^9.d^-1.k^4.z^18.x^-3.y^9.a^9.l^-13.y^19.c^23.v^-4.z^14.f^-10.h^-27.l^-20 
#>  [5] q^11.z^-5.k^27.w^-21.e^26.h^-9.v^-12.k^28.v^-11.x^20.n^11.k^27.q^2.k^-2.b^9.y^-12.v^30.k^-40.c^-25.v^23.k^25.t^-22.r^-19.x^-6.i^11.y^-27.e^-4.h^-29.a^28   
#>  [6] k^-25.h^-17.k^-26.g^-10.s^-25.f^-25.h^7.f^-20.b^24.m.l^19.s^-4.o^24.m^-13.b^-6.x^10.f^-15.v^-20.z^19.u^21.g^-3.b^14.r^8.u^22.c^-8.o^9.l^-20.q^11.i^28.t^-19
#>  [7] i^-1.p^-17.x^10.j^7.k^-8.i^23.x^-30.k^-5.z^-23.j^17.d^7.u^-4.j^-8.b^25.n^-8.c^-12.i^9.v^-7.a^-29.e^-11.r^-20.l^-18.f^-5.i^-17.l^-11.b^-6.k^16.n^-2.s^-10   
#>  [8] r^13.q^-13.t^19.f^8.b^-27.j^26.w^-4.g^19.r^-10.n^3.y^-14.d^25.b^19.l^-13.a^-13.t^-25.s^-13.e^-21.s^-9.r^-8.d^3.m^-21.h^-16.x^27.k^18.b^27.g^22.q^-19       
#>  [9] y^-11.a^8.h^24.v^-18.k^-13.y^24.f^21.x^5.m^9.e^-2.r^30.b^20.v^17.m^30.f^-3.m^30.l^-7.r^13.i^-13.c^18.n^28.i^14.q^8.j^-24.o^8.v^-24.f^-23.c^-15             
#> [10] q^6.l^-27.t^26.q^10.t^20.h^-1.w^-12.n^13.t^-6.h.d^-26.r^21.u^28.e^-5.x^-7.n^-23.j^3.q^-6.y^-4.u^23.k^-30.o^17.t^20.w^-13.h^21.c^26.i^11.w^-4.d^10.w^-29    

rfree(powers=5)
#> [1] d^6.a^4.d^4   a^4.b^8.c^5   d.b^4.a^5.b^2 b.c.d^5.c^3   c^8.b^2.c^4  
#> [6] a^6.c^3.d^4   c^5.d^5.a.d^5
rfree(powers=5:6)
#> [1] d^11.a^10       a^5.c^5.a^6.b^6 c^12.a^6.d^6    a^5.b^5.d^5.b^6
#> [5] d^5.a^12.d^6    d^6.a^6.d^6.c^6 c^5.d^6.c^6.b^5

rfree(20,2)^alpha(26)
#>  [1] z^-1.b.a.z       z^-1.a^2.b^-2.z  z^-1.a^3.z       0               
#>  [5] z^-1.a^-1.z      0                z^-1.b^-2.z      z^-1.a^3.z      
#>  [9] z^-1.a.b^2.z     z^-1.b^-2.z      z^-1.a^-3.z      z^-1.b^-2.a^-2.z
#> [13] z^-1.a.b^2.z     z^-1.a^-3.z      z^-1.b^-2.a^2.z  0               
#> [17] z^-1.b^-1.z      0                z^-1.a^2.b^-2.z  z^-1.a^3.z