RobinHankin / freegroup

The free group in R
0 stars 0 forks source link

bug in permsymb() #27

Closed RobinHankin closed 4 years ago

RobinHankin commented 4 years ago

Look:

> (M <- matrix(c(1,2,4,3,1,3,2,4),2,4))
     [,1] [,2] [,3] [,4]
[1,]    1    4    1    2
[2,]    2    3    3    4
> f <- function(a){M[,a]}
> permsymb(as.free("abcd"),f)
[1] a.d.a.b b.c^2.d
> permsymb(as.free("a"),f)
[1] a.b

(the bug is actually in permsymb_single_X()). Note that function f() is not invertible, although I don't think this matters. The two calls to permsymb() should both return a length-two vector, and the first one does so. But the second one is incorrect: it should return something like c(as.free("a"),as.free("b")) (which is length two) but actually returns as.free("ab"), which is length one.