# Revision history [back]

Here is a code based on my answer to your earlier question:

F.<x,y,z> = FreeGroup()
A = F.algebra(QQ)
X = A(x)
Y = A(y)
Z = A(z)

# invert given element q
def myinv(q):
L = [(t,c) for t,c in q]
if len(L)!=1:
raise ValueError(f'Unable to invert {q}')
return A(L[0][0]^(-1)) / L[0][1]

# Define the mapping function
def mymap(vx, vy, vz):
return (vx * vy * myinv(vx), vx * vz * myinv(vx), (vz * vy + 1) * myinv(vx))

t = (X,Y,Z)
for i in range(6):
t = mymap(*t)
print(f'Iteration {i+1}: {t}')


It produces 3 iterations of mymap:

Iteration 1: (x*y*x^-1, x*z*x^-1, x^-1 + z*y*x^-1)
Iteration 2: (x*y*z*y^-1*x^-1, x*y*x^-1*y^-1*x^-1 + x*y*x^-1*z*x^-1, x*y^-1*x^-1 + z*y^-1*x^-1 + z*y*z*y^-1*x^-1)
Iteration 3: (x*y*z*x^-1*z^-1*y^-1*x^-1 + x*y*z*x^-1*z*y*z^-1*y^-1*x^-1, x*y*z*(y^-1*x^-1)^2 + x*y*z*y^-1*x^-1*z*x^-1 + x*y*z*y^-1*z^-1*y^-1*x^-1, z^-1*y^-1*x^-1 + x*y*z^-1*y^-1*x^-1 + z*x^-1*z^-1*y^-1*x^-1 + z*y*z^-1*y^-1*x^-1 + z*x^-1*z*y*z^-1*y^-1*x^-1 + z*y*z*x^-1*z^-1*y^-1*x^-1 + z*y*z*x^-1*z*y*z^-1*y^-1*x^-1)


Then, however, it fails with the error:

ValueError: Unable to invert xyzx^-1z^-1y^-1x^-1 + xyzx^-1zyz^-1y^-1x^-1

and it is what it is - I do not know how to invert x*y*z*x^-1*z^-1*y^-1*x^-1 + x*y*z*x^-1*z*y*z^-1*y^-1*x^-1.

Here is a code based on my answer to your earlier question:

F.<x,y,z> = FreeGroup()
A = F.algebra(QQ)
X = A(x)
Y = A(y)
Z = A(z)

# invert given element q
def myinv(q):
L = [(t,c) for t,c in q]
if len(L)!=1:
raise ValueError(f'Unable to invert {q}')
return A(L[0][0]^(-1)) / L[0][1]

# Define the mapping function
def mymap(vx, vy, vz):
return (vx * vy * myinv(vx), vx * vz * myinv(vx), (vz * vy + 1) * myinv(vx))

t = (X,Y,Z)
for i in range(6):
t = mymap(*t)
print(f'Iteration {i+1}: {t}')


It produces 3 iterations of mymap:

Iteration 1: (x*y*x^-1, x*z*x^-1, x^-1 + z*y*x^-1)
Iteration 2: (x*y*z*y^-1*x^-1, x*y*x^-1*y^-1*x^-1 + x*y*x^-1*z*x^-1, x*y^-1*x^-1 + z*y^-1*x^-1 + z*y*z*y^-1*x^-1)
Iteration 3: (x*y*z*x^-1*z^-1*y^-1*x^-1 + x*y*z*x^-1*z*y*z^-1*y^-1*x^-1, x*y*z*(y^-1*x^-1)^2 + x*y*z*y^-1*x^-1*z*x^-1 + x*y*z*y^-1*z^-1*y^-1*x^-1, z^-1*y^-1*x^-1 + x*y*z^-1*y^-1*x^-1 + z*x^-1*z^-1*y^-1*x^-1 + z*y*z^-1*y^-1*x^-1 + z*x^-1*z*y*z^-1*y^-1*x^-1 + z*y*z*x^-1*z^-1*y^-1*x^-1 + z*y*z*x^-1*z*y*z^-1*y^-1*x^-1)


Then, however, it fails with the error:

ValueError: Unable to invert xyzx^-1z^-1y^-1x^-1 + xyzx^-1zyz^-1y^-1x^-1 
x*y*z*x^-1*z^-1*y^-1*x^-1 + x*y*z*x^-1*z*y*z^-1*y^-1*x^-1 

and it is what it is - I do not know how to invert x*y*z*x^-1*z^-1*y^-1*x^-1 + x*y*z*x^-1*z*y*z^-1*y^-1*x^-1.