Jones Polynomial and Khovanov Homology, using Sage Math

This jupyter notebook needs Sage Math; I'm running SageMath 7.1


In [1]:
from kh_scrape import scrape_bat
Tknots14 = scrape_bat('khTknotsless14')

At this point, in Sage Math, one may need to declare the variables t and q (if one hasn't done so, already). One could try to declare them as generators of a polynomial ring or simply use var (EY: 20160503 I'm not sure what's the best practice; please let me know. Also with the polynomial ring, I'm not sure which field to use; I'll use the rationals first, QQ in Sage Math, and possibly one should try the complex numbers CC (with limited precision, because computers calculate in floats) or real numbers RR). I'll do the Polynomial Ring below:


In [4]:
PolyRing_QQ_qt = PolynomialRing(QQ,'q,t',2)
# one can also do the below; the problem with this syntax is when someone wants to 
# write functions or classes on top of this
# PolyRing_QQ_qt.<q,t> = PolynomialRing(QQ,2)

In [6]:
PolyRing_QQ_qt.<q,t> = PolynomialRing(QQ,2)

In [7]:
Tknots14sage = [ sage_eval(line,locals={'x1':t, 'x2':q}) for line in Tknots14]

In [8]:
Tknots14sage[0]


Out[8]:
(q^2 + 1)/q

In [9]:
latex(Tknots14sage[1].factor())


Out[9]:
q \cdot (q^{2} + 1) \cdot (q^{6} t^{3} + q^{4} t^{2} + 1)

$q \cdot (q^{2} + 1) \cdot (q^{6} t^{3} + q^{4} t^{2} + 1)$

If you want to plug in values for q,t you can't simply do substitute module .subs: q,t in the polynomial ring are not variables (i.e. you didn't declare them with var; e.g. q = var('q'). See this page, Evaluation of multivariate functions and so we "evaluate" the polynomials "by the arguments" in the parentheses:


In [10]:
Tknots14sage[1](t=1); latex(Tknots14sage[1](t=1))


Out[10]:
q^{9} + 2 q^{7} + q^{5} + q^{3} + q

$q^{9} + 2 q^{7} + q^{5} + q^{3} + q$


In [11]:
Tknots14sage[1](t=1).factor()


Out[11]:
q * (q^2 + 1) * (q^6 + q^4 + 1)

In [12]:
Tknots14sage[0](q=e**(2*pi*I/6)).simplify()


Out[12]:
((1/2*I*sqrt(3) + 1/2)^2 + 1)/(1/2*I*sqrt(3) + 1/2)

For all Torus knots of less than 14 crossings: The Jones polynomial with Khovanov Homology


In [13]:
for i in range(len(Tknots14sage)): print Tknots14sage[i]


(q^2 + 1)/q
q^9*t^3 + q^7*t^3 + q^7*t^2 + q^5*t^2 + q^3 + q
q^15*t^5 + q^13*t^5 + q^13*t^4 + q^11*t^4 + q^11*t^3 + q^9*t^3 + q^9*t^2 + q^7*t^2 + q^5 + q^3
q^21*t^7 + q^19*t^7 + q^19*t^6 + q^17*t^6 + q^17*t^5 + q^15*t^5 + q^15*t^4 + q^13*t^4 + q^13*t^3 + q^11*t^3 + q^11*t^2 + q^9*t^2 + q^7 + q^5
q^27*t^9 + q^25*t^9 + q^25*t^8 + q^23*t^8 + q^23*t^7 + q^21*t^7 + q^21*t^6 + q^19*t^6 + q^19*t^5 + q^17*t^5 + q^17*t^4 + q^15*t^4 + q^15*t^3 + q^13*t^3 + q^13*t^2 + q^11*t^2 + q^9 + q^7
q^33*t^11 + q^31*t^11 + q^31*t^10 + q^29*t^10 + q^29*t^9 + q^27*t^9 + q^27*t^8 + q^25*t^8 + q^25*t^7 + q^23*t^7 + q^23*t^6 + q^21*t^6 + q^21*t^5 + q^19*t^5 + q^19*t^4 + q^17*t^4 + q^17*t^3 + q^15*t^3 + q^15*t^2 + q^13*t^2 + q^11 + q^9
q^39*t^13 + q^37*t^13 + q^37*t^12 + q^35*t^12 + q^35*t^11 + q^33*t^11 + q^33*t^10 + q^31*t^10 + q^31*t^9 + q^29*t^9 + q^29*t^8 + q^27*t^8 + q^27*t^7 + q^25*t^7 + q^25*t^6 + q^23*t^6 + q^23*t^5 + q^21*t^5 + q^21*t^4 + q^19*t^4 + q^19*t^3 + q^17*t^3 + q^17*t^2 + q^15*t^2 + q^13 + q^11
q^17*t^5 + q^15*t^5 + q^13*t^4 + q^13*t^3 + q^11*t^4 + q^11*t^3 + q^11*t^2 + q^9*t^2 + q^7 + q^5
q^21*t^7 + q^19*t^7 + q^19*t^6 + q^19*t^5 + q^17*t^6 + q^17*t^5 + q^15*t^4 + q^15*t^3 + q^13*t^4 + q^13*t^3 + q^13*t^2 + q^11*t^2 + q^9 + q^7

In [26]:
for i in range(len(Tknots14sage)): print Tknots14sage[i], '\n', latex(Tknots14sage[i])


(q^2 + 1)/q 
\frac{q^{2} + 1}{q}
q^9*t^3 + q^7*t^3 + q^7*t^2 + q^5*t^2 + q^3 + q 
q^{9} t^{3} + q^{7} t^{3} + q^{7} t^{2} + q^{5} t^{2} + q^{3} + q
q^15*t^5 + q^13*t^5 + q^13*t^4 + q^11*t^4 + q^11*t^3 + q^9*t^3 + q^9*t^2 + q^7*t^2 + q^5 + q^3 
q^{15} t^{5} + q^{13} t^{5} + q^{13} t^{4} + q^{11} t^{4} + q^{11} t^{3} + q^{9} t^{3} + q^{9} t^{2} + q^{7} t^{2} + q^{5} + q^{3}
q^21*t^7 + q^19*t^7 + q^19*t^6 + q^17*t^6 + q^17*t^5 + q^15*t^5 + q^15*t^4 + q^13*t^4 + q^13*t^3 + q^11*t^3 + q^11*t^2 + q^9*t^2 + q^7 + q^5 
q^{21} t^{7} + q^{19} t^{7} + q^{19} t^{6} + q^{17} t^{6} + q^{17} t^{5} + q^{15} t^{5} + q^{15} t^{4} + q^{13} t^{4} + q^{13} t^{3} + q^{11} t^{3} + q^{11} t^{2} + q^{9} t^{2} + q^{7} + q^{5}
q^27*t^9 + q^25*t^9 + q^25*t^8 + q^23*t^8 + q^23*t^7 + q^21*t^7 + q^21*t^6 + q^19*t^6 + q^19*t^5 + q^17*t^5 + q^17*t^4 + q^15*t^4 + q^15*t^3 + q^13*t^3 + q^13*t^2 + q^11*t^2 + q^9 + q^7 
q^{27} t^{9} + q^{25} t^{9} + q^{25} t^{8} + q^{23} t^{8} + q^{23} t^{7} + q^{21} t^{7} + q^{21} t^{6} + q^{19} t^{6} + q^{19} t^{5} + q^{17} t^{5} + q^{17} t^{4} + q^{15} t^{4} + q^{15} t^{3} + q^{13} t^{3} + q^{13} t^{2} + q^{11} t^{2} + q^{9} + q^{7}
q^33*t^11 + q^31*t^11 + q^31*t^10 + q^29*t^10 + q^29*t^9 + q^27*t^9 + q^27*t^8 + q^25*t^8 + q^25*t^7 + q^23*t^7 + q^23*t^6 + q^21*t^6 + q^21*t^5 + q^19*t^5 + q^19*t^4 + q^17*t^4 + q^17*t^3 + q^15*t^3 + q^15*t^2 + q^13*t^2 + q^11 + q^9 
q^{33} t^{11} + q^{31} t^{11} + q^{31} t^{10} + q^{29} t^{10} + q^{29} t^{9} + q^{27} t^{9} + q^{27} t^{8} + q^{25} t^{8} + q^{25} t^{7} + q^{23} t^{7} + q^{23} t^{6} + q^{21} t^{6} + q^{21} t^{5} + q^{19} t^{5} + q^{19} t^{4} + q^{17} t^{4} + q^{17} t^{3} + q^{15} t^{3} + q^{15} t^{2} + q^{13} t^{2} + q^{11} + q^{9}
q^39*t^13 + q^37*t^13 + q^37*t^12 + q^35*t^12 + q^35*t^11 + q^33*t^11 + q^33*t^10 + q^31*t^10 + q^31*t^9 + q^29*t^9 + q^29*t^8 + q^27*t^8 + q^27*t^7 + q^25*t^7 + q^25*t^6 + q^23*t^6 + q^23*t^5 + q^21*t^5 + q^21*t^4 + q^19*t^4 + q^19*t^3 + q^17*t^3 + q^17*t^2 + q^15*t^2 + q^13 + q^11 
q^{39} t^{13} + q^{37} t^{13} + q^{37} t^{12} + q^{35} t^{12} + q^{35} t^{11} + q^{33} t^{11} + q^{33} t^{10} + q^{31} t^{10} + q^{31} t^{9} + q^{29} t^{9} + q^{29} t^{8} + q^{27} t^{8} + q^{27} t^{7} + q^{25} t^{7} + q^{25} t^{6} + q^{23} t^{6} + q^{23} t^{5} + q^{21} t^{5} + q^{21} t^{4} + q^{19} t^{4} + q^{19} t^{3} + q^{17} t^{3} + q^{17} t^{2} + q^{15} t^{2} + q^{13} + q^{11}
q^17*t^5 + q^15*t^5 + q^13*t^4 + q^13*t^3 + q^11*t^4 + q^11*t^3 + q^11*t^2 + q^9*t^2 + q^7 + q^5 
q^{17} t^{5} + q^{15} t^{5} + q^{13} t^{4} + q^{13} t^{3} + q^{11} t^{4} + q^{11} t^{3} + q^{11} t^{2} + q^{9} t^{2} + q^{7} + q^{5}
q^21*t^7 + q^19*t^7 + q^19*t^6 + q^19*t^5 + q^17*t^6 + q^17*t^5 + q^15*t^4 + q^15*t^3 + q^13*t^4 + q^13*t^3 + q^13*t^2 + q^11*t^2 + q^9 + q^7 
q^{21} t^{7} + q^{19} t^{7} + q^{19} t^{6} + q^{19} t^{5} + q^{17} t^{6} + q^{17} t^{5} + q^{15} t^{4} + q^{15} t^{3} + q^{13} t^{4} + q^{13} t^{3} + q^{13} t^{2} + q^{11} t^{2} + q^{9} + q^{7}

$\frac{q^{2} + 1}{q}$
$q^{9} t^{3} + q^{7} t^{3} + q^{7} t^{2} + q^{5} t^{2} + q^{3} + q$
$q^{15} t^{5} + q^{13} t^{5} + q^{13} t^{4} + q^{11} t^{4} + q^{11} t^{3} + q^{9} t^{3} + q^{9} t^{2} + q^{7} t^{2} + q^{5} + q^{3}$
$q^{21} t^{7} + q^{19} t^{7} + q^{19} t^{6} + q^{17} t^{6} + q^{17} t^{5} + q^{15} t^{5} + q^{15} t^{4} + q^{13} t^{4} + q^{13} t^{3} + q^{11} t^{3} + q^{11} t^{2} + q^{9} t^{2} + q^{7} + q^{5}$
$q^{27} t^{9} + q^{25} t^{9} + q^{25} t^{8} + q^{23} t^{8} + q^{23} t^{7} + q^{21} t^{7} + q^{21} t^{6} + q^{19} t^{6} + q^{19} t^{5} + q^{17} t^{5} + q^{17} t^{4} + q^{15} t^{4} + q^{15} t^{3} + q^{13} t^{3} + q^{13} t^{2} + q^{11} t^{2} + q^{9} + q^{7}$
$q^{33} t^{11} + q^{31} t^{11} + q^{31} t^{10} + q^{29} t^{10} + q^{29} t^{9} + q^{27} t^{9} + q^{27} t^{8} + q^{25} t^{8} + q^{25} t^{7} + q^{23} t^{7} + q^{23} t^{6} + q^{21} t^{6} + q^{21} t^{5} + q^{19} t^{5} + q^{19} t^{4} + q^{17} t^{4} + q^{17} t^{3} + q^{15} t^{3} + q^{15} t^{2} + q^{13} t^{2} + q^{11} + q^{9}$
$q^{39} t^{13} + q^{37} t^{13} + q^{37} t^{12} + q^{35} t^{12} + q^{35} t^{11} + q^{33} t^{11} + q^{33} t^{10} + q^{31} t^{10} + q^{31} t^{9} + q^{29} t^{9} + q^{29} t^{8} + q^{27} t^{8} + q^{27} t^{7} + q^{25} t^{7} + q^{25} t^{6} + q^{23} t^{6} + q^{23} t^{5} + q^{21} t^{5} + q^{21} t^{4} + q^{19} t^{4} + q^{19} t^{3} + q^{17} t^{3} + q^{17} t^{2} + q^{15} t^{2} + q^{13} + q^{11}$
$q^{17} t^{5} + q^{15} t^{5} + q^{13} t^{4} + q^{13} t^{3} + q^{11} t^{4} + q^{11} t^{3} + q^{11} t^{2} + q^{9} t^{2} + q^{7} + q^{5}$
$q^{21} t^{7} + q^{19} t^{7} + q^{19} t^{6} + q^{19} t^{5} + q^{17} t^{6} + q^{17} t^{5} + q^{15} t^{4} + q^{15} t^{3} + q^{13} t^{4} + q^{13} t^{3} + q^{13} t^{2} + q^{11} t^{2} + q^{9} + q^{7}$

Calculations dealing with the $\theta$ term


In [28]:
theta = var('theta',domain='real')
g = var('g',domain='real')
N = var('N')
# N = var('N','integer')

In [18]:
k = theta*g**2/(2*pi)

In [30]:
q_to_subst = exp( 2*pi*I/(N +k ))

In [34]:
q_to_subst.subs(N==2)
q_to_subst.subs(N==3)


Out[34]:
e^(4*I*pi/(g^2*theta/pi + 6))

In [51]:
latex(Tknots14sage[0](q=q_to_subst.subs(N==2)))


Out[51]:
{\left(e^{\left(\frac{8 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + 1\right)} e^{\left(-\frac{4 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)}

In [49]:
latex(Tknots14sage[0](q=q_to_subst.subs(N==2)).real())


Out[49]:
\cos\left(\frac{4 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \cos\left(-\frac{4 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)

In [50]:
latex(Tknots14sage[0](q=q_to_subst.subs(N==2)).imag())


Out[50]:
\sin\left(\frac{4 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \sin\left(-\frac{4 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)

In [52]:
latex( Tknots14sage[1](q=q_to_subst.subs(N==2)) )


Out[52]:
t^{3} e^{\left(\frac{36 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + t^{3} e^{\left(\frac{28 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + t^{2} e^{\left(\frac{28 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + t^{2} e^{\left(\frac{20 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + e^{\left(\frac{12 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + e^{\left(\frac{4 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)}

In [53]:
latex( Tknots14sage[1](q=q_to_subst.subs(N==2)).real() )


Out[53]:
-3 \, \cos\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right)^{2} \Re \left( t \right) - 3 \, \cos\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right)^{2} \Re \left( t \right) + \cos\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Re \left( t \right)^{3} + \cos\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Re \left( t \right)^{3} + \Im \left( t \right)^{3} \sin\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) - 3 \, \Im \left( t \right) \Re \left( t \right)^{2} \sin\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \Im \left( t \right)^{3} \sin\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) - 3 \, \Im \left( t \right) \Re \left( t \right)^{2} \sin\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) - \cos\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right)^{2} - \cos\left(\frac{20 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right)^{2} + \cos\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Re \left( t \right)^{2} + \cos\left(\frac{20 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Re \left( t \right)^{2} - 2 \, \Im \left( t \right) \Re \left( t \right) \sin\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) - 2 \, \Im \left( t \right) \Re \left( t \right) \sin\left(\frac{20 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \cos\left(\frac{12 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \cos\left(\frac{4 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)

In [54]:
latex( Tknots14sage[1](q=q_to_subst.subs(N==2)).imag() )


Out[54]:
-\cos\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right)^{3} - \cos\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right)^{3} + 3 \, \cos\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right) \Re \left( t \right)^{2} + 3 \, \cos\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right) \Re \left( t \right)^{2} - 3 \, \Im \left( t \right)^{2} \Re \left( t \right) \sin\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \Re \left( t \right)^{3} \sin\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) - 3 \, \Im \left( t \right)^{2} \Re \left( t \right) \sin\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \Re \left( t \right)^{3} \sin\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + 2 \, \cos\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right) \Re \left( t \right) + 2 \, \cos\left(\frac{20 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) \Im \left( t \right) \Re \left( t \right) - \Im \left( t \right)^{2} \sin\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \Re \left( t \right)^{2} \sin\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) - \Im \left( t \right)^{2} \sin\left(\frac{20 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \Re \left( t \right)^{2} \sin\left(\frac{20 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \sin\left(\frac{12 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \sin\left(\frac{4 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)

In [56]:
latex( Tknots14sage[1](q=q_to_subst.subs(N==2),t=1) )


Out[56]:
e^{\left(\frac{36 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + 2 \, e^{\left(\frac{28 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + e^{\left(\frac{20 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + e^{\left(\frac{12 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)} + e^{\left(\frac{4 i \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)}

In [57]:
latex( Tknots14sage[1](q=q_to_subst.subs(N==2),t=1).real() )


Out[57]:
\cos\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + 2 \, \cos\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \cos\left(\frac{20 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \cos\left(\frac{12 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \cos\left(\frac{4 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)

In [58]:
latex( Tknots14sage[1](q=q_to_subst.subs(N==2),t=1).imag() )


Out[58]:
\sin\left(\frac{36 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + 2 \, \sin\left(\frac{28 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \sin\left(\frac{20 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \sin\left(\frac{12 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right) + \sin\left(\frac{4 \, \pi}{\frac{g^{2} \theta}{\pi} + 4}\right)

In [ ]: