#13259: Correcting implementation of "negative" quantum integers
-----------------------------------+----------------------------------------
Reporter: andrew.mathas | Owner: andrew.mathas
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: Andrew Mathas | Merged in:
Dependencies: | Stopgaps:
-----------------------------------+----------------------------------------
Old 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. That is, if q\ne1 then [n]_q = (q!^n-1)/(q-1).
>
> Note: prior to trac !#11411 these quantum integers were defined to be
> zero, and #11411 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.
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. That is, if q\ne1 then [n]_q = (q!^n-1)/(q-1).
Note: prior to trac !#11411 these quantum integers were defined to be
zero, and #11411 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.
'''Apply:''' [attachment:trac_13259-negative_quantum_integers-am.patch]
--
Comment (by andrew.mathas):
For the patchbot:
Apply: trac_13259-negative_quantum_integers-am.patch
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13259#comment:11>
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.