(* ::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:: *)
wdir=SetDirectory["C:\\drorbn\\AcademicPensieve\\Projects\\SL2Portfolio"];
<< "SL2PortfolioProgram.m"


(* ::Input::Initialization:: *)
$p=2; $k=2; $U=QU;


(* ::Input::Initialization:: *)
HL[\[ScriptCapitalE]_] := Style[\[ScriptCapitalE], Background -> Yellow];


(* ::Input::Initialization:: *)
Subscript[t2b, i_->j_]:=\[DoubleStruckCapitalE][Subscript[\[Alpha], i] Subscript[a, j]-Subscript[\[Tau], i]\[Gamma] Subscript[b, j],Subscript[\[Xi], i] Subscript[x, j]+Subscript[\[Eta], i] Subscript[y, j],E^(\[Epsilon] Subscript[\[Tau], i] Subscript[a, j])+O[\[Epsilon]]^($k+1)];
Subscript[b2t, i_->j_]:=\[DoubleStruckCapitalE][Subscript[\[Alpha], i] Subscript[a, j]-Subscript[\[Beta], i]Subscript[t, j]/\[Gamma],Subscript[\[Xi], i] Subscript[x, j]+Subscript[\[Eta], i] Subscript[y, j],E^(\[Epsilon] Subscript[\[Beta], i]Subscript[a, j]/\[Gamma])+O[\[Epsilon]]^($k+1)];
Subscript[t2b, i_]:=Subscript[t2b, i->i]; Subscript[b2t, i_]:=Subscript[b2t, i->i];


(* ::Input::Initialization:: *)
Subscript[am, i_,j_->k_]:=\[DoubleStruckCapitalE][(Subscript[\[Alpha], i]+Subscript[\[Alpha], j])Subscript[a, k],(E^(-\[Gamma] Subscript[\[Alpha], j]) Subscript[\[Xi], i]+Subscript[\[Xi], j])Subscript[x, k],1];
Subscript[bm, i_,j_->k_]:=\[DoubleStruckCapitalE][(Subscript[\[Beta], i]+Subscript[\[Beta], j])Subscript[b, k],(Subscript[\[Eta], i]+Subscript[\[Eta], j])Subscript[y, k],E^((E^(- \[Epsilon] Subscript[\[Beta], i])-1)Subscript[\[Eta], j] Subscript[y, k])+O[\[Epsilon]]^($k+1)];


(* ::Input::Initialization:: *)
Subscript[E, q_,k_][x_]:=Module[{j},E^(\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(j = 1\), \(k + 1\)]\ 
\*FractionBox[\(
\*SuperscriptBox[\((1 - q)\), \(j\)] 
\*SuperscriptBox[\(x\), \(j\)]\), \(j \((1 - 
\*SuperscriptBox[\(q\), \(j\)])\)\)]\))]; Subscript[E, q_][x_]:=Subscript[E, q,$k][x]


(* ::Input::Initialization:: *)
Subscript[nR, i_,j_]:=\[DoubleStruckCapitalE][\[HBar] Subscript[a, j] Subscript[b, i],\[HBar] Subscript[x, j] Subscript[y, i],Series[E^(-\[HBar] Subscript[y, i] Subscript[x, j]) Subscript[E, Subscript[q, \[HBar]]][\[HBar] Subscript[y, i] Subscript[x, j]],{\[Epsilon],0,$k}]];
Subscript[nR, 1,2]


(* ::Input::Initialization:: *)
Subscript[nP, i_,j_,0]:=\[DoubleStruckCapitalE][Subscript[\[Beta], i]Subscript[\[Alpha], j]/\[HBar],Subscript[\[Eta], i]Subscript[\[Xi], j]/\[HBar],1];
Subscript[nP, i_,j_,k_]:=Module[{m,n},
MapAt[(#-\[Epsilon]^k Coefficient[(Subscript[nR, n,m]~Subscript[B, n,m]~(Subscript[nP, n,j,0] Subscript[nP, i,m,k-1]))[[3]],\[Epsilon],k]+O[\[Epsilon]]^($k+1))&, Subscript[nP, i,j,k-1],3]
];
Subscript[nP, i_,j_]:=Subscript[nP, i,j,$k];


(* ::Input::Initialization:: *)
Subscript[aS, i_]:=\[DoubleStruckCapitalE][Subscript[\[Alpha], i] Subscript[a, i],Subscript[\[Xi], i] Subscript[x, i],1]~Subscript[B, i]~Subscript[tS, i];
Subscript[aS, i]


(* ::Input::Initialization:: *)
Subscript[bSi, i_]:=\[DoubleStruckCapitalE][Subscript[\[Beta], i] Subscript[b, i],Subscript[\[Eta], i] Subscript[y, i],1]~Subscript[B, i]~Subscript[b2t, i]~Subscript[B, i]~Subscript[tS, i]~Subscript[B, i]~Subscript[t2b, i];
Subscript[bSi, i]


(* ::Input::Initialization:: *)
Block[{i,j,k,l,m,n}, Subscript[a\[CapitalDelta], i_->j_,k_]=(Subscript[nR, n,j] Subscript[nR, m,k])~Subscript[B, n,m]~Subscript[bm, n,m->l]~Subscript[B, l]~Subscript[nP, l,i]];
Subscript[a\[CapitalDelta], i->j,k]


(* ::Input::Initialization:: *)
Block[{i,j,k,l,m,n}, Subscript[b\[CapitalDelta], i_->j_,k_]=(Subscript[nR, j,n] Subscript[nR, k,m])~Subscript[B, n,m]~Subscript[am, n,m->l]~Subscript[B, l]~Subscript[nP, i,l]];
Subscript[b\[CapitalDelta], i->j,k]



