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


(* ::Input::Initialization:: *)
\[Epsilon] /: \[Epsilon]^n_/;n>=1:=0;
\[CapitalLambda][b_, c_,u_,w_,\[Alpha]_,\[Beta]_,\[Delta]_,\[Nu]_]:=2 c w \[Alpha] \[Delta] \[Nu]+2 c u \[Beta] \[Delta] \[Nu]+2 c u w \[Delta]^2 \[Nu]+u w^2 \[Alpha] \[Delta]^2 \[Nu]^3-1/2 b u^2 w^2 \[Delta]^4 \[Nu]^3+1/2 w^2 \[Alpha]^2 \[Delta] (2+b \[Delta]) \[Nu]^3-u^2 w \[Beta] \[Delta]^2 (1+2 b \[Delta]) \[Nu]^3-1/2 u^2 \[Beta]^2 \[Delta] (2+3 b \[Delta]) \[Nu]^3+2 c (\[Delta]+\[Alpha] \[Beta] \[Nu])-2 b u w \[Delta]^2 \[Nu]^2 (\[Delta]+\[Alpha] \[Beta] \[Nu])+w \[Alpha] \[Nu]^2 (2 \[Delta]+\[Alpha] \[Beta] \[Nu])-u \[Beta] (1+2 b \[Delta]) \[Nu]^2 (2 \[Delta]+\[Alpha] \[Beta] \[Nu])-1/2 b \[Nu] (2 \[Delta]^2+4 \[Alpha] \[Beta] \[Delta] \[Nu]+\[Alpha]^2 \[Beta]^2 \[Nu]^2);


(* ::Input::Initialization:: *)
Simp[P_. \[DoubleStruckCapitalE][Q_]] := Together[P]\[DoubleStruckCapitalE][Together[Q]];
(*P1_.\[DoubleStruckCapitalE][Q1_] \[Congruent] P2_.\[DoubleStruckCapitalE][Q2_] := Simplify[P1\[Equal]P2\[And]Q1\[Equal]Q2];*)
P1_. \[DoubleStruckCapitalE][Q1_] \[Congruent] P2_. \[DoubleStruckCapitalE][Q2_] := Together[P1-P2]==0\[And]Together[Q1-Q2]==0;


(* ::Input::Initialization:: *)
\[DoubleStruckCapitalE] /: \[DoubleStruckCapitalE][Q1_]\[DoubleStruckCapitalE][Q2_] := Simp@\[DoubleStruckCapitalE][Q1+Q2]


(* ::Input::Initialization:: *)
NO[Subscript[u, i_],Subscript[c, j_],k_][P_. \[DoubleStruckCapitalE][Q_]] := Simp@Module[{q(*,\[Alpha],\[Beta],\[CapitalTheta]*)},
q=E^-\[Alpha] \[Beta] Subscript[u, k]+\[Alpha] Subscript[c, k]+\[CapitalTheta];
E^-q DP[P,Subscript[c, j]->Subscript[D, \[Alpha]],Subscript[u, i]->Subscript[D, \[Beta]]][E^q]\[DoubleStruckCapitalE][q] /. {\[Alpha]->Together[\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(c\), \(j\)]]Q\)],\[Beta]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(u\), \(i\)]]Q\),\[CapitalTheta]->(Q/.Subscript[c, j]|Subscript[u, i]->0)}
];


(* ::Input::Initialization:: *)
NO[Subscript[w, i_],Subscript[c, j_],k_][P_. \[DoubleStruckCapitalE][Q_]] := Simp@Module[{q(*,\[Alpha],\[Beta],\[CapitalTheta]*)},
q=E^\[Alpha] \[Beta] Subscript[w, k]+\[Alpha] Subscript[c, k]+\[CapitalTheta];
E^-q DP[P,Subscript[c, j]->Subscript[D, \[Alpha]],Subscript[w, i]->Subscript[D, \[Beta]]][E^q]\[DoubleStruckCapitalE][q] /. {\[Alpha]->Together[\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(c\), \(j\)]]Q\)],\[Beta]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(w\), \(i\)]]Q\),\[CapitalTheta]->(Q/.Subscript[c, j]|Subscript[w, i]->0)}
];


(* ::Input::Initialization:: *)
NO[Subscript[w, i_],Subscript[u, j_],k_][P_. \[DoubleStruckCapitalE][Q_]] := Simp@Module[
{\[Alpha]0=\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(w\), \(i\)]]Q\)/.Subscript[u, j]->0, \[Beta]0=\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(u\), \(j\)]]Q\)/.Subscript[w, i]->0, \[Delta]0=\!\(
\*SubscriptBox[\(\[PartialD]\), \(
\*SubscriptBox[\(w\), \(i\)], 
\*SubscriptBox[\(u\), \(j\)]\)]Q\),\[CapitalTheta]0=Q/.Subscript[w, i]|Subscript[u, j]->0, q(*,\[Alpha],\[Beta],\[Delta], \[CapitalTheta], \[Nu]*)},
q=-Subscript[b, k]\[Nu] \[Alpha] \[Beta]+\[Nu] \[Beta] Subscript[u, k]+\[Nu] \[Delta] Subscript[u, k] Subscript[w, k]+\[Nu] \[Alpha] Subscript[w, k]+\[CapitalTheta];
E^-q DP[P,Subscript[w, i]->Subscript[D, \[Alpha]],Subscript[u, j]->Subscript[D, \[Beta]]][\[Nu](1+\[Epsilon] \[Nu] \[CapitalLambda][Subscript[b, k],Subscript[c, k], Subscript[u, k], Subscript[w, k], \[Alpha],\[Beta],\[Delta],\[Nu]]) E^q]\[DoubleStruckCapitalE][q]/. {\[Alpha]->\[Alpha]0,\[Beta]->\[Beta]0,\[Delta]->\[Delta]0, \[CapitalTheta]->\[CapitalTheta]0, \[Nu]->(1+Subscript[b, k] \[Delta]0)^-1}
];


(* ::Input::Initialization:: *)
m[i_,j_,kk_][Z_] :=Simp@Module[{x,y},
Z // ReplaceAll[Subscript[b, i|j]->Subscript[b, kk]]// NO[Subscript[w, i],Subscript[c, j],x] // NO[Subscript[w, x],Subscript[u, j],y] // ReplaceAll[{Subscript[c, x|y]->Subscript[c, x],Subscript[w, j]->Subscript[w, y]}] // NO[Subscript[u, i],Subscript[c, x],x] // ReplaceAll[{Subscript[c, i|x]->Subscript[c, kk],Subscript[u, x|y]->Subscript[u, kk],Subscript[w, y]->Subscript[w, kk],Subscript[b, x|y]->Subscript[b, kk]}]
]



