(* ::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\\Projects\\APAI"];
Once[<<KnotTheory`; <<Rot.m];


(* ::Input::Initialization:: *)
ConcaveQ[s_List]:=And@@Thread[2s[[2;;-2]]>=s[[1;;-3]]+s[[3;;-1]]];


(* ::Input::Initialization:: *)
AlexanderLogConcaveQ[K_]:=Module[{alex,T,cs},
alex=Alexander[K][-T];
cs=CoefficientList[Sign[alex/.T->1]T^Exponent[alex,T] alex,T];
If[Not[And@@(Positive/@cs)],Return@False];
If[Length[cs]<3, Return@True];
ConcaveQ[Log@cs]
]


(* ::Input::Initialization:: *)
Subscript[R, 1][s_,i_,j_]:=s(Subscript[g, j\[InvisibleComma]i](Subscript[g, SuperPlus[j],j]+Subscript[g, j,SuperPlus[j]]-Subscript[g, i\[InvisibleComma]j])-Subscript[g, i\[InvisibleComma]i](Subscript[g, j,SuperPlus[j]]-1)-1/2);
\[Rho][K_]:=\[Rho][K]=Module[{Cs,\[CurlyPhi],n,A,s,i,j,k,\[CapitalDelta],G,\[Rho]1},
{Cs,\[CurlyPhi]}=Rot[K]; n=Length[Cs];
A=IdentityMatrix[2n+1];
Cases[Cs,{s_,i_,j_}:>(A[[{i,j},{i+1,j+1}]]+=({
 {-T^s, T^s-1},
 {0, -1}
}))];
\[CapitalDelta]=T^((-Total[\[CurlyPhi]]-Total[Cs[[All,1]]])/2) Det[A];
G=Inverse[A];
\[Rho]1=\!\(
\*SubsuperscriptBox[\(\[Sum]\), \(k = 1\), \(n\)]\(
\*SubscriptBox[\(R\), \(1\)] @@ Cs[[k]]\)\) - \!\(
\*SubsuperscriptBox[\(\[Sum]\), \(k = 1\), \(2  n\)]\(\[CurlyPhi][[k]] \((
\*SubscriptBox[\(g\), \(k\[InvisibleComma]k\)] - 1/2)\)\)\);
Factor@{\[CapitalDelta],\[CapitalDelta]^2 \[Rho]1/.SuperPlus[\[Alpha]_]:>\[Alpha]+1/.Subscript[g, \[Alpha]_,\[Beta]_]:>G[[\[Alpha],\[Beta]]]}];


(* ::Input::Initialization:: *)
\[Rho]1LogConcaveQ[K_]:=Module[{\[Rho]1,cs},
\[Rho]1=Expand[\[Rho][K][[2]]/.T->-T];
cs=CoefficientList[Sign[\[Rho]1/.T->1]T^Exponent[\[Rho]1,T] \[Rho]1,T];
If[Not[And@@(Positive/@cs)],Return@False];
If[Length[cs]<3, Return@True];
ConcaveQ[Log@cs]
]



