(* ::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:: *)
hp/: P_\[ScriptCapitalP]**hp[i_,j_]:=Simplify[P/.{Subscript[x, i]->Subscript[x, i]-(T-1)Subscript[x, j],Subscript[x, j]->T Subscript[x, j]}];
hp/: hp[i_,j_]**P_\[ScriptCapitalP]:=Simplify[P/.{Subscript[p, j]->Subscript[p, j]-(T-1)(Subscript[p, i]-Subscript[p, j])}]


(* ::Input::Initialization:: *)
AllMonomials[{},0]={1};
AllMonomials[{},d_Integer] /; d>0 := {};
AllMonomials[{v_,vs___},d_Integer] := Join@@Table[v^(d-k) AllMonomials[{vs},k],{k,0,d}];
AllMonomials[vs_List, {d_}] := Join@@Table[AllMonomials[vs,k],{k,0,d}];


(* ::Input::Initialization:: *)
Basis[n_,m_]:=Flatten@Outer[Times,AllMonomials[Table[Subscript[p, j],{j,n}],m],AllMonomials[Table[Subscript[x, j],{j,n}],m]];
Basis[n_,{m_}]:=Flatten@Table[Basis[n,k],{k,1,m}]


(* ::Input::Initialization:: *)
Unprotect[SeriesData];
SeriesData/:Expand[sd_SeriesData] := MapAt[Expand,sd,3];
Protect[SeriesData];


(* ::Input::Initialization:: *)
Subscript[\[DoubleStruckCapitalE], n_][Q_,P_]^m_[l___]^:=Subscript[\[DoubleStruckCapitalE], m][Q,P]/.Flatten@Table[{Subscript[p, i]->\!\(\*SubscriptBox[\(p\), \({l}\[LeftDoubleBracket]i\[RightDoubleBracket]\)]\),Subscript[x, i]->\!\(\*SubscriptBox[\(x\), \({l}\[LeftDoubleBracket]i\[RightDoubleBracket]\)]\)},{i,n}]


(* ::Input::Initialization:: *)
Unprotect[NonCommutativeMultiply];
Subscript[\[DoubleStruckCapitalE], n_][Q1_,P1_]**Subscript[\[DoubleStruckCapitalE], n_][Q2_,P2_]:=Module[{i,k,pp,xx},
Expand/@Subscript[\[DoubleStruckCapitalE], n][
Q1+Q2+Sum[(\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(x\), \(i\)]]Q1\))(\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(p\), \(i\)]]Q2\)), {i,n}],
Expand[(P1/.Table[Subscript[x, i]->Subscript[x, i]+Subscript[xx, i]+\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(p\), \(i\)]]Q2\),{i,n}])(P2/.Table[Subscript[p, i]->Subscript[p, i]+Subscript[pp, i]+\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(x\), \(i\)]]Q1\),{i,n}])]//.\!\(
\*SubsuperscriptBox[\(pp\), \(i_\), \(k_.\)] 
\*SubsuperscriptBox[\(xx\), \(i_\), \(k_.\)]\)->k!/.Subscript[(pp|xx), _]->0
]]


(* ::Input::Initialization:: *)
R=Subscript[\[DoubleStruckCapitalE], 2][(T-1)(Subscript[p, 1]-Subscript[p, 2])Subscript[x, 2],1+\[Epsilon] 1/2 Subscript[p, 1] Subscript[x, 2] (2 T Subscript[p, 2] Subscript[x, 1]+Subscript[p, 1] ((1-3 T) Subscript[x, 1]+(-1+T) T Subscript[x, 2]))+O[\[Epsilon]]^3]/.Subscript[p, i_]:>-Subscript[p, i]



