Hi, and excume me to disturbe. I'm using sage 10.4 (with python3.12.7) for topology knot invariant calculation.
My program is as follows:
from sage.all import *
ans = Knot([[1, 5, 2, 4], [3, 7, 4, 6], [5, 3, 6, 2], [7, 13, 8, 12], [9, 18, 10, 19], [11, 15, 12, 14], [13, 9, 14, 8], [15, 22, 16, 1], [17, 20, 18, 21], [19, 10, 20, 11], [21, 16, 22, 17]]).colored_jones_polynomial(2)
In this program [[1, 5, 2, 4], [3, 7, 4, 6], [5, 3, 6, 2], [7, 13, 8, 12], [9, 18, 10, 19], [11, 15, 12, 14], [13, 9, 14, 8], [15, 22, 16, 1], [17, 20, 18, 21], [19, 10, 20, 11], [21, 16, 22, 17]]
is a pd_code of knot K3a1#K8a8
.
But the program never seems to return.
When I tried to calculate the same invariant in mathematica, it return at once and i get the polynomial:
1/q^13 - 2/q^12 - 1/q^11 + 7/q^10 - 6/q^9 - 8/q^8 + 21/q^7 - 10/q^6 - 25/q^5 + 43/q^4 - 10/q^3 - 52/q^2 + 68/q - 82 q + 83 q^2 + 14 q^3 - 101 q^4 + 80 q^5 + 25 q^6 - 98 q^7 + 65 q^8 + 25 q^9 - 74 q^10 + 42 q^11 + 17 q^12 - 40 q^13 + 20 q^14 + 7 q^15 - 14 q^16 + 7 q^17 + q^18 - 3 q^19 + q^20
Which means that maybe something is wrong with the implementation in sage.
Besides, I used Ctrl+C to interrupt this program and I found that, according to the stack trace, the program seems to stop in a function called hash
all the time.
If anyone has knowledge of this issue and is willing to help, I would greatly appreciate it.
I tried all prime/non-prime knots no more than 11-crossing that I know (1782 knots are tested) for 2-colored and 3-colored jones polynomial, and only 32% of the function call can return in one minute.
A usual stack trace is lised as follows:
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
Cell In[2], line 1
----> 1 ans = Knot([[Integer(1), Integer(5), Integer(2), Integer(4)], [Integer(3), Integer(7), Integer(4), Integer(6)], [Integer(5), Integer(3), Integer(6), Integer(2)], [Integer(7), Integer(13), Integer(8), Integer(12)], [Integer(9), Integer(18), Integer(10), Integer(19)], [Integer(11), Integer(15), Integer(12), Integer(14)], [Integer(13), Integer(9), Integer(14), Integer(8)], [Integer(15), Integer(22), Integer(16), Integer(1)], [Integer(17), Integer(20), Integer(18), Integer(21)], [Integer(19), Integer(10), Integer(20), Integer(11)], [Integer(21), Integer(16), Integer(22), Integer(17)]]).colored_jones_polynomial(Integer(2))
File ~/.local/mambaforge/envs/sage_env/lib/python3.12/site-packages/sage/knots/knot.py:388, in Knot.colored_jones_polynomial(self, N, variab, try_inverse)
353 def colored_jones_polynomial(self, N, variab=None, try_inverse=True):
354 r"""
355 Return the colored Jones polynomial of the trace closure of the braid.
356
(...)
386 (t^3 + 3*t^2 + 4*t + 1)/(t^4 + 4*t^3 + 6*t^2 + 4*t + 1)
387 """
--> 388 return self.braid().colored_jones_polynomial(N=N, variab=variab,
389 try_inverse=try_inverse)
File ~/.local/mambaforge/envs/sage_env/lib/python3.12/site-packages/sage/groups/braid.py:2242, in Braid.colored_jones_polynomial(self, N, variab, try_inverse)
2239 shorter_qword = qword_inv if use_inverse else qword
2240 knot = Knot(self.inverse()) if use_inverse else Knot(self)
2241 cj = (q**((N - 1) * (knot.writhe() - self.strands() + 1) / 2)
-> 2242 * self._colored_jones_sum(N, shorter_qword))
2243 self._cj_with_q[N] = cj.subs({q: 1/q}) if use_inverse else cj
2244 return self.colored_jones_polynomial(N, variab, try_inverse)
File ~/.local/mambaforge/envs/sage_env/lib/python3.12/site-packages/sage/groups/braid.py:2163, in Braid._colored_jones_sum(self, N, qword)
2159 # This seemingly infinite sum is always finite if the qword comes
2160 # from a sum of quantum determinants; because at some point
2161 # the break condition will become true.
2162 while continue_summing:
-> 2163 current_word *= rqword
2164 new_rqw = RightQuantumWord(alg(current_word))
2165 current_word = new_rqw.reduced_word()
File ~/.local/mambaforge/envs/sage_env/lib/python3.12/site-packages/sage/structure/element.pyx:1510, in sage.structure.element.Element.__mul__ (build/cythonized/sage/structure/element.c:20246)()
1508 cdef int cl = classify_elements(left, right)
1509 if HAVE_SAME_PARENT(cl):
-> 1510 return (<Element>left)._mul_(right)
1511 if BOTH_ARE_ELEMENT(cl):
1512 return coercion_model.bin_op(left, right, mul)
File ~/.local/mambaforge/envs/sage_env/lib/python3.12/site-packages/sage/structure/element.pyx:1556, in sage.structure.element.Element._mul_ (build/cythonized/sage/structure/element.c:20605)()
1554 raise bin_op_exception('*', self, other)
1555 else:
-> 1556 return python_op(other)
1557
1558 cdef _mul_long(self, long n):
File ~/.local/mambaforge/envs/sage_env/lib/python3.12/site-packages/sage/algebras/free_algebra_element.py:201, in FreeAlgebraElement._mul_(self, y)
199 z_elt[key] += cx*cy
200 else:
--> 201 z_elt[key] = cx*cy
202 if not z_elt[key]:
203 del z_elt[key]
File ~/.local/mambaforge/envs/sage_env/lib/python3.12/site-packages/sage/monoids/free_monoid_element.py:102, in FreeMonoidElement.__hash__(self)
90 def __hash__(self):
91 r"""
92 TESTS::
93
(...)
100 True
101 """
--> 102 return hash(tuple(self._element_list))
File src/cysignals/signals.pyx:310, in cysignals.signals.python_check_interrupt()
KeyboardInterrupt: