#13259: Correcting implementation of "negative" quantum integers
-----------------------------------+----------------------------------------
Reporter: andrew.mathas | Owner: sage-combinat
Type: defect | Status: needs_review
Priority: minor | Milestone: sage-5.3
Component: combinatorics | Resolution:
Keywords: quantum integer | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-----------------------------------+----------------------------------------
Description changed by andrew.mathas:
Old description:
> Currently, "negative" quantum integers are only defined for non-negative
> integers:
>
> {{{
> sage: q_analogues.q_int(-2)
> Traceback (most recent call last):
> ...
> ValueError: Argument (-2) must be a nonnegative integer.
> }}}
> The correct definition is that the quantum integer [n]_q is
>
> [n]_q = { 1+q+...+q!^{n-1}, if n\ge
> 0[[BR]] { -q!^-n[-n], if n<0
>
> This patch corrects this.
>
> Note: prior to trac !#11411 these quantum integers were defined to be
> zero, and #11411 made made q_int() return a !ValueError. Patch !#11411
> was motivated by q_binomial() returning incorrect answers. With this
> patch both q_int() and q_binom() now return correct answers.
New description:
Currently, quantum integers are only defined for non-negative integers:
{{{
sage: q_analogues.q_int(-2)
Traceback (most recent call last):
...
ValueError: Argument (-2) must be a nonnegative integer.
}}}
The correct definition is that the quantum integer [n]_q is
[n]_q = { 1+q+...+q!^ {n-1}, if n\ge 0[[BR]]
{ -q!^-n [-n], if n<0
This patch corrects this.
Note: prior to trac !#11411 these quantum integers were defined to be
zero, and #11411 made made q_int() return a !ValueError. Patch !#11411 was
motivated by q_binomial(2,3), for example, previously returning incorrect
answers. With this patch both q_int() and q_binom() return the correct
answers.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13259#comment:3>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.