R order

28 seconds ago by admin

def Up(x): RES=[] for i in range(len(x)): if i+1<x(i+1): RES.append(i+1) return(RES) def Down(x): RES=[] for i in range(len(x)): if i+1>x(i+1): RES.append(i+1) return(RES) 
       
R.<q> = ZZ['q'] 
       
for x in Permutations(7): U=Up(x) D=Down(x) L=x.length() A=2*sum(x(a)-a for a in U) (B,C,E,F)=(0,0,0,0) for a in U: for b in U: if a<b and x(a)>x(b): B=B+1 for b in D: if a>b:E=E+1 if x(a)>x(b): F=F+1 for a in D: for b in D: if a<b and x(a)>x(b): C=C+1 if A-L-F+E+B+C<>0: print x,A-L,-F+E+B+C print "done" 
       
done
done
H=0 for x in Permutations(9): U=Up(x) D=Down(x) L=x.length() A=2*sum(x(a)-a for a in U) (B,C,E,F)=(0,0,0,0) for a in U: for b in U: if a<b and x(a)>x(b): B=B+1 for b in D: if a<b and x(a)>x(b): C=C+1 if b<a and x(b)>x(a): E=E+1 for a in D: for b in D: if a<b and x(a)>x(b): F=F+1 if A-L<>C-B-E-F: print x,A-L,C-B-E-F,C,B,E,F H=H+q^(A-L) print "done" 
       
done
done
H.factor() 
       
(q + 1)^4 * (2*q^16 + 10*q^15 + 40*q^14 + 120*q^13 + 309*q^12 + 670*q^11
+ 1278*q^10 + 2112*q^9 + 3065*q^8 + 3816*q^7 + 4032*q^6 + 3472*q^5 +
2339*q^4 + 1096*q^3 + 286*q^2 + 32*q + 1)
(q + 1)^4 * (2*q^16 + 10*q^15 + 40*q^14 + 120*q^13 + 309*q^12 + 670*q^11 + 1278*q^10 + 2112*q^9 + 3065*q^8 + 3816*q^7 + 4032*q^6 + 3472*q^5 + 2339*q^4 + 1096*q^3 + 286*q^2 + 32*q + 1)
HH=H/(q+1)^4 HH.subs(q=-1) 
       
24
24