(* ::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\\APAI"];
Once[
<<KnotTheory`;
<< Rot.m
];
CF[\[ScriptCapitalE]_]:=Sum[Factor[\!\(
\*SubscriptBox[\(\[PartialD]\), \(
\*SubscriptBox[\(x\), \(i\)], 
\*SubscriptBox[\(p\), \(j\)]\)]\[ScriptCapitalE]\)]Subscript[x, i] Subscript[p, j],{i,0,2n+2},{j,0,2n+2}];


(* ::Input::Initialization:: *)
Subscript[\[Delta], i_,j_]:=If[i===j,1,0];
Subscript[gRules, s_,i_,j_]:={Subscript[g, i\[InvisibleComma]\[Beta]_]:>Subscript[\[Delta], i\[InvisibleComma]\[Beta]]+T^s Subscript[g, i+1,\[Beta]]+(1-T^s)Subscript[g, j+1,\[Beta]],Subscript[g, j\[InvisibleComma]\[Beta]_]:>Subscript[\[Delta], j\[InvisibleComma]\[Beta]]+Subscript[g, j+1,\[Beta]],
Subscript[g, \[Alpha]_,i]:>T^-s (Subscript[g, \[Alpha],i+1]-Subscript[\[Delta], \[Alpha],i+1]),Subscript[g, \[Alpha]_\[InvisibleComma]j]:>Subscript[g, \[Alpha],j+1]-(1-T^s)Subscript[g, \[Alpha]\[InvisibleComma]i]-Subscript[\[Delta], \[Alpha],j+1]}


(* ::Input::Initialization:: *)
{SuperStar[p],SuperStar[x],SuperStar[\!\(\*OverscriptBox[\(p\), \(_\)]\)],SuperStar[\!\(\*OverscriptBox[\(x\), \(_\)]\)]}={\[Pi],\[Xi],\!\(\*OverscriptBox[\(\[Pi]\), \(_\)]\),\!\(\*OverscriptBox[\(\[Xi]\), \(_\)]\)};  SuperStar[(Subscript[z_, i__])]:=Subscript[(SuperStar[z]), i];
\!\(\*SubscriptBox[\(Zip\), \({}\)]\)[\[ScriptCapitalE]_]:=\[ScriptCapitalE];
\!\(\*SubscriptBox[\(Zip\), \({z_, zs___}\)]\)[\[ScriptCapitalE]_] := (Collect[\[ScriptCapitalE]//\!\(\*SubscriptBox[\(Zip\), \({zs}\)]\),z] /. f_. z^d_.:>(D[f,{SuperStar[z],d}]))/.SuperStar[z]->0


(* ::Input::Initialization:: *)
gPair[\[ScriptCapitalE]_,w_]:=Collect[Subscript[Zip, Join@@Table[{Subscript[p, \[Alpha]],Subscript[\!\(\*OverscriptBox[\(p\), \(_\)]\), \[Alpha]],Subscript[x, \[Alpha]],Subscript[\!\(\*OverscriptBox[\(x\), \(_\)]\), \[Alpha]]},{\[Alpha],w}]][\[ScriptCapitalE] Exp[Sum[Subscript[g, \[Alpha],\[Beta]](Subscript[\[Pi], \[Alpha]]+Subscript[\!\(\*OverscriptBox[\(\[Pi]\), \(_\)]\), \[Alpha]])(Subscript[\[Xi], \[Beta]]+Subscript[\!\(\*OverscriptBox[\(\[Xi]\), \(_\)]\), \[Beta]]),{\[Alpha],w},{\[Beta],w}]-Sum[Subscript[\!\(\*OverscriptBox[\(\[Xi]\), \(_\)]\), \[Alpha]] Subscript[\[Pi], \[Alpha]],{\[Alpha],w}]]],Subscript[g, __],Factor]



