Ask Your Question

Revision history [back]

How to generate map in sage

As you can see, I'm trying to repeatedly take the map x,y,z to xyx^-1, xzx^-1, (zy+1)x^-1 repeatedly. I'm getting a lot of errors though. Does anyone know how to fix my code? I think It might have something to do with the multiple variables calling the symbol 'x' but idk how else to not cause issues when I'm doing the three different parts of my map (like if I change X then the middle part has the wrong iteration of x).

That was my old question and someone gave me a response and I updated my code. I don't get why my new code doesn't work. If anyone knows how to fix it, or tell me another way to this please let me know! A = algebras.Free(QQ, list('XYZ'), degrees=(1,1,1)) Ahat = A.completion() A.inject_variables()

# Define elements x, y, and z
a = Ahat(X)
b = Ahat(Y)
c = Ahat(Z)

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

# Apply the mapping function with the generators X, Y, and Z
print(mymap(a, b, c))

How to generate map in sage

As you can see, I'm trying to repeatedly take the map x,y,z to xyx^-1, xzx^-1, (zy+1)x^-1 repeatedly. I'm getting a lot of errors though. Does anyone know how to fix my code? I think It might have something to do with the multiple variables calling the symbol 'x' but idk how else to not cause issues when I'm doing the three different parts of my map (like if I change X then the middle part has the wrong iteration of x).

x).

That was my old question and someone gave me a response and I updated my code. I don't get why my new code doesn't work. If anyone knows how to fix it, or tell me another way to this please let me know!

A = algebras.Free(QQ, list('XYZ'), degrees=(1,1,1))
 Ahat = A.completion()
    A.inject_variables()

A.inject_variables()

# Define elements x, y, and z
a = Ahat(X)
b = Ahat(Y)
c = Ahat(Z)

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

# Apply the mapping function with the generators X, Y, and Z
print(mymap(a, b, c))