-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Hi,
Thank you so much for your tool! I seem to be running into issued when using k.alexandar_polynomial(). I am generating a set of points routed as shown below and I would like to verify if the knot is the unknot. But when I run k.alexandar_polynomial i get an IndexError: list index out of range. I would please appreciate some insight as to why I am getting this error.
Below is my code, the error, and an image of my "knot":
k = Knot(points)
alexander_polynomial = k.alexander_polynomial()
# Check if the Alexander polynomial is that of the unknot (constant)
is_unknot = alexander_polynomial == 1
if is_unknot:
print("The knot is the unknot.")
else:
print("The knot is not the unknot.")
# end if-else
Finding crossings
i = 500 / 591
8.0 crossings found
Simplifying: initially 16 crossings
Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?c38ae515-daee-4653-8392-3776c05466cc)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[20], line 2
1 k = Knot(points)
----> 2 alexander_polynomial = k.alexander_polynomial()
4 # Check if the Alexander polynomial is that of the unknot (constant)
5 is_unknot = alexander_polynomial == 1
File ~/knotenv/lib/python3.8/site-packages/pyknotid/spacecurves/knot.py:83, in Knot.alexander_polynomial(self, variable, quadrant, mode, **kwargs)
[81](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/spacecurves/knot.py?line=80) from ..invariants import alexander
[82](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/spacecurves/knot.py?line=81) gc = self.gauss_code(**kwargs)
---> [83](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/spacecurves/knot.py?line=82) gc.simplify()
[84](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/spacecurves/knot.py?line=83) return alexander(gc, variable=variable, quadrant=quadrant,
[85](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/spacecurves/knot.py?line=84) simplify=False, mode=mode)
File ~/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py:375, in GaussCode.simplify(self, one, two, one_extended)
[373](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=372) original_gc = self._gauss_code
[374](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=373) original_len = n.sum([len(line) for line in original_gc])
--> [375](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=374) self._do_reidemeister_moves(one, two)
[376](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=375) new_gc = self._gauss_code
[377](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=376) new_len = n.sum([len(line) for line in new_gc])
File ~/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py:291, in GaussCode._do_reidemeister_moves(self, one, two, one_extended)
[288](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=287) continue # The crossing has already been removed
[289](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=288) locations = crossing_indices[number]
...
--> [291](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=290) if locations[0][0] != locations[1][0]: # not on same line
[292](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=291) continue
[293](file:///mnt/nvme/home/bbabatun/knotenv/lib/python3.8/site-packages/pyknotid/representations/gausscode.py?line=292) line_index = locations[0][0]
IndexError: list index out of range
Best,
Tito
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
