(* ::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:: *)
SetDirectory["C:\\drorbn\\AcademicPensieve\\Talks\\MIT-1612"];


(* ::Input::Initialization:: *)
\!\(
\*SubsuperscriptBox[\(R\), \(0, i_, j_\), \(+\)] := \(\[DoubleStruckCapitalE][
\*SubscriptBox[\(b\), \(i\)] 
\*SubscriptBox[\(c\), \(j\)] + 
\*SubsuperscriptBox[\(b\), \(i\), \(-1\)] \((
\*SuperscriptBox[\(E\), 
SubscriptBox[\(b\), \(i\)]] - 1)\) 
\*SubscriptBox[\(u\), \(i\)] 
\*SubscriptBox[\(w\), \(j\)]]\)\); \!\(
\*SubsuperscriptBox[\(R\), \(0, i_, j_\), \(-\)] := \(\[DoubleStruckCapitalE][\(-
\*SubscriptBox[\(b\), \(i\)]\) 
\*SubscriptBox[\(c\), \(j\)] + 
\*SubsuperscriptBox[\(b\), \(i\), \(-1\)] \((
\*SuperscriptBox[\(E\), \(-
\*SubscriptBox[\(b\), \(i\)]\)] - 1)\) 
\*SubscriptBox[\(u\), \(i\)] 
\*SubscriptBox[\(w\), \(j\)]]\)\);


(* ::Input::Initialization:: *)
CF[\[Omega]_. \[DoubleStruckCapitalE][Q_]] := Simplify[\[Omega]]\[DoubleStruckCapitalE][Simplify[Q]];
\[DoubleStruckCapitalE] /: \[DoubleStruckCapitalE][Q1_]\[DoubleStruckCapitalE][Q2_] := CF@\[DoubleStruckCapitalE][Q1+Q2];
\[Omega]1_. \[DoubleStruckCapitalE][Q1_] \[Congruent] \[Omega]2_. \[DoubleStruckCapitalE][Q2_] := Simplify[\[Omega]1==\[Omega]2\[And]Q1==Q2];


(* ::Input::Initialization:: *)
Subscript[N, Subscript[(x:w|u), i_] Subscript[c, j_]->k_][\[Omega]_. \[DoubleStruckCapitalE][Q_]] := CF[
\[Omega] \[DoubleStruckCapitalE][E^\[Gamma] \[Alpha] Subscript[x, k]+\[Gamma] Subscript[c, k]+(Q/.Subscript[c, j]|Subscript[x, i]->0)]/.{\[Gamma]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(c\), \(j\)]]Q\),\[Alpha]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(x\), \(i\)]]Q\)}];
Subscript[N, Subscript[w, i_] Subscript[u, j_]->k_][\[Omega]_. \[DoubleStruckCapitalE][Q_]] := CF[
\[Nu] \[Omega] \[DoubleStruckCapitalE][-Subscript[b, k]\[Nu] \[Alpha] \[Beta]+\[Nu] \[Beta] Subscript[u, k]+\[Nu] \[Alpha] Subscript[w, k]+\[Nu] \[Delta] Subscript[u, k] Subscript[w, k] +(Q/.Subscript[w, i]|Subscript[u, j]->0)] /. \[Nu]-> (1+Subscript[b, k] \[Delta])^-1 /. {\[Alpha]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(w\), \(i\)]]Q\)/.Subscript[u, j]->0, \[Beta]->\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(u\), \(j\)]]Q\)/.Subscript[w, i]->0, \[Delta]->\!\(
\*SubscriptBox[\(\[PartialD]\), \(
\*SubscriptBox[\(w\), \(i\)], 
\*SubscriptBox[\(u\), \(j\)]\)]Q\)}];


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


(* ::Input::Initialization:: *)
\[CapitalLambda][k_]:= ((Subscript[t, k]-1)(2(\[Alpha] \[Beta]+\[Delta] \[Mu])^2-\[Alpha]^2 \[Beta]^2)-4Subscript[v, k] Subscript[c, k] Subscript[w, k] \[Delta]^2 \[Mu]^2-
\[Delta](1+\[Mu])(\!\(
\*SubsuperscriptBox[\(w\), \(k\), \(2\)] 
\*SuperscriptBox[\(\[Alpha]\), \(2\)]\)+\!\(
\*SubsuperscriptBox[\(v\), \(k\), \(2\)] 
\*SuperscriptBox[\(\[Beta]\), \(2\)]\))-\!\(
\*SubsuperscriptBox[\(v\), \(k\), \(2\)] 
\*SubsuperscriptBox[\(w\), \(k\), \(2\)] 
\*SuperscriptBox[\(\[Delta]\), \(3\)] \((1 + 3  \[Mu])\)\)-2(\[Alpha] \[Beta]+2\[Delta] \[Mu]+Subscript[v, k] Subscript[w, k] \[Delta]^2 (1+2\[Mu])+2Subscript[c, k]\[Delta] \[Mu]^2)(Subscript[w, k]\[Alpha]+Subscript[v, k]\[Beta])-4(Subscript[c, k] \[Mu]^2+Subscript[v, k] Subscript[w, k]\[Delta](1+\[Mu]))(\[Alpha] \[Beta]+\[Delta] \[Mu]))(1+Subscript[t, k])/4;


(* ::Input::Initialization:: *)
\!\(
\*SubsuperscriptBox[\(R\), \(i_, j_\), \(+\)] := \(\[DoubleStruckCapitalE][1, Log[
\*SubscriptBox[\(t\), \(i\)]] 
\*SubscriptBox[\(c\), \(j\)], 
\*SubscriptBox[\(v\), \(i\)] 
\*SubscriptBox[\(w\), \(j\)], 
\*SubscriptBox[\(v\), \(i\)] 
\*SubscriptBox[\(c\), \(i\)] 
\*SubscriptBox[\(w\), \(j\)] + 
\*SubscriptBox[\(c\), \(i\)] 
\*SubscriptBox[\(c\), \(j\)] + 
\*SubsuperscriptBox[\(v\), \(i\), \(2\)] 
\*SubsuperscriptBox[\(w\), \(j\), \(2\)]/4]\)\);
\!\(
\*SubsuperscriptBox[\(R\), \(i_, j_\), \(-\)] := \(\[DoubleStruckCapitalE][1, \(-Log[
\*SubscriptBox[\(t\), \(i\)]]\) 
\*SubscriptBox[\(c\), \(j\)], \(-
\*SubsuperscriptBox[\(t\), \(i\), \(-1\)]\) 
\*SubscriptBox[\(v\), \(i\)] 
\*SubscriptBox[\(w\), \(j\)], 
\*SubsuperscriptBox[\(t\), \(i\), \(-1\)] 
\*SubscriptBox[\(v\), \(i\)] 
\*SubscriptBox[\(c\), \(j\)] 
\*SubscriptBox[\(w\), \(j\)] - 
\*SubscriptBox[\(c\), \(i\)] 
\*SubscriptBox[\(c\), \(j\)] - 
\*SubsuperscriptBox[\(t\), \(i\), \(-2\)] 
\*SubsuperscriptBox[\(v\), \(i\), \(2\)] 
\*SubsuperscriptBox[\(w\), \(j\), \(2\)]/4]\)\);
(Subscript[ur, i_]:=\[DoubleStruckCapitalE][\!\(
\*SubsuperscriptBox[\(t\), \(i\), \(\(-1\)/2\)], 0, 0, \(
\*SubscriptBox[\(c\), \(i\)] 
\*SubsuperscriptBox[\(t\), \(i\), \(-2\)]\)\)]; Subscript[nr, i_]:=\[DoubleStruckCapitalE][\!\(
\*SubsuperscriptBox[\(t\), \(i\), \(1/2\)], 0, 0, \(\(-
\*SubscriptBox[\(c\), \(i\)]\) 
\*SubsuperscriptBox[\(t\), \(i\), \(2\)]\)\)];)


(* ::Input::Initialization:: *)
Subscript[DP, x_->Subscript[D, \[Alpha]_],y_->Subscript[D, \[Beta]_]][P_][f_]:= (* means P[\!\(
\*SubscriptBox[\(\[PartialD]\), \(\[Alpha]\)]\(\(,\)
\*SubscriptBox[\(\[PartialD]\), \(\[Beta]\)]\)\)][f] *)
Total[CoefficientRules[P,{x,y}]/.({m_,n_}->c_):>c D[f,{\[Alpha],m},{\[Beta],n}]]


(* ::Input::Initialization:: *)
CF[\[ScriptCapitalE]_\[DoubleStruckCapitalE]]:=Expand/@Together/@\[ScriptCapitalE];
\[DoubleStruckCapitalE]/:\[DoubleStruckCapitalE][\[Omega]1_,L1_,Q1_,P1_]\[DoubleStruckCapitalE][\[Omega]2_,L2_,Q2_,P2_]:=CF@\[DoubleStruckCapitalE][\[Omega]1 \[Omega]2,L1+L2,\[Omega]2 Q1+\[Omega]1 Q2,\[Omega]2^4 P1+\[Omega]1^4 P2];


(* ::Input::Initialization:: *)
Subscript[N, Subscript[w, i_] Subscript[v, j_]->k_][\[DoubleStruckCapitalE][\[Omega]_,L_,Q_,P_]]:=With[{q=((1-Subscript[t, k])\[Alpha] \[Beta]+\[Beta] Subscript[v, k]+\[Alpha] Subscript[w, k]+\[Delta] Subscript[v, k] Subscript[w, k])/\[Mu]},CF[
\[DoubleStruckCapitalE][\[Mu] \[Omega],L,\[Mu] \[Omega] q+\[Mu](Q/.Subscript[w, i]|Subscript[v, j]->0),\[Mu]^4 E^-q Subscript[DP, Subscript[w, i]->Subscript[D, \[Alpha]],Subscript[v, j]->Subscript[D, \[Beta]]][P][E^q]+\[Omega]^4 \[CapitalLambda][k]]/.\[Mu]->1+(Subscript[t, k]-1)\[Delta]/.{\[Alpha]->\[Omega]^-1 (\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(w\), \(i\)]]Q\)/.Subscript[v, j]->0),\[Beta]->\[Omega]^-1 (\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(v\), \(j\)]]Q\)/.Subscript[w, i]->0),\[Delta]->\[Omega]^-1 \!\(
\*SubscriptBox[\(\[PartialD]\), \(
\*SubscriptBox[\(w\), \(i\)], 
\*SubscriptBox[\(v\), \(j\)]\)]Q\)}]];


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


(* ::Input::Initialization:: *)
Subscript[m, i_,j_->k_][Z_\[DoubleStruckCapitalE]]:=Module[{x,z},
CF[(Z//Subscript[N, Subscript[w, i] Subscript[v, j]->x]//Subscript[N, Subscript[c, i] Subscript[v, x]->x]//Subscript[N, Subscript[w, x] Subscript[c, j]->x])/.Subscript[z_, i|j|x]->Subscript[z, k]]]


(* ::Input::Initialization:: *)
ConditionalExport[fname_String, rest___] := Module[{temp, exists},
temp="ConditionalExportTemporary"<>"."<>FileExtension[fname];
exists=FileExistsQ[fname];
Export[temp, rest];
If[exists && FileByteCount[fname]===FileByteCount[temp],
DeleteFile[temp],
(* else *) Print["Exporting "<>fname<>"..."];
If[exists, DeleteFile[fname]];
RenameFile[temp, fname]
];
fname
]

SetOptions[$FrontEndSession,PrintingStyleEnvironment->"Working"];
TagProperties[_] := {};
TagProperties["131"] = {PageWidth ->3.2/0.66};
Options[CellExport] = {
PageWidth -> 4/0.66, CellFilter -> Identity, ExportDirectory -> "Snips", ExportBaseFilename -> Automatic, ExportFormat -> ".pdf", ExportOptions -> {}, Split -> False
};
CellExport[tag_String, opts___Rule] := CellExport[
NotebookGet[EvaluationNotebook[]],
tag, opts
];
CellExport[nb_Notebook, tag_String] := CellExport[nb, tag, TagProperties[tag]];
CellExport[nb_Notebook, tag_String, OptionsPattern[]] := Module[
{cells, cell, filename, format},
filename = FileNameJoin[{
OptionValue[ExportDirectory] /. Automatic -> Directory[],
OptionValue[ExportBaseFilename] /. Automatic -> tag
}];
format=OptionValue[ExportFormat];
cells=OptionValue[CellFilter][Cases[
nb, c_Cell /; FreeQ[List@@c, Cell] && !FreeQ[c, CellTags->tag],
Infinity
]];
If[!OptionValue[Split],
If[Length[cells]>=1,
If[Length[cells]==1,
cells=Join[First[cells], Cell[PageWidth ->1.2 72OptionValue[PageWidth], Background->{White, Opacity[0]}]],
cells=Cell[CellGroup[cells], PageWidth -> 72OptionValue[PageWidth]]
];
ConditionalExport[
filename<>format,cells,
ImageResolution -> 300,
OptionValue[ExportOptions]
]
],
k=0;
Table[
++k;
ConditionalExport[
filename<>"-"<>ToString[k]<>format,
Append[cell, PageWidth -> 72OptionValue[PageWidth]],
ImageResolution -> 300,
OptionValue[ExportOptions]
],
{cell, cells}
]
]
];

ExportCells:=(
nb=NotebookGet[EvaluationNotebook[]];
tags=Cases[nb, (CellTags->tag_String) :> tag, Infinity ] // Union;
Print[tags];
CellExport /@ tags;
Print["Done."]
);



