(* ::Package:: *)

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

(* ::Input::Initialization:: *)
\[Nu][Subscript[a, i_,j_],Subscript[a, k_,l_]]:=HeavisideTheta[i-k]-HeavisideTheta[i-l]-HeavisideTheta[j-k]+HeavisideTheta[j-l];


(* ::Input::Initialization:: *)
Subscript[PT, k_][w[lft___,Subscript[a, i_,j_],Subscript[a, k_,l_],rgt___]]:=Module[
{\[Nu]=\[Nu][Subscript[a, i,j],Subscript[a, k,l]]},
Subscript[PT, k][a^(2\[Nu]) w[lft,Subscript[a, k,l],Subscript[a, i,j],rgt]+\[Nu] a^\[Nu] w[lft,Subscript[a, k,j],Subscript[a, i,l],rgt]]
];
Subscript[PT, k_][w[Subscript[a, k_,l_],rest___]]:=w[Subscript[a, k,l],rest];
Subscript[PT, k_][\[ScriptCapitalE]_]/;(Head[\[ScriptCapitalE]]=!=w):=Expand[\[ScriptCapitalE]/.\[Omega]_w:>Subscript[PT, k][\[Omega]]]


(* ::Input::Initialization:: *)
BestCyclicMatch[a_List,b_List]:=Module[{i,j,k,la=Length@a,lb=Length@b,m},
m=Join@@Table[
k=0;While[a[[Mod[i+k,la,1]]]===b[[Mod[j+k,lb,1]]],++k];
{k,i,j},
{i,la},{j,lb}
];
MaximalBy[m,First][[1]]
]



