Opened 7 years ago

Closed 15 months ago

#13695 closed defect (wontfix)

Subsets(1)[x] behaves strangely for x in SR

Reported by: ppurka Owned by: sage-combinat
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: combinatorics Keywords:
Cc: Merged in:
Authors: Reviewers: Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

This bug is from the sage notebook bug report page.

A = Subsets(1);
k=var('k')
sum((-1)^(A[k].cardinality()),k,0,A.cardinality()-1)

Sage gives me 2 as an answer, while it should be 0.

The problem seems to be in sage.combinat.subset.Subsets_s.unrank which does not check whether the arguments it receives are integers or not. So, doing something like the title gives the empty set and so we get 2 as the answer above.

sage: Subsets(1)[x]
{}

Change History (7)

comment:1 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:2 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:3 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:4 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:5 Changed 16 months ago by chapoton

  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Input is now checked, and the original issue now works. Let us close that old ticket.

sage: A = Subsets(1);
....: sum((-1)^(A[k].cardinality()) for k in range(A.cardinality()))

0

comment:6 Changed 16 months ago by vdelecroix

  • Reviewers set to Vincent Delecroix
  • Status changed from needs_review to positive_review

comment:7 Changed 15 months ago by vdelecroix

  • Resolution set to wontfix
  • Status changed from positive_review to closed

closing positively reviewed duplicates

Note: See TracTickets for help on using tickets.