#18193: Fix CompleteDyckWords_size behaviour for negative size
-------------------------------------+-------------------------------------
       Reporter:  g.chatel           |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.6
      Component:  combinatorics      |   Resolution:
       Keywords:  dyck words, sd67,  |    Merged in:
  combinatorics                      |    Reviewers:
        Authors:  Grégory Châtel     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  c0f3e47a7e26b683fdee7d4875a50457b6f25142
  u/g.chatel/fix_completedyckwords_size_behaviour_for_negative_size|     
Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------
Changes (by g.chatel):

 * cc: VivianePons, tscrim, darij, nthiery, chapoton (added)
 * commit:   => c0f3e47a7e26b683fdee7d4875a50457b6f25142
 * status:  new => needs_review


Old description:

> Fix the CompleteDyckWords_size behaviour for negative size argument.
>
> {{{
> sage: DyckWords(-1)
> Dyck words with -1 opening parentheses and -1 closing parentheses
> sage: DyckWords(-1).cardinality()
> ...
> ZeroDivisionError:
> sage: DyckWords(-2).cardinality()
> 0
> sage: list(DyckWords(0))
> [[]]
> sage: list(DyckWords(-1))
> [[0]]
> sage: list(DyckWords(-2))
> [[0]]
> sage: DyckWords(-1).random_element() in DyckWords(-1)
> False
> }}}

New description:

 Fix the CompleteDyckWords_size behaviour for negative size argument.

 Before the change:

 {{{
 sage: DyckWords(-1)
 Dyck words with -1 opening parentheses and -1 closing parentheses
 sage: DyckWords(-1).cardinality()
 ...
 ZeroDivisionError:
 sage: DyckWords(-2).cardinality()
 0
 sage: list(DyckWords(0))
 [[]]
 sage: list(DyckWords(-1))
 [[0]]
 sage: list(DyckWords(-2))
 [[0]]
 sage: DyckWords(-1).random_element() in DyckWords(-1)
 False
 }}}

 After the change:

 {{{
 sage: DyckWords(-1)
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 ...
 ValueError: k1 (= -1) must be nonnegative
 }}}

--

--
Ticket URL: <http://trac.sagemath.org/ticket/18193#comment:5>
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