
<<cox.m
(*--------------------------Salem part---------------*)
salem = salem12
qs = QEuler[salem]
fs = Mat[salem]
(* twists = AllTwists[salem] *)
twists = {-2 - x + 4*x^2 - x^4, -3*x + x^3, -1 + 5*x - 5*x^3 + x^5}

polys = twists[[2]]
prime = TwistN[fs,polys]
Print[" 			SALEM 12:  Twisting at ",prime]

polys = FixSig[qs,fs,polys]
ps = polys[[1]]
Print["Fixing signature; twist is ",ps] 
qs = QTwist[qs,fs,ps]
charfs = GlueChar[qs,fs,prime]

Print["Salem part: "]
DiGlue[qs,fs,7]

(*--------------------------Cyclotomic part---------------*)
per = GluePeriod[qs,fs,prime]
Print["Gluing to cyclotomic of order ",per]
cyclo = Cyclotomic[per,x]
qc = QEuler[cyclo]
fc  = Mat[cyclo]
(* polyc = PrimeTwists[qc,fc,prime,2]  *)
(* polyc = Select[polyc,GlueChar[QTwist[qc,fc,#],fc,prime]==charfs&] *)
polyc = {4 - x, 5 + 2*x, -4 + x, -5 - 2*x}
pc = polyc[[1]]
qc = QTwist[qc,fc,pc]

Print["Cyclo part: "]
DiF[qc,fc]

(*--------------------------Glue ---------------*)
{qd,fd} = GlueAuto[qs,fs,qc,fc,prime]

Print["\n Result of gluing Salem + cyclo:"]
DiGlue[qd,fd]

(*--------------------------Final pieces ---------------*)
qe = QA[6]
fe = -Id[qe]

{q,f} =  GlueAuto[qd,fd,qe,fe,7]

DiK3[q,f]
