Opened 9 years ago

Last modified 9 years ago

#11411 closed defect

some q binomial coefficients should be zero — at Version 5

Reported by: chapoton Owned by: sage-combinat
Priority: minor Milestone: sage-4.7.2
Component: combinatorics Keywords:
Cc: chapoton, sage-combinat Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by chapoton)

I have found the following behaviour:

sage: import sage.combinat.q_analogues as qa
sage: qa.q_binomial(2,-1)
1/(q^2 + q + 1)
sage: binomial(2,-1)
0
sage: qa.q_binomial(2,3)
1/(q^2 + q + 1)
sage: binomial(2,3)
0

I think these q-binomials should rather be zero. The q-binomial is based on the q-factorial, where one finds the following behaviour

sage: [qa.q_factorial(-i) for i in range(6)]
[1, 1, 1, 1, 1, 1]

This seems to be rather wrong, as the factorial itself is infinite for negative integers.

The patch restricts the q-factorial to nonnegative arguments and defines q-binomials outside of the correct range to be zero.

Apply:

Change History (6)

Changed 9 years ago by chapoton

comment:1 Changed 9 years ago by chapoton

  • Status changed from new to needs_review

comment:2 Changed 9 years ago by chapoton

  • Description modified (diff)

comment:3 Changed 9 years ago by chapoton

  • Cc sage-combinat added

comment:4 Changed 9 years ago by chapoton

  • Description modified (diff)

comment:5 Changed 9 years ago by chapoton

  • Description modified (diff)
Note: See TracTickets for help on using tickets.