(* ::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:: *)
Subscript[DP, x_->Subscript[D, \[Alpha]_],y_->Subscript[D, \[Beta]_]][P_][f_]:=Total[CoefficientRules[P,{x,y}]/.({m_,n_}->c_):>c D[f,{\[Alpha],m},{\[Beta],n}]]


(* ::Input::Initialization:: *)
(* "D" for Detailed *)
Subscript[D\[CapitalLambda], k_][h_,e_,l_,f_,\[Alpha]_,\[Beta]_,\[Delta]_]:=Module[
{\[Rho]h,\[Rho]e,\[Rho]l,\[Rho]f,eqn,a,b,c,sol,\[Lambda],q,\[Nu]},
\[Rho]h=({
 {-1, 0},
 {0, -1}
});  \[Rho]e=({
 {0, 0},
 {-\[Epsilon], 0}
});  \[Rho]l=({
 {-(1+1/\[Epsilon])/2, 0},
 {0, (1-1/\[Epsilon])/2}
}); \[Rho]f=({
 {0, 1},
 {0, 0}
});
eqn=MatrixExp[\[Alpha] \[Rho]f].MatrixExp[\[Beta] \[Rho]e]==MatrixExp[a \[Rho]e].MatrixExp[c (\[Rho]h-2\[Epsilon] \[Rho]l)].MatrixExp[b \[Rho]f];
Echo[sol=Solve[Thread[Flatten/@eqn], {a,b,c}][[1]] /. C[1]->0];
\[Lambda]=Simplify[E^(-f \[Alpha]-e \[Beta]+h \[Alpha] \[Beta]) Normal@Series[E^(c h + a e - 2\[Epsilon] c l + b f)/.sol, {\[Epsilon],0,k}]];
q=E^(\[Nu](f \[Alpha]+e \[Beta]-h \[Alpha] \[Beta]+e f \[Delta]));
Collect[q^-1 Subscript[DP, \[Alpha]->Subscript[D, f],\[Beta]->Subscript[D, e]][\[Lambda]][q] /. \[Nu]->(1+h \[Delta])^-1,\[Epsilon],Simplify]];


(* ::Input::Initialization:: *)
Subscript[\[CapitalLambda], k_][h_,e_,l_,f_,\[Alpha]_,\[Beta]_,\[Delta]_] :=Subscript[\[CapitalLambda], k][h,e,l,f,\[Alpha],\[Beta],\[Delta]]=Module[{\[Lambda]},
\[Lambda]=Normal@Series[E^((f \[Alpha]+e \[Beta])/(1-\[Alpha] \[Beta] \[Epsilon])) (1-\[Alpha] \[Beta] \[Epsilon])^(-2 l+h/\[Epsilon]), {\[Epsilon],0,k}]/.E^_->1;
Collect[Subscript[DP, \[Alpha]->Subscript[D, f],\[Beta]->Subscript[D, e]][\[Lambda]][E^((f \[Alpha]+e \[Beta]+e f \[Delta])/(1+h \[Delta]))]/.E^_->1,\[Epsilon],Simplify]];


(* ::Input::Initialization:: *)
\[Epsilon] /: \[Epsilon]^p_ /; p>1 :=0;


(* ::Input::Initialization:: *)
CF[\[DoubleStruckCapitalE]1n[\[Omega]_,L_,Q_,P_]] := \[DoubleStruckCapitalE]1n[Together[\[Omega]], Together[L], Together[Q],Together[P]];
\[DoubleStruckCapitalE]1n /: \[DoubleStruckCapitalE]1n[\[Omega]1_,L1_,Q1_,P1_]\[DoubleStruckCapitalE]1n[\[Omega]2_,L2_,Q2_,P2_] := CF@\[DoubleStruckCapitalE]1n[\[Omega]1 \[Omega]2,L1+L2,Q1+Q2,P1+P2];
\[DoubleStruckCapitalE]1n[\[Omega]1_,L1_,Q1_,P1_] \[Congruent] \[DoubleStruckCapitalE]1n[\[Omega]2_,L2_,Q2_,P2_] := Simplify[\[Omega]1==\[Omega]2\[And]L1==L2\[And]Q1==Q2\[And]P1==P2];


(* ::Input::Initialization:: *)
\[DoubleStruckCapitalE]1n[
\!\(\*SubsuperscriptBox[\(X\), \(i_, j_\), \(+\)]\)]:=\[DoubleStruckCapitalE]1n[1, Subscript[h, i] Subscript[l, j],\!\(
\*SubsuperscriptBox[\(h\), \(i\), \(-1\)] \((
\*SuperscriptBox[\(E\), 
SubscriptBox[\(h\), \(i\)]] - 1)\) 
\*SubscriptBox[\(e\), \(i\)] 
\*SubscriptBox[\(f\), \(j\)]\),SuperPlus[P]];
\[DoubleStruckCapitalE]1n[
\!\(\*SubsuperscriptBox[\(X\), \(i_, j_\), \(-\)]\)]:=\[DoubleStruckCapitalE]1n[1, -Subscript[h, i] Subscript[l, j],\!\(
\*SubsuperscriptBox[\(h\), \(i\), \(-1\)] \((
\*SuperscriptBox[\(E\), \(-
\*SubscriptBox[\(h\), \(i\)]\)] - 1)\) 
\*SubscriptBox[\(e\), \(i\)] 
\*SubscriptBox[\(f\), \(j\)]\),SuperMinus[P]];
\[DoubleStruckCapitalE]1n[p_Times] := \[DoubleStruckCapitalE]1n /@ p;


(* ::Input::Initialization:: *)
Subscript[NO, Subscript[(x:f|e), i_] Subscript[l, j_]][\[DoubleStruckCapitalE]1n[\[Omega]_,L_,Q_,P_]] := With[{q=E^\[Gamma] \[Beta] Subscript[x, i]+\[Gamma] Subscript[l, j]},
CF[\[DoubleStruckCapitalE]1n[\[Omega],L,
E^\[Gamma] \[Beta] Subscript[x, i]+(Q/.Subscript[x, i]->0),
E^-q Subscript[DP, Subscript[l, j]->Subscript[D, \[Gamma]],Subscript[x, i]->Subscript[D, \[Beta]]][P][E^q]
]/.{\[Gamma]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(l\), \(j\)]]L\),\[Beta]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(x\), \(i\)]]Q\)}]];


(* ::Input::Initialization:: *)
Subscript[NO, Subscript[f, i_] Subscript[e, j_]->k_][\[DoubleStruckCapitalE]1n[\[Omega]_,L_,Q_,P_]]:=With[{q=\[Nu](-\[Alpha] \[Beta] Subscript[h, k]+\[Beta] Subscript[e, k]+\[Alpha] Subscript[f, k]+\[Delta] Subscript[e, k] Subscript[f, k])},
CF[\[DoubleStruckCapitalE]1n[\[Nu] \[Omega],L,
q+(Q/.Subscript[f, i]|Subscript[e, j]->0),
E^-q Subscript[DP, Subscript[f, i]->Subscript[D, \[Alpha]],Subscript[e, j]->Subscript[D, \[Beta]]][P][E^q]+(Subscript[\[CapitalLambda], 1][Subscript[h, k],Subscript[e, k],Subscript[l, k],Subscript[f, k],\[Alpha],\[Beta],\[Delta]]-1 /. \[Epsilon]->1)
]/.\[Nu]->(1+Subscript[h, k]\[Delta])^-1/.{\[Alpha]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(f\), \(i\)]]Q\)/.Subscript[e, j]->0,\[Beta]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(e\), \(j\)]]Q\)/.Subscript[f, i]->0,\[Delta]->\!\(
\*SubscriptBox[\(\[PartialD]\), \(
\*SubscriptBox[\(f\), \(i\)], 
\*SubscriptBox[\(e\), \(j\)]\)]Q\)}]];


(* ::Input::Initialization:: *)
Subscript[m, i_,j_->k_][Z_]:=Module[{x,z},CF[(Z//Subscript[NO, Subscript[f, i] Subscript[e, j]->x]//Subscript[NO, Subscript[l, i] Subscript[e, x]]//Subscript[NO, Subscript[f, x] Subscript[l, j]])/.Subscript[z_, i|j|x]->Subscript[z, k]]]



