--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To post to this group, send email to sage-...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
sage: B = BraidGroup(2)
sage: b = B([])
sage: L = Link(b)
sage: L.jones_polynomial()
...
IndexError: list index out of range
sage: B = BraidGroup(8)
sage: b = B([1])
sage: L = Link(b)
sage: L.jones_polynomial()
1
sage: b.jones_polynomial()
A^12 + 6*A^8 + 15*A^4 + 15/A^4 + 6/A^8 + 1/A^12 + 20
sage: benchmark()
Test 1: A very long braid on very few strands
Braid: (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
Braid rep: 0.03 seconds, Kauffman bracket: 10.33 seconds
Test 2: A very simple braid on quite a few strands
Braid: (1, 2, 3, 4, 5, 6, 7, 8)
Braid rep: 6.56 seconds, Kauffman bracket: 0.00 seconds
import time
def benchmark():
def test(b):
L = Link(b)
print "Braid: " + str(b.Tietze())
result_string = "Braid rep: {0:.2f} seconds, Kauffman bracket: {1:.2f} seconds"
start_time = time.time()
jones = b.jones_polynomial()
testb = time.time() - start_time
start_time = time.time()
jones = L.jones_polynomial()
testl = time.time() - start_time
print result_string.format(testb, testl)
print "\nTest 1: A very long braid on very few strands"
l = 60
B = BraidGroup(2)
test(B([1]*l))
print "\nTest 2: A very simple braid on quite a few strands"
n = 9
B = BraidGroup(n)
test(B(range(1,n)))
The TL representation involves the product of a nuumber of matrices that is linear on the number of crossings, and the complexity of such a matrix is also polynomial on the number of strands (around fourth power maybe?).
sage: benchmark()
Test 1: A very long braid with very few strands
Braid: (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
Braid rep: 0.06 seconds, Kauffman bracket: 9.99 seconds
Test 2: A very simple braid on quite a few strands
Braid: (1, 2, 3, 4, 5, 6, 7, 8)
Braid rep: 0.04 seconds, Kauffman bracket: 0.00 seconds
I see, i got the wrong idea about the representation. Thanks for the clarification. In that casde, it would be really interesting to run your benchmark on a lot of different cases. Maybe the sparcity advantage gets reduced after a big number of crossings, when we get a lot of non-zero entries in the matrix.