Let us write a program to compute the Alexander polynomial using the method of operator invariant, a.k.a. R matrix. This method however is not very efficient. We will write a better algorithm in the next project

First we input the positive R matrix

RpM={{(t^(-1/2)),0,0,0},{0,0,1,0},{0,1,(t^(-(1/2)))-(t^(1/2)),0},{0,0,0,-(t^(1/2))}}

Now the rule to call the entries

Rp[i_,j_,k_,l_]:=Which[i==1&&k==1,RpM[[i+j-1,k+l-1]],i==1,RpM[[i+j-1,k+l]],k==1,RpM[[i+j,k+l-1]],True,RpM[[i+j,k+l]]]

Next we input the negative R matrix

RmM=Inverse[RpM]

and the rule to call the entries

Rm[i_,j_,k_,l_]:=Which[i==1&&k==1,RmM[[i+j-1,k+l-1]],i==1,RmM[[i+j-1,k+l]],k==1,RmM[[i+j,k+l-1]],True,RmM[[i+j,k+l]]]

Next we input the h matrix

h=DiagonalMatrix[{(t^(1/2)),-(t^(1/2))}]

Now we are ready to write the main program

Alexander[Knot_]:=Module[{m},
m=Max[List@@@List@@Knot];
Sum[Knot/.{
Xp[i_,j_,k_,l_]:> Rp[(Subscript[s, i]),(Subscript[s, j]),(Subscript[s, k]),(Subscript[s, l])],
Xm[i_,j_,k_,l_]:> Rm[(Subscript[s, i]),(Subscript[s, j]),(Subscript[s, k]),(Subscript[s, l])],
Cu[k_]:> ((h[[(Subscript[s, k]),(Subscript[s, k])]])^(-1)),
Ca[k_]:> h[[(Subscript[s, k]),(Subscript[s, k])]]
},##]&@@({(Subscript[s, #]),1,2}&/@Range[m])/2//Simplify
]

Now let’s compute a few knots. Notice there is a change in how we enter the knot. For the Alexander polynomial, we need to keep one component open. Hence, we present our knot as the closure of a braid, except we leave the first strand unclosed, we label the first strand by 1 and continue from top to bottom and we end with the label 1.

The trefoil

Alexander[Xp[4,1,2,5]Xp[2,5,6,3]Xp[6,3,4,1]Cu[4]]

The figure eight knot

Alexander[Ca[4]Ca[7]Xp[1,4,5,2]Xm[2,7,8,3]Xp[5,8,1,6]Xm[6,3,4,7]]

The Hopf link

Alexander[Ca[3]Xp[1,3,4,2]Xp[4,2,1,3]]

The (5,2) torus knot

Alexander[Ca[6]Xp[1,6,7,2]Xp[7,2,3,8]Xp[3,8,9,4]Xp[9,4,5,10]Xp[5,10,1,6]]