(* ::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.                                                         *)
(************************************************************************)



SetDirectory["C:\\drorbn\\AcademicPensieve\\2014-07"];
<< "MetaCalculi/MetaCalculi-Program.m"


Conj[\[Gamma]_\[CapitalGamma], \[CapitalOmega]_\[CapitalGamma]] := Module[{n,\[Gamma]1},
n=Length[dL[\[Gamma]]];
\[Gamma]1=\[Gamma]*(\[CapitalOmega] // d\[Sigma]@@Table[a->\[Tau][a], {a,n}]);
Do[\[Gamma]1=\[Gamma]1//dm[\[Tau][a],a,a], {a,n}];
Do[\[Gamma]1=\[Gamma]1//dm[a,-a,a], {a,n}];
\[Gamma]1
]


Subscript[\[CapitalOmega], 0][n_Integer] :=  Table[
Which[i>j, 0,i==j,(1-Subscript[T, i])^-1,i<j, 1],
{i,n}, {j,n}];
Subscript[\[CapitalOmega], 1][n_Integer] := Simplify[\[Alpha] Subscript[\[CapitalOmega], 0][n]+\[Beta] Transpose[Subscript[\[CapitalOmega], 0][n] /. Subscript[T, a_]:>1/Subscript[T, a]]];


\[CapitalOmega][io___]:= \[CapitalOmega][{io}];
\[CapitalOmega][io_List] /; EvenQ[Length@io] := Module[{n,std,i,\[CapitalOmega]0, \[CapitalOmega]0i,j,nio,k,x,y,X},
n=Length[io]/2;
std=Join[Range[n],Range[-n,-1]];
i=1; While[i<=2n  && io[[i]]==std[[i]], ++i];
If[i>2n,
\[CapitalOmega]0=Subscript[\[CapitalOmega], 1][n]; \[CapitalOmega]0i=Inverse[\[CapitalOmega]0];
\[CapitalGamma][1,0, Sum[Subscript[t, a] Subscript[h, b]\[CapitalOmega]0[[a,b]], {a,n}, {b,n}]]\[CapitalGamma][1,0, Sum[Subscript[t, -a] Subscript[h, -b]\[CapitalOmega]0i[[a,b]],{a,n},{b,n}]],
(* Else *) j= Position[io, std[[i]]][[1,1]]-1;
nio=io; nio[[{j,j+1}]]=nio[[{j+1,j}]];
\[CapitalOmega]1=\[CapitalOmega][nio]\[CapitalGamma][Xm[x,y]];
\[CapitalOmega]1 = If[(k=nio[[j]])>0, \[CapitalOmega]1 // dm[x,k,k], \[CapitalOmega]1 // dS[x] // dm[k,x,k]];
\[CapitalOmega]1 = If[(k=nio[[j+1]])>0, \[CapitalOmega]1 // dm[y,k,k], \[CapitalOmega]1 // dS[y] // dm[k,y,k]];
X=\[CapitalGamma][Xp[x,y]]; If[nio[[j]]>0, X=X//dS[x]]; If[nio[[j+1]]>0, X=X//dS[y]];
\[CapitalOmega]1=\[CapitalOmega]1 Mirror[X];
\[CapitalOmega]1 = If[(k=nio[[j]])>0, \[CapitalOmega]1 // dm[k,x,k], \[CapitalOmega]1 // dm[x,k,k]];
\[CapitalOmega]1 = If[(k=nio[[j+1]])>0, \[CapitalOmega]1 // dm[k,y,k], \[CapitalOmega]1 // dm[y,k,k]];
\[CapitalGamma]Collect[\[CapitalOmega]1 /. Subscript[T, i_]:>Subscript[T, Abs[i]]]
]
]



