(* ::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"];


(* ::Input::Initialization:: *)
Once[<<KnotTheory`; <<Rot.m];


(* ::Input::Initialization:: *)
As[K_]:=Module[{Cs,\[CurlyPhi],n,A,A1,A2,A3,A4,A5,s,i,j,\[CapitalDelta]},
{Cs,\[CurlyPhi]}=Rot[K]; n=Length[Cs];
A5=A4=A3=A2=A1=A=IdentityMatrix[2n+1];
Cases[Cs,{s_,i_,j_}:>(
A[[{i,j},{i+1,j+1}]]+=({
 {-T^s, T^s-1},
 {0, -1}
});
A1[[{i,j},{i+1,j+1}]]+=({
 {-1, T^s-1},
 {0, -T^s}
});
A2[[{i,j},{i+1,j+1}]]+=({
 {-1, 0},
 {T^s-1, -T^s}
});
A3[[{i,j},{i+1,j+1}]]+=({
 {-1, 0},
 {T^-s-1, -T^-s}
});
A4[[{i,j},{i+1,j+1}]]+=T^-s ({
 {-T^s, T^s-1},
 {0, -1}
});
A5[[{i,j},{i+1,j+1}]]+=({
 {-T^s, T^s-1},
 {0, -1}
});
)];
\[CapitalDelta]=T^((-Total[\[CurlyPhi]]-Total[Cs[[All,1]]])/2) Det[A];
Factor@{\[CapitalDelta],\[CapitalDelta]^-1 Det[A1],\[CapitalDelta]^-1 Det[A2],\[CapitalDelta]^-1 Det[A3],\[CapitalDelta]^-1 Det[A4]}
];


(* ::Input::Initialization:: *)
PAQ[K_]:=Module[{Cs,\[CurlyPhi],n,P,A,Q,s,i,j,\[CapitalDelta]},
{Cs,\[CurlyPhi]}=Rot[K]; n=Length[Cs];
P=A=Q=IdentityMatrix[2n+1];
Cases[Cs,{s_,i_,j_}:>(
P[[{i,j},{i,j}]]=({
 {-T^-s, T^-s-1},
 {0, -1}
});
A[[{i,j},{i+1,j+1}]]+=({
 {-T^s, T^s-1},
 {0, -1}
});
Q[[{i+1,j+1},{i+1,j+1}]]=({
 {1, 0},
 {0, 1}
});
)];
\[CapitalDelta]=T^((-Total[\[CurlyPhi]]-Total[Cs[[All,1]]])/2) Det[A];
Expand@{P,A,Q,P . A . Q}
];



