




(* This file computes the matrix generators of
the group Gamma(4,n) in general, and
Gamma(4,7) in particular.   The matrices are

M1,  M2,  M3.

They are the matrix representatives of the elements
I1,I2,I3 defined in the paper.  First we load in a
file which has some hermitian linear algebra
routines in it.*)

<<complex_algebra


(*Here are the matrices which are
the generators of an isosceles triangle group.
The parameters r,s,t are left free. Choosing
these parameters specifies the group.*)

Clear[t];
v2={-r,0,1}
v3={r,0,1}
v1={I r  s, t,1}

c1=ComplexExpand[CROSS[v2,v3]];
c2=ComplexExpand[CROSS[v3,v1]];
c3=ComplexExpand[CROSS[v1,v2]];

I1[z_]:=Inv[c1,z];
I2[z_]:=Inv[c2,z];
I3[z_]:=Inv[c3,z];

M1={I1[e1],I1[e2],I1[e3]}
M2={I2[e1],I2[e2],I2[e3]}
M3={I3[e1],I3[e2],I3[e3]}
M1=ComplexExpand[Simplify[Transpose[M1]]];
M2=ComplexExpand[Simplify[Transpose[M2]]];
M3=ComplexExpand[Simplify[Transpose[M3]]];


(****here are s and t in terms of r[n].  For us,
the main case of interest is n=7*)

rr[n_]:=Sqrt[(Sqrt[2] Cos[Pi/n]-1)/(Sqrt[2] Cos[Pi/n]+1)]
s = Sqrt[1 - 2*r^2 - r^4]/Sqrt[1 + 2*r^2 - r^4]
t = Sqrt[2]*Sqrt[-((r^2 + r^4)/(-1 - 2*r^2 + r^4))]

(*Here we  take n=7.*)
r=N[rr[7],30]




(* the triangle *)
a=DOT[v1,v2] DOT[v3,v1]
a6=Power[a,1/6]
w1= v1;
w2= a6 v2;
w3= Conjugate[a6] v3;
w1=w1/Sqrt[-DOT[w1,w1]];
w2=w2/Sqrt[-DOT[w2,w2]];
w3=w3/Sqrt[-DOT[w3,w3]];
Q12=w3;
Q13=w2;
Q23=w1;






(*The triangls is used to define the matrix K*)
A1={w1,w2,w3};
A2={w2,w3,w1};
A3=Inverse[A1].A2
J3=Transpose[A3]; (*w1->w2->w3->w1*)
K=-Inverse[J3.M2];
KInverse=-J3.M2;






(* Here are verious relations you can check: *)
R0=Chop[K.K.K+ I2.I1.I3];
R1=Chop[M1.M1];
R2=Chop[M2.M2];
R3=Chop[M3.M3];
R4=Chop[M1.M2.M1.M2.M1.M2.M1.M2];
R5=Chop[M2.M3.M2.M3.M2.M3.M2.M3];
R6=Chop[M3.M1.M3.M1.M3.M1.M3.M1];
R7=Chop[(X=M1.M2.M1.M3;X.X.X.X.X.X.X)];
R8=Chop[(X=M2.M3.M2.M1;X.X.X.X.X.X.X)];
R9=Chop[(X=M3.M1.M3.M2;X.X.X.X.X.X.X)];
R10=DOT[w1,w1];
R11=DOT[w2,w2];
R12=DOT[w3,w3];
R13=DOT[w1,w2]-DOT[w2,w3];
R14=DOT[w2,w3]-DOT[w3,w1];
R15=DOT[w3,w1]-DOT[w1,w2];


