(* ::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:: *)
Once[<< KnotTheory`]


(* ::Input::Initialization:: *)
MatrixSignature[A_]:=Total[Sign[Select[Eigenvalues[A],Abs[#]>10^-12&]]];
Writhe[K_]:=Sum[If[PositiveQ[x],1,-1], {x,List@@PD@K}];


(* ::Input::Initialization:: *)
Kas[K_,u_]:=Kas[K,u]=Module[{v,XingsByArmpits,bends,faces,p,A,is},
v=2u^2-1 ;
XingsByArmpits=List@@PD[K]/.x:X[i_,j_,k_,l_]:>If[PositiveQ[x],SubPlus[X][-i,j,k,-l],SubMinus[X][-j,k,l,-i]];
bends=Times@@XingsByArmpits/._[X][a_,b_,c_,d_]:>Subscript[p, a,-d] Subscript[p, b,-a] Subscript[p, c,-b] Subscript[p, d,-c];
faces=bends//.Subscript[p, x__,y_] Subscript[p, y_,z__]:>Subscript[p, x,y,z];
A=Table[0,Length@faces,Length@faces];
Do[is=Position[faces,#][[1,1]]& /@ List@@x;
A[[is,is]]+=If[Head[x]===SubPlus[X],
\!\(\*
TagBox[
RowBox[{"(", GridBox[{
{"v", "u", "1", "u"},
{"u", "1", "u", "1"},
{"1", "u", "v", "u"},
{"u", "1", "u", "1"}
},
GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}},
GridBoxSpacings->{"Columns" -> {Offset[0.27999999999999997`], {Offset[0.7]}, Offset[0.27999999999999997`]}, "Rows" -> {Offset[0.2], {Offset[0.4]}, Offset[0.2]}}], ")"}],
Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]\),\!\(\*
TagBox[
RowBox[{"-", 
RowBox[{"(", GridBox[{
{"v", "u", "1", "u"},
{"u", "1", "u", "1"},
{"1", "u", "v", "u"},
{"u", "1", "u", "1"}
},
GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}},
GridBoxSpacings->{"Columns" -> {Offset[0.27999999999999997`], {Offset[0.7]}, Offset[0.27999999999999997`]}, "Rows" -> {Offset[0.2], {Offset[0.4]}, Offset[0.2]}}], ")"}]}],
Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]\)],
{x,XingsByArmpits}];
A ];


(* ::Input::Initialization:: *)
PD[Subscript[8, 2]]=PD[X[10,1,11,2], X[2,11,3,12],X[12,3,13,4],X[4,13,5,14],X[14,5,15,6],X[8,16,9,15],X[16,8,1,7],X[6,9,7,10]];



