# Root's independent check of A6-6: W(E6)-conjugacy of rho-9w1-3w6 and rho-9w1, and non-conjugacy under W_X = S3.
# Bourbaki E6: chain 1-3-4-5-6, node 2 attached to 4. Weights in fundamental-weight coordinates.
A=[[2,0,-1,0,0,0],[0,2,0,-1,0,0],[-1,0,2,-1,0,0],[0,-1,-1,2,-1,0],[0,0,0,-1,2,-1],[0,0,0,0,-1,2]]
def refl(c,j):  # s_j(lambda) = lambda - <lambda, alpha_j^vee> alpha_j ; alpha_j = row j of A in fundamental-weight coords
    return [c[i]-c[j]*A[j][i] for i in range(6)]
def dominant(c):
    c=list(c); word=[]
    while True:
        neg=[j for j in range(6) if c[j]<0]
        if not neg: return c,word
        j=neg[0]; c=refl(c,j); word.append(j+1)
l1=[-8,1,1,1,1,-2]; l2=[-8,1,1,1,1,1]
d1,w1=dominant(l1); d2,w2=dominant(l2)
print('dominant(rho-9w1-3w6) =',d1,' word length',len(w1))
print('dominant(rho-9w1)     =',d2,' word length',len(w2))
print('W-conjugate:',d1==d2)
# W_X = S3 on log-coordinates (log_q u, log_q v): s1:(u,v)->(u^-1,uv), s6:(u,v)->(uv,v^-1)
def orbit(p):
    seen={p}; todo=[p]
    while todo:
        a,b=todo.pop()
        for q in [(-a,a+b),(a+b,-b)]:
            if q not in seen: seen.add(q); todo.append(q)
    return seen
o1=orbit((-5,1)); o2=orbit((-5,4))
print('W_X orbit of y1:',sorted(o1)); print('W_X orbit of y2:',sorted(o2)); print('disjoint:',not (o1&o2))
# separating function M_(3,0): (a,b) -> exponent c1=(2a+b)/3 on u, c6=(a+2b)/3 on v ; orbit of (3,0) = {(3,0),(-3,3),(0,-3)}
def M30(lu,lv):
    return sorted([ ( (2*a+b)//3)*lu + ((a+2*b)//3)*lv for (a,b) in [(3,0),(-3,3),(0,-3)] ])
print('exponents of q in M_(3,0)(y1):',M30(-5,1),' (y2):',M30(-5,4))
