(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



(* ::Input::Initialization:: *)
SetDirectory["C:\\drorbn\\AcademicPensieve\\Projects\\PG"];
Once[<< KnotTheory`];
Ribbons={Knot[0,1],Knot[6,1],Knot[8,8],Knot[8,9],Knot[8,20],Knot[9,27],Knot[9,41],Knot[9,46],Knot[10,3],Knot[10,22],Knot[10,35],Knot[10,42],Knot[10,48],Knot[10,75],Knot[10,87],Knot[10,99],Knot[10,123],Knot[10,129],Knot[10,137],Knot[10,140],Knot[10,153],Knot[10,155]};


(* ::Input::Initialization:: *)
CF=Factor;
Subscript[\[DoubleStruckCapitalE][L_,Q_,P_], $k_]:=\[DoubleStruckCapitalE][L,Q,Series[Normal@P,{\[Epsilon],0,$k}]];
Subscript[Subscript[\[DoubleStruckCapitalE], d_->r_][L_,Q_,P_], $k_]:=Subscript[\[DoubleStruckCapitalE], d->r]@@Subscript[\[DoubleStruckCapitalE][L,Q,P], $k];
\[DoubleStruckCapitalE]3@\[DoubleStruckCapitalE][\[Omega]_,L_,Q_,Ps_]:=CF/@Subscript[\[DoubleStruckCapitalE][L,\[Omega]^-1 Q,\[Omega]^-1 (\[Omega]^-4 \[Epsilon])^(-1+Range@Length@Ps) . Ps], $k];
\[DoubleStruckCapitalE]4@\[DoubleStruckCapitalE][L_,Q_,P_]:=Module[
{\[Omega]=Normal[P]^-1/.\[Epsilon]->0,Ps=CoefficientList[P,\[Epsilon]]},
CF/@\[DoubleStruckCapitalE][\[Omega],L,\[Omega] Q,\[Omega]^(-3+4Range@Length@Ps) Ps]];
\[DoubleStruckCapitalE]3@Subscript[\[DoubleStruckCapitalE], sp___][as___]:=\[DoubleStruckCapitalE]3@\[DoubleStruckCapitalE][as]/.\[DoubleStruckCapitalE]->Subscript[\[DoubleStruckCapitalE], sp];
\[DoubleStruckCapitalE]4@Subscript[\[DoubleStruckCapitalE], sp___][as___]:=\[DoubleStruckCapitalE]4@\[DoubleStruckCapitalE][as]/.\[DoubleStruckCapitalE]->Subscript[\[DoubleStruckCapitalE], sp];


(* ::Input::Initialization:: *)
$k=2;
Clear[QP,\[Omega]];
QP[Knot[n_,k_]] := QP[Knot[n,k]]=Collect[Module[{fname},
fname="Data/"<>ToString[n]<>"_"<>ToString[k]<>".m";
Collect[\[DoubleStruckCapitalE]3[Get[fname][[2,2]]][[3]] // Normal, \[Epsilon], Simplify]
], \[Epsilon], CF];
\[Omega][K_Knot]:=\[Omega][K]=Factor[(QP@K/.\[Epsilon]->0)^-1];
Subscript[c, k_,d_][K_Knot]:=Factor[SeriesCoefficient[QP[K],{y,0,0}, {\[Epsilon],0,k},{a,0,d}]\[Omega][K]^(1+2k-d)]


(* ::Input::Initialization:: *)
\[Rho]1[K_Knot]:=\[Rho]1[K]=Factor[(T(-Subscript[c, 1,0][K]+\[Omega][K]T \!\(
\*SubscriptBox[\(\[PartialD]\), \(T\)]\(\[Omega][K]\)\)))/(T-1)^2];
\[Rho]2[K_Knot]:=\[Rho]2[K]=CF[-2Subscript[c, 2,0][K]+\[Omega][K]Subscript[c, 2,1][K]];
plus[\[ScriptCapitalE]_]:=Expand[\[ScriptCapitalE]]/. T^n_./; n<0 :> 0;


(* ::Input::Initialization:: *)
wc11= SeriesData[\[Epsilon], 0, {1 + a + Rational[1, 2] (-1 - T) - a T + x y, Rational[1, 2] (a + a^2 + a T + a^2 T) + (a x) y}, 1, 3, 1];
wc21= SeriesData[\[Epsilon], 0, {1 + a + Rational[1, 2] (-1 - T) - a T + x y}, 2, 3, 1];
wc22=SeriesData[\[Epsilon], 0, {Rational[1, 4] (1 - 2 T + T^2) + a (1 - 2 T + T^2) + a^2 (1 - 2 T + T^2) + ((a (2 - 2 T)) x) y + x^2 y^2}, 2, 3, 1];
\[Rho]2p[Knot[0,1]]=0;
\[Rho]2p[Knot[n_,k_]]:=Module[{Z,Z0,Z1,Z2,Z3,Z4,Alex,rho2},
Z=\[DoubleStruckCapitalE]3[Get["Data/"<>ToString[n]<>"_"<>ToString[k]<>".m"][[2,2]]];
Z0=Z[[3]];
Alex=(Normal[Z0]/.\[Epsilon]->0)^-1;
Z1=Z0 *Alex//CF;
Z2=Z1-Coefficient[Z1,y x \[Epsilon]]wc11//CF;
Z3=(Z2-Coefficient[Z2,y^2 x^2 \[Epsilon]^2]wc22)//CF;
Z4=Z3-Coefficient[Z3,y x \[Epsilon]^2]wc21//CF;
rho2=4((-1+T)^2/T)^-1 Alex^4 (Z4[[3,3]]-Z4[[3,2]]^2/2)//Together//Expand;
Last@Last@CoefficientRules[rho2,T^-1]]


(* ::Input::Initialization:: *)
Clear[LogP];
LogP[Knot[n_,k_]] := LogP[Knot[n,k]]=Collect[Module[{fname},
fname="../../Projects/SL2Invariant/k=2/Data/"<>ToString[n]<>"_"<>ToString[k]<>".m";
Collect[\[Omega][Knot[n,k]]*\[DoubleStruckCapitalE]3[Get[fname][[2,2]]][[3]] //Log// Normal, \[Epsilon], Simplify]
], \[Epsilon], CF];


(* ::Input::Initialization:: *)
pmrule={"+"->"\\!+\\!", "-"->"\\!-\\!"};
KnotLine[K_] := StringReplace["\\rolcell{n_k}{n^t_{k}}{\[Omega]}{\[Rho]1p}{\[Rho]2p}{G}{U}{R}{C}", {
"n" -> ToString@K[[1]],
"k" -> ToString@K[[2]],
"t" -> If[AlternatingQ[K], "a", "n"],
"\[Omega]"-> StringReplace[ToString[plus@\[Omega][K], FormatType -> TeXForm],pmrule],
"\[Rho]1p"->  StringReplace[ToString[plus@\[Rho]1[K], FormatType -> TeXForm],pmrule],
"\[Rho]2p"->  StringReplace[ToString[\[Rho]2p[K], FormatType -> TeXForm],pmrule],
"G" -> ToString@ThreeGenus@K,
"U" -> ToString@UnknottingNumber@K,
"R" -> If[MemberQ[Ribbons, K], "\\gY", "\\N"],
"C" -> If[MemberQ[{FullyAmphicheiral, NegativeAmphicheiral, ""}, SymmetryType@K], "\\oY", "\\N"]
}]


(* ::Input::Initialization:: *)
Make[range_]:=Make[range,2];
Make[range_,col_] := StringJoin@@Table[
StringJoin[StringJoin@@Riffle[L, " &\n"], " \\\\\n\\hline\n"],
{L, Partition[KnotLine /@ AllKnots[range], UpTo@col]}
];
Make[{0,6},3]



