(* ::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\\HigherRank"];
Once[<<KnotTheory`; <<Rot.m];
<< FormalGaussianIntegration.m;


(* ::Input::Initialization:: *)
T2z[p_]:=Module[{q=Expand[p],n,c},
If[q===0,0,c=Coefficient[q,T,n=Exponent[q,T]];c z^(2n)+T2z[q-c (T^(1/2)-T^(-1/2))^(2n)]]];


(* ::Input::Initialization:: *)
\[ScriptCapitalS]={Subscript[x, _],Subscript[p, _]};
q[s_,i_,j_]:=Subscript[x, i] (Subscript[p, i+1]-Subscript[p, i])+Subscript[x, j] (Subscript[p, j+1]-Subscript[p, j])+(T^s-1)Subscript[x, i](Subscript[p, i+1]-Subscript[p, j+1]);
Subscript[r, 1][s_,i_,j_]:=s/2 (Subscript[x, i](Subscript[p, i]-Subscript[p, j])((T^s-1)Subscript[x, i] Subscript[p, j]+2(1-Subscript[p, j] Subscript[x, j]))-1);
Subscript[r, 2][1,i_,j_]:=(-6 Subscript[p, i] Subscript[x, i]+6 Subscript[p, j] Subscript[x, i]-3 (-1+3 T) Subscript[p, i] Subscript[p, j] \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\)+3 (-1+3 T) \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\)+4 (-1+T) \!\(\*SubsuperscriptBox[\(p\), \(i\), \(2\)]\) Subscript[p, j] \!\(\*SubsuperscriptBox[\(x\), \(i\), \(3\)]\)-2 (-1+T) (5+T) Subscript[p, i] \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(3\)]\)+2 (-1+T) (3+T) \!\(\*SubsuperscriptBox[\(p\), \(j\), \(3\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(3\)]\)+18 Subscript[p, i] Subscript[p, j] Subscript[x, i] Subscript[x, j]-18 \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) Subscript[x, i] Subscript[x, j]-6 \!\(\*SubsuperscriptBox[\(p\), \(i\), \(2\)]\) Subscript[p, j] \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\) Subscript[x, j]+6 (2+T) Subscript[p, i] \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\) Subscript[x, j]-6 (1+T) \!\(\*SubsuperscriptBox[\(p\), \(j\), \(3\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\) Subscript[x, j]-6 Subscript[p, i] \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) Subscript[x, i] \!\(\*SubsuperscriptBox[\(x\), \(j\), \(2\)]\)+6 \!\(\*SubsuperscriptBox[\(p\), \(j\), \(3\)]\) Subscript[x, i] \!\(\*SubsuperscriptBox[\(x\), \(j\), \(2\)]\))/12;
Subscript[r, 2][-1,i_,j_]:=(-6 T^2 Subscript[p, i] Subscript[x, i]+6 T^2 Subscript[p, j] Subscript[x, i]+3 (-3+T) T Subscript[p, i] Subscript[p, j] \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\)-3 (-3+T) T \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\)-4 (-1+T) T \!\(\*SubsuperscriptBox[\(p\), \(i\), \(2\)]\) Subscript[p, j] \!\(\*SubsuperscriptBox[\(x\), \(i\), \(3\)]\)+2 (-1+T) (1+5 T) Subscript[p, i] \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(3\)]\)-2 (-1+T) (1+3 T) \!\(\*SubsuperscriptBox[\(p\), \(j\), \(3\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(3\)]\)+18 T^2 Subscript[p, i] Subscript[p, j] Subscript[x, i] Subscript[x, j]-18 T^2 \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) Subscript[x, i] Subscript[x, j]-6 T^2 \!\(\*SubsuperscriptBox[\(p\), \(i\), \(2\)]\) Subscript[p, j] \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\) Subscript[x, j]+6 T (1+2 T) Subscript[p, i] \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\) Subscript[x, j]-6 T (1+T) \!\(\*SubsuperscriptBox[\(p\), \(j\), \(3\)]\) \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\) Subscript[x, j]-6 T^2 Subscript[p, i] \!\(\*SubsuperscriptBox[\(p\), \(j\), \(2\)]\) Subscript[x, i] \!\(\*SubsuperscriptBox[\(x\), \(j\), \(2\)]\)+6 T^2 \!\(\*SubsuperscriptBox[\(p\), \(j\), \(3\)]\) Subscript[x, i] \!\(\*SubsuperscriptBox[\(x\), \(j\), \(2\)]\))/(12T^2);
Subscript[\[Gamma], 1][\[CurlyPhi]_,k_]:=\[CurlyPhi](1/2-Subscript[x, k] Subscript[p, k]);
Subscript[\[Gamma], 2][\[CurlyPhi]_,k_]:=-\[CurlyPhi]^2 Subscript[p, k]Subscript[x, k]/2;
\[ScriptCapitalL][Subscript[X, i_,j_][s_]]:=T^(s/2) \[DoubleStruckCapitalE][q[s,i,j]+\[Epsilon] Subscript[r, 1][s,i,j]+\[Epsilon]^2 Subscript[r, 2][s,i,j]+O[\[Epsilon]]^3];
\[ScriptCapitalL][Subscript[C, k_][\[CurlyPhi]_]]:=T^(\[CurlyPhi]/2) \[DoubleStruckCapitalE][-Subscript[x, k](Subscript[p, k]-Subscript[p, k+1])+\[Epsilon] Subscript[\[Gamma], 1][\[CurlyPhi],k]+\[Epsilon]^2 Subscript[\[Gamma], 2][\[CurlyPhi],k]+O[\[Epsilon]]^3];
\[ScriptCapitalL][K_]:=(2\[Pi])^-Features[K][[1]] CF[\[ScriptCapitalL]/@Features[K][[2]]];
vs[K_] := Union@@Table[{Subscript[p, i],Subscript[x, i]},{i,Features[K][[1]]}]



