The methods have been include in [http://trac.sagemath.org/ticket/19011 
trac ticket #19011].

At the end of the day, it would be nice to have some kind of mechanism for 
deciding which algorithm to use as they really are rather different. I made 
a simply benchmark to highlight their strengths and weaknesses:

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

Code:

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)))



-Søren

Den søndag den 9. august 2015 kl. 12.47.34 UTC+2 skrev mmarco:
>
> Oh, i forgot to say: please open a ticket with your code added to the 
> braid class. It is definitely a nice addition. I would be happy to review 
> it. write your methods inside the class definition, and consider which ones 
> should be public and which ones should be hidden to the user.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to