#16913: Error in prev()
-------------------------------------+-------------------------------------
       Reporter:  ayyer              |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.4
      Component:  combinatorics      |   Resolution:
       Keywords:  permutations,      |    Merged in:
  prev                               |    Reviewers:
        Authors:  André Apitzsch     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  a2406cd669acf5af044738f24c711b1f5526f3a5
  u/aapitzsch/ticket/16913           |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 One line modification!! great!

 - What about `range(n-2,-1,-1)` instead of `reversed(range(0,n-1))`?

 - I really would like to see random tests that would prevent this kind of
 things happening again
 {{{
 sage: for _ in range(20):
 ....:     p = Permutations(randint(2,10)).random_element()
 ....:     assert p.next().prev() == p, "problem with p={}".format(p)
 ....:     assert p.prev().next() == p, "problem with p={}".format(p)
 }}}

 Vincent

--
Ticket URL: <http://trac.sagemath.org/ticket/16913#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to