# 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 sage: type(n) Sage's implementation splitting the computation of the Stirling numbers of the second kind in two cases according to `n`, let us check the result it gives agree with both maxima and gap. For `n<200`:: sage: for n in Subsets(range(100,200), 5).random_element(): ...      for k in Subsets(range(n), 5).random_element(): ...         s_sage = stirling_number2(n,k) ...         s_maxima = stirling_number2(n,k, algorithm = "maxima") ...         s_gap = stirling_number2(n,k, algorithm = "gap") ...         if not (s_sage == s_maxima and s_sage == s_gap): ...             print "Error with n<200" For `n\geq 200`:: sage: for n in Subsets(range(200,300), 5).random_element(): ...      for k in Subsets(range(n), 5).random_element(): ...         s_sage = stirling_number2(n,k) ...         s_maxima = stirling_number2(n,k, algorithm = "maxima") ...         s_gap = stirling_number2(n,k, algorithm = "gap") ...         if not (s_sage == s_maxima and s_sage == s_gap): ...             print "Error with n<200" """ if algorithm is None: return _stirling_number2(n, k)