We start by loading the package \verb$KnotTheory`$ --- it is only needed because it has many specific knots pre-defined. In this Section and in the next, $\face$ and \scalebox{0.66}{$\human$} mean ``human input'' while $\machine$ means ``computer output'':
{\def\nbpdfPostInput{\hfill}

\nbpdfInput{Snips/Implementation/1.pdf}
\nbpdfPrint{Snips/Implementation/2.pdf}
}
Next we quietly define the modules \verb$Rot$, used to compute rotation numbers, and \verb$PolyPlot$, used to plot polynomials as bar codes and as hexagonal QR codes. Neither is a part of the core of the computation of $\Theta$, so neither is shown; yet we do show one usage example for each.

\nbpdfInput{Snips/Implementation/3.pdf}
{\def\nbpdfPostInput{\hfill}

\nbpdfInput{Snips/Implementation/4.pdf}
\nbpdfMessage{Snips/Implementation/5.pdf}
\nbpdfOutput{Snips/Implementation/6.pdf}
}
We urge the reader to compare the above output with the knot diagram in Figure~\ref{fig:SampleDiagram}.

{\def\nbpdfPostInput{\hfill}

\nbpdfInput{Snips/Implementation/7.pdf}
\nbpdfOutput{Snips/Implementation/8.pdf}
}
The definition of \verb$CF$ below is a technicality telling the computer how to best store polynomials in the $g_{\nu\alpha\beta}$'s such as $F_1$ and $F_2$. The programs would run just the same without it, albeit a bit more slowly:

\nbpdfInput{Snips/Implementation/9.pdf}
Next, we decree that $T_3=T_1T_2$ and define the three ``Feynman Diagram'' polynomials $F_1$, $F_2$, and $F_3$:

\nbpdfInput{Snips/Implementation/10.pdf}
\nbpdfInput{Snips/Implementation/11.pdf}
\nbpdfInput{Snips/Implementation/12.pdf}
\nbpdfInput{Snips/Implementation/13.pdf}
Next comes the main program computing $\Theta(K)$. Fortunately, it matches perfectly with the mathematical description in Section~\ref{sec:MainTheorem}. In line 1 below we use \verb$Rot$ to let $X$ and $\varphi$ be the crossings and rotation numbers of $K$. In addition we let $n$ be the length of $X$, namely, the number of crossings in $K$, and we let the starting value of $A$ be the $(2n+1)\times(2n+1)$ identity matrix. Then in line 2, for each crossing in $X$ we add to $A$ a $2\times 2$ block, in rows $i$ and $j$ and columns $i+1$ and $j+1$, as explain in Equation~\eqref{eq:A}. In line 3 we compute the normalized Alexander polynomial $\Delta$ as in~\eqref{eq:Delta}. In line 4 we let $G$ be the inverse of $A$. In line 5 we declare what it means to evaluate, \verb$ev$, a formula $\calE$ that may contain symbols of the form $g_{\nu\alpha\beta}$: each such symbol is to be replaced by the entry in position $\alpha,\beta$ of $G$, but with $T$ replaced with $T_\nu$. In line 6 we start computing $\theta$ by computing the first summand in~\eqref{eq:Main}, which in itself, is a sum over the crossings of the knot. In line 7 we add to $\theta$ the double sum corresponding to the second term in~\eqref{eq:Main}, and in line 8, we add the third summand of~\eqref{eq:Main}. Finally, line 9 outputs a pair: $\Delta$, and the re-normalized version of $\theta$.

\nbpdfInput{Snips/Implementation/14.pdf}
\subsection{Examples} \label{ssec:Examples}
On to examples! Starting with the trefoil knot.

\nbpdfInput{Snips/Implementation/15.pdf}
\nbpdfMessage{Snips/Implementation/16.pdf}
\nbpdfOutput{Snips/Implementation/17.pdf}
%\needspace{2cm}
{\def\nbpdfPostInput{\hfill}

\nbpdfInput{Snips/Implementation/18.pdf}
\nbpdfMessage{Snips/Implementation/19.pdf}
\nbpdfOutput{Snips/Implementation/20.pdf}
}

\parpic[r]{\parbox{42mm}{
  \includegraphics[width=20mm]{figs/K11n34.png}\hfill\includegraphics[width=20mm]{figs/K11n42.png}
}}
Next are the Conway knot $11_{n34}$ and the Kinoshita-Terasaka knot $11_{n42}$. The two are mutants and famously hard to separate: they both have $\Delta=1$ (as evidenced by their one-bar Alexander bar codes below), and they have the same hyperbolic volume, HOMFLY-PT polynomial, and Khovanov homology. Yet their $\theta$ invariants are different. Note that the genus of the Conway knot is 3, while the genus of the Kinoshita-Terasaka knot is 2. This agrees with the higher complexity of the QR code of the Conway polynomial and with Theorem~\ref{thm:Genus} below.
{\def\nbpdfPostInput{\hfill}

\nbpdfInput{Snips/Implementation/21.pdf}
\nbpdfMessage{Snips/Implementation/22.pdf}
\nbpdfMessage{Snips/Implementation/23.pdf}
\nbpdfOutput{Snips/Implementation/24.pdf}
}

Torus knots have particularly nice-looking $\Theta$ invariants. Here are the torus knots $T_{13/2}$, $T_{17/3}$, $T_{13/5}$, and $T_{7/6}$:

\nbpdfInput{Snips/Implementation/25.pdf}
\nbpdfOutput{Snips/Implementation/26.pdf}
The next line shows the computation time in seconds for the 132-crossing torus knot $T_{22/7}$ on a 2024 laptop, without actually showing the output. The output plot is in Figure~\ref{fig:T227}.
{\def\nbpdfPostInput{\hfill}

\nbpdfInput{Snips/Implementation/27.pdf}
\nbpdfOutput{Snips/Implementation/28.pdf}
}
\begin{figure}

\nbpdfInput{Snips/Implementation/29.pdf}
\nbpdfOutput{Snips/Implementation/30.pdf}
\caption{The 132-crossing torus knot $T_{22/7}$ and a plot of its $\Theta$ invariant} \label{fig:T227}
\end{figure}

We note that if $T_1$ and $T_2$ are assigned specific rational numbers and if the program for $\Theta$ is slightly modified so as to compute each $G_\nu$ separately (rather than computing $G$ symbolically and then substituting $T\to T_\nu$), then the program becomes significantly more efficient, for inverting a numerical matrix is cheaper than inverting a symbolic matrix (but then one obtains numerical answers and the beauty and the topological significance (Section~\ref{sec:SandM}) are lost). The Mathematica notebook that accompanies this paper, \cite[Theta.nb]{Self}, contains the required modified program as well as a few computational examples. One finds that with $T_1=22/7$ and $T_2=21/13$, the invariant $\Theta$ can be computed for knots with 600 crossings, and that for knots with up to 15 crossings, its separation power remains the same.

If $T_1$ and $T_2$ are assigned approximate real values, say $\pi$ and $e$ computed to 100 decimal digits, then $\Theta$ can be computed on knots with 1,000 crossings and, for knots with up to 15 crossings it remains very strong. But approximate real numbers are a bit thorny. It is hard to know how far one needs to compute before deciding that two such numbers are equal, and when two such numbers appear unequal, it is hard to tell if that is merely because they were computed differently and different roundings were applied. Thorns and snares are in the way of the perverse; He who guards his soul will be far from them (Proverbs 22:5)\footnote{\quad.\cjRL{/swmr np/sw yr.hq}}.

