﻿(* arXiv:1410.8236 *)
(* B.4. Ex.1 *)
(* notation
   rnk[n,k]  : r_{n,k}^{X,\mathcal{D}}
   qpoch[a,n]: (a;q)_n
   b4        : b_4
   s1        : \sigma_1
   s2        : \sigma_2
   sp1       : \sigma'_1
   sp2       : \sigma'_2
*)

qpoch[a_,n_]:=Product[1-a q^i,{i,0,n-1}];

rnk[n_,2]:=q^(3/2)(1-s2^(-1) sp2 q^2)*
           qpoch[b4 q^(n-1),2]*
           qpoch[s2 q^(n-2),1]/
           (2(1+q)qpoch[b4 q^(2n-1),4]qpoch[s2 q^n,1]);
rnk[n_,-2]:=qpoch[q^(n-1),2](1-s2^(-1) sp2 q^2)*
            qpoch[s2 q^(n-2),2]*
            qpoch[sp2 q^(n-2),1] qpoch[sp2 q^(n+1),1]*
            qpoch[a1 a3 q^(n-2),2]qpoch[a1 a4 q^(n-2),2]*
            qpoch[a2 a3 q^(n-2),2]qpoch[a2 a4 q^(n-2),2]/
            (2(1+q)q^(1/2)qpoch[b4 q^(2n-4),4]);
rnk[n_,1]:=-q^(-1/2) qpoch[b4 q^(n-1),1]*
           qpoch[s2 q^(n-2),1]qpoch[sp2 q^(n+1),1]/
           (2s2 qpoch[b4 q^(2n-2),3]qpoch[b4 q^(2n+2),1])*
       (q(b4 q^(2n)+1)(q s1(1-sp2)+sp1(s2-q^2))
        -(1+q^2)q^n(s1 sp2(s2-q^2)+sp1 s2 q(1-sp2)));
rnk[n_,-1]:=-q^(-5/2)(1-q^n)qpoch[s2 q^(n-2),2]*
           qpoch[sp2 q^(n-1),1]qpoch[sp2 q^(n+1),1]*
           qpoch[a1 a3 q^(n-1),1]qpoch[a1 a4 q^(n-1),1]*
           qpoch[a2 a3 q^(n-1),1]qpoch[a2 a4 q^(n-1),1]/
           (2s2 qpoch[b4 q^(2n-4),1]qpoch[b4 q^(2n-2),3])*
       ((b4 q^(2n)+q^2)(q s1(1-sp2)+sp1(s2-q^2))
        -(1+q^2)q^n(s1 sp2(s2-q^2)+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