Ask Your Question
0

How to generate this map in sage

asked 2024-03-26 04:07:33 +0100

babyturtle gravatar image

updated 2024-03-26 05:44:23 +0100

Okay this is my code so far.

F.<x,y,z> = FreeGroup()
A = F.algebra(QQ)
Y = A(y)
Yinv = A(y^-1)
Z = A(z)
Z2 = A(Z)
X = A(x)
X2 = A(X)
X2inv = A(X^-1)
Xinv = A(x^-1)
Y2 = A(Y)

def functionMap(X,Y,Z,Xinv):
    X = A(X2 * Y2 * X2inv)
    Y = A(X2 * Z2 * X2inv)
    Z = A((Z2 * Y2 + 1)*X2inv)
    print(X)
    print(Y)
    print(Z)
    X2 = A(X)
    X2inv = A(X2^-1)
    Y2 = A(Y)
    Z2 = A(Z)


for i in range(6): 
    functionMap(X,Y,Z,Xinv)

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)

edit retag flag offensive close merge delete

Comments

okay wow that formatted terriably lemme do this.

    F.<x,y,z> = FreeGroup()
A = F.algebra(QQ)
Y = A(y)
Yinv = A(y^-1)
Z = A(z)
Z2 = A(Z)
X = A(x)
X2 = A(X)
X2inv = A(X^-1)
Xinv = A(x^-1)
Y2 = A(Y)

def functionMap(X,Y,Z,Xinv):
    X = A(X2 * Y2 * X2inv)
    Y = A(X2 * Z2 * X2inv)
    Z = A((Z2 * Y2 + 1)*X2inv)
    print(X)
    print(Y)
    print(Z)
    X2 = A(X)
    X2inv = A(X2^-1)
    Y2 = A(Y)
    Z2 = A(Z)


for i in range(6): 
    functionMap(X,Y,Z,Xinv)
babyturtle gravatar imagebabyturtle ( 2024-03-26 04:08:39 +0100 )edit

Your function has no return anywhere. You should rather make a function taking a triple as input and returning a triple.

FrédéricC gravatar imageFrédéricC ( 2024-03-26 09:12:17 +0100 )edit

The given function does not use its arguments but rather overwrites them with new values. Is that intended?

Max Alekseyev gravatar imageMax Alekseyev ( 2024-03-26 22:29:18 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2024-03-26 20:38:59 +0100

FrédéricC gravatar image

Here is a proposal, but not what you expect, I guess :

sage: A = algebras.Free(QQ,list('XYZ'),degrees=(1,1,1))
sage: Ahat = A.completion()
sage: A.inject_variables()
sage: x=Ahat(1+X)
sage: y=Ahat(1+Y)
sage: z=Ahat(1+Z)

At this stage, we have 3 invertible non-commutative elements.

sage: def mymap(vx,vy,vz):
....:     return vx*vy*~vx, vx*vz*~vx, (vz*vy+1)*~vx
sage: mymap(x,y,z)
(1 + Y + (X*Y-Y*X) + (-X*Y*X+Y*X^2) + (X*Y*X^2-Y*X^3) + (-X*Y*X^3+Y*X^4) + (X*Y*X^4-Y*X^5) + O^7,
 1 + Z + (X*Z-Z*X) + (-X*Z*X+Z*X^2) + (X*Z*X^2-Z*X^3) + (-X*Z*X^3+Z*X^4) + (X*Z*X^4-Z*X^5) + O^7,
 2 + (-2*X+Y+Z) + (2*X^2-Y*X-Z*X+Z*Y) + (-2*X^3+Y*X^2+Z*X^2-Z*Y*X) + (2*X^4-Y*X^3-Z*X^3+Z*Y*X^2) + (-2*X^5+Y*X^4+Z*X^4-Z*Y*X^3) + (2*X^6-Y*X^5-Z*X^5+Z*Y*X^4) + O^7)

This requires a very recent version of sage.

edit flag offensive delete link more

Comments

Why does this not work? I don't really understand how this works...but I tried copying what you had to suit my needs.

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))
babyturtle gravatar imagebabyturtle ( 2024-04-30 00:54:25 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2024-03-26 04:07:33 +0100

Seen: 269 times

Last updated: Mar 26