# How to simplify non-commutative expressions

So I want to somehow simplify terms like y(y+1)y^-1. These symbols are not commutative so this is a special case where when you expand the y and y^-1 cancel and you are left with (y+1). How do I do this kind of simplification for much larger and uglier expressions. Specifically, I'm trying to simplify stuff from the map x,y,z to xyx^-1, yzy^-1, yz(y+1) repeated over and over again.

edit retag close merge delete

Sort by ยป oldest newest most voted

Here a possible approach via an algebra over the free group:

F.<yy> = FreeGroup()
A = F.algebra(QQ)
y = A(yy)
yinv = A(yy^-1)
print( y*(y+1)*yinv )

more

Here is one tedious way, where we have to homogenize to use the letterplace implementation:

sage: F.<Y,YINV,ONE1,ONE2> = FreeAlgebra(QQ, implementation='letterplace', degrees=[1,1,1,2])
sage: R.<y,yinv,one1,one2> = F.quotient(F*[Y*YINV - ONE2, YINV*Y - ONE2, ONE1*ONE1 - ONE2, Y*ONE1 - ONE1*Y, ONE1*YINV - YINV*ONE1]*F)
sage: y*(y+one1)*yinv
one2*y + one2*one1


If you squint, this is y + 1.

more