Ticket #9663: trac_9663 - additional test.patch

File trac_9663 - additional test.patch, 1.7 KB (added by ncohen, 9 years ago)
  • sage/combinat/combinat.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1283699944 -7200
    # Node ID 72dc206be1f315cf059cb4df5c6310d04ee51640
    # Parent  bf1a3fa845ce5a0983cc9dc7fdd0c814cd8b906d
    trac 9663 - short additional test on stirling_number2
    
    diff -r bf1a3fa845ce -r 72dc206be1f3 sage/combinat/combinat.py
    a b  
    642642        sage: type(n)
    643643        <type 'sage.rings.integer.Integer'>
    644644
     645     Sage's implementation splitting the computation of the Stirling
     646     numbers of the second kind in two cases according to `n`, let us
     647     check the result it gives agree with both maxima and gap.
     648
     649     For `n<200`::
     650
     651         sage: for n in Subsets(range(100,200), 5).random_element():
     652         ...      for k in Subsets(range(n), 5).random_element():
     653         ...         s_sage = stirling_number2(n,k)
     654         ...         s_maxima = stirling_number2(n,k, algorithm = "maxima")
     655         ...         s_gap = stirling_number2(n,k, algorithm = "gap")
     656         ...         if not (s_sage == s_maxima and s_sage == s_gap):
     657         ...             print "Error with n<200"
     658
     659     For `n\geq 200`::
     660
     661         sage: for n in Subsets(range(200,300), 5).random_element():
     662         ...      for k in Subsets(range(n), 5).random_element():
     663         ...         s_sage = stirling_number2(n,k)
     664         ...         s_maxima = stirling_number2(n,k, algorithm = "maxima")
     665         ...         s_gap = stirling_number2(n,k, algorithm = "gap")
     666         ...         if not (s_sage == s_maxima and s_sage == s_gap):
     667         ...             print "Error with n<200"
    645668     """
    646669    if algorithm is None:
    647670        return _stirling_number2(n, k)