(* ::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\\Signatures"];
Once[<<KnotTheory`]


(* ::Input::Initialization:: *)
A1[K_]:=Module[{spd,x,a,s=0,c,cs,A,is,M,es},
spd=(Times@@PD[K])/.x_X:>If[PositiveQ@x,Xp@@x,Xm@@x];
cs=spd/.{
Xp[i_,j_,k_,l_]:>a[j,++s,i]a[k,++s,-j]a[-l,++s,-k]a[-i,++s,l],Xm[i_,j_,k_,l_]:>a[-j,++s,i]a[k,++s,j]a[l,++s,-k]a[-i,++s,-l]
}//.a[i_,x__,j_]a[j_,y__,k_]:>a[i,x,y,k]/.a[i_,x__,j_]:>a[x];
A=Table[0,{Length[cs]},{Length[cs]}];
Do[is=Position[cs,#][[1,1]]&/@(4i-{3,2,1,0});
A[[is,is]]+=If[Head[spd[[i]]]===Xp,\!\(\*
TagBox[
RowBox[{"(", "", GridBox[{
{"0", "0", "0", "0"},
{"1", 
RowBox[{"-", "1"}], "0", "0"},
{"0", 
RowBox[{"-", "1"}], "0", "1"},
{
RowBox[{"-", "1"}], "2", "0", 
RowBox[{"-", "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[{"(", "", GridBox[{
{"1", 
RowBox[{"-", "1"}], "0", "0"},
{"0", "0", "0", "0"},
{
RowBox[{"-", "2"}], "1", "1", "0"},
{"1", "0", 
RowBox[{"-", "1"}], "0"}
},
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$]]]\)],
{i,Length[spd]} ];
MatrixForm[M=Factor[(\[Omega] A-A\[Transpose])/2]];
es=DeleteCases[Eigenvalues[M],0];
Simplify[Times@@es] ];


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


(* ::Input::Initialization:: *)
A2[K_]:=Module[{spd,x,a,s=0,c,cs,A,is,M,es},
spd=(Times@@PD[K])/.x_X:>If[PositiveQ@x,Xp@@x,Xm@@x];
cs=spd/.{
Xp[i_,j_,k_,l_]:>a[j,++s,i]a[k,++s,-j]a[-l,++s,-k]a[-i,++s,l],Xm[i_,j_,k_,l_]:>a[-j,++s,i]a[k,++s,j]a[l,++s,-k]a[-i,++s,-l]
}//.a[i_,x__,j_]a[j_,y__,k_]:>a[i,x,y,k]/.a[i_,x__,j_]:>a[x];
A=Table[0,{Length[cs]},{Length[cs]}];
Do[is=Position[cs,#][[1,1]]&/@(4i-{3,2,1,0});
A[[is,is]]+=If[Head[spd[[i]]]===Xp,\!\(\*
TagBox[
RowBox[{"(", "", GridBox[{
{"0", "0", "0", "0"},
{"1", 
RowBox[{"-", "1"}], "0", "0"},
{"0", 
RowBox[{"-", "1"}], "0", "1"},
{
RowBox[{"-", "1"}], "2", "0", 
RowBox[{"-", "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[{"(", "", GridBox[{
{"1", 
RowBox[{"-", "1"}], "0", "0"},
{"0", "0", "0", "0"},
{
RowBox[{"-", "2"}], "1", "1", "0"},
{"1", "0", 
RowBox[{"-", "1"}], "0"}
},
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$]]]\)],
{i,Length[spd]} ];
MatrixForm[M=Factor[(\[Omega] A-A\[Transpose])/2]];
es=DeleteCases[Eigenvalues[M],0];
{Length@spd,Length@es, MatrixSignature[A+A\[Transpose]],-KnotSignature[K],KnotDet[K],Writhe[K],Simplify[Times@@es/Alexander[K][\[Omega]]],K}
];



