(* ::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\\Talks\\Groningen-240530"];


(* ::Input::Initialization:: *)
Once[<<KnotTheory`; <<Rot.m];


(* ::Input::Initialization:: *)
CF[\[Omega]_. \[ScriptCapitalE]_\[DoubleStruckCapitalE]]:=CF[\[Omega]]CF/@\[ScriptCapitalE];
CF[\[ScriptCapitalE]_List]:=CF/@\[ScriptCapitalE];
CF[\[ScriptCapitalE]_] := Module[{vs,ps,c},
vs=Cases[\[ScriptCapitalE],Subscript[(x|p|\[Xi]|\[Pi]), __],\[Infinity]]\[Union]{x,p,\[Epsilon]};
Total[CoefficientRules[Expand[\[ScriptCapitalE]], vs] /. (ps_->c_) :> Factor[c](Times@@(vs^ps))] ];


(* ::Input::Initialization:: *)
\[DoubleStruckCapitalE]/:\[DoubleStruckCapitalE][A_]\[DoubleStruckCapitalE][B_]:=\[DoubleStruckCapitalE][A+B];


(* ::Input::Initialization:: *)
$\[Pi]=Identity; (* hacks in pink *)


(* ::Input::Initialization:: *)
Unprotect[Integrate];
\[Integral]\[Omega]_. \[DoubleStruckCapitalE][L_]\[DifferentialD](vs_List):=Module[{n,L0,Q,\[CapitalDelta],G,Z0,Z,\[Lambda],DZ,FZ,a,b},
n=Length@vs; L0=L/.\[Epsilon]->0;
Q=Table[(-\!\(
\*SubscriptBox[\(\[PartialD]\), \(vs[\([\)\(a\)\(]\)], vs[\([\)\(b\)\(]\)]\)]L0\))/.Thread[vs->0]/.Subscript[(p|x), __]->0,{a,n},{b,n}];
If[(\[CapitalDelta]=Det[Q])==0,Return@"\!\(\*
StyleBox[\"Degenerate\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\" \",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\"Q\",\nFontColor->RGBColor[1, 0, 0]]\)\!\(\*
StyleBox[\"!\",\nFontColor->RGBColor[1, 0, 0]]\)"];
Z=Z0=CF@$\[Pi][L+vs . Q . vs/2]; G=Inverse[Q];
Subscript[DZ, a_]:=\!\(
\*SubscriptBox[\(\[PartialD]\), \(vs[\([\)\(a\)\(]\)]\)]Z\); Subscript[DZ, a_,b_]:=\!\(
\*SubscriptBox[\(\[PartialD]\), \(vs[\([\)\(b\)\(]\)]\)]
\*SubscriptBox[\(DZ\), \(a\)]\);
FZ:=CF@$\[Pi][1/2 \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(a = 1\), \(n\)]\(
\*UnderoverscriptBox[\(\[Sum]\), \(b = 1\), \(n\)]G[\([\)\(a, b\)\(]\)] \((
\*SubscriptBox[\(DZ\), \(a, b\)] + 
\*SubscriptBox[\(DZ\), \(a\)] 
\*SubscriptBox[\(DZ\), \(b\)])\)\)\)];
FixedPoint[(Z=Z0+\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(\[Lambda]\)]\(FZ\ \[DifferentialD]\[Lambda]\)\))&,Z];
PowerExpand@Factor[\[Omega] \[CapitalDelta]^(-1/2)]\[DoubleStruckCapitalE][CF[Z/.\[Lambda]->1/.Thread[vs->0]]]];
Protect[Integrate];


(* ::Input::Initialization:: *)
\[ScriptCapitalL][Subscript[X, i_,j_][s_]]:=T^(s/2) \[DoubleStruckCapitalE][
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])+(\[Epsilon] s/2)*(Subscript[x, i](Subscript[p, i]-Subscript[p, j])((T^s-1)Subscript[x, i] Subscript[p, j]+2(-Subscript[x, j] Subscript[p, j]))+1)]
\[ScriptCapitalL][Subscript[C, i_][0]]:=\[DoubleStruckCapitalE][Subscript[x, i](Subscript[p, i+1]-Subscript[p, i])];
\[ScriptCapitalL][Subscript[C, i_][1]]:=T^(1/2) \[DoubleStruckCapitalE][Subscript[x, i](Subscript[p, i+1]-Subscript[p, i])+\[Epsilon] (Subscript[c, 1]+Subscript[c, 2] \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\) \!\(\*SubsuperscriptBox[\(p\), \(i\), \(2\)]\))];
\[ScriptCapitalL][Subscript[C, i_][-1]]:=T^(-1/2) \[DoubleStruckCapitalE][Subscript[x, i](Subscript[p, i+1]-Subscript[p, i])+\[Epsilon] (Subscript[c, 3]+Subscript[c, 4] \!\(\*SubsuperscriptBox[\(x\), \(i\), \(2\)]\) \!\(\*SubsuperscriptBox[\(p\), \(i\), \(2\)]\))];
\[ScriptCapitalL][K_]:=CF[\[ScriptCapitalL]/@Features[K][[2]]]
vs[K_]:=Join@@Table[{Subscript[p, i],Subscript[x, i]},{i,Features[K][[1]]}]



