
(*This is the Mathematica file which computes
the bounds on the terms mu_4,mu_5,mu_6,mu_7 from
Chapter 6 of the paper, which deals with the
Hessian of the energy. These involve the
maximum of the derivatives evaluated at the 
TBP*)



(*Here are the basic functions*)

f[a_,b_]:= (4*(a^2 + b^2))/(1 + a^2 + b^2)

g[a_,b_,c_,d_]:= (4*(1 + 2*a*c + a^2*c^2 + b^2*c^2 + 
                  2*b*d + a^2*d^2 + b^2*d^2))/
                  ((1 + a^2 + b^2)*(1 + c^2 + d^2))
 

(**These take partial Kth derivative of f and evaluates at
   the TBP configuration*)

DF[K_,j_,k_]:=(
P1=D[Power[f[a,b],k],{a,j},{b,K-j}];
a=0;b=0;
P2=P1;

(*This defines the TBP configuration*)
a=1;b=0;
P3=P1;
a=-1/2;b=Sqrt[3]/2;
P4=P1;
a=-1/2;b=-Sqrt[3]/2;
P5=P1;
Clear[a,b];
{P2,P3,P4,P5})

(*This does the same for g*)

DG[K_,j1_,j2_,j3_,k_]:=(
P1=D[Power[g[a,b,c,d],k],{a,j1},{b,j2},{c,j3},{d,K-j1-j2-j3}];
a=0;b=0;c=1;d=0;
P2=Abs[P1];
a=0;b=0;c=-1/2;d=Sqrt[3]/2;
P3=Abs[P1];
a=-1/2;b=Sqrt[3]/2;c=-1/2;d=-Sqrt[3]/2;
P4=Abs[P1];
a=1;b=0;c=-1/2;d=Sqrt[3]/2;
P5=Abs[P1];
Clear[a,b,c,d];
Max[{P2,P2,P4,P5}])

(*These take the max of all these quantities*)

MaxF[K_,EXP_]:=Max[Abs[Flatten[Table[Table[DF[K,j,EXP],{j,0,K}]]]]]

MaxG[K_,EXP_]:=Max[Abs[Flatten[Table[Table[Table[Table[DG[K,j1,j2,j3,EXP],{j1,0,K-j2-j3}],{j2,0,K-j3}],{j3,0,K}]]]]]


MuStar[K_,EXP_,n_]:=(
EPSILON=Power[2,-n];
LIST={MaxF[K,EXP],MaxG[K,EXP]};
TOTAL=LIST.{1,3};
BOUND=TOTAL Power[7 EPSILON,K-3]/(K-3)!;
BOUND)

(*This computes the quantities
mu3*,mu4*,mu5*,mu6* (K=3,4,5,6)
for the exponents EXP=2,3,4,5,6,10
and produces the table of bounds
given in Chapter 6.*)

MatrixForm[Floor[Table[Table[MuStar[K,EXP,15],{K,4,7}],{EXP,2,10}]+1]]


