# Ticket #11411: correction_q_analogues_fc.patch

File correction_q_analogues_fc.patch, 1.1 KB (added by chapoton, 9 years ago)
• ## sage/combinat/q_analogues.py

```# HG changeset patch
# User Frederic Chapoton <chapoton at math.univ-lyon1.fr>
# Date 1306856555 -7200
# Node ID 9cc67cb6600742965ec00b92094378ab2a0d4b3d
# Parent  85fbbf73ba511c55be136de163b63a8aa1868a4e
#11411 This patch changes the behavior of q-factorials and q-binomial coefficients

diff --git a/sage/combinat/q_analogues.py b/sage/combinat/q_analogues.py```
 a def q_factorial(n, p=None): sage: q_analogues.q_factorial(3, p) p^3 + 2*p^2 + 2*p + 1 """ return prod([q_int(i,p) for i in range(1, n+1)]) if n>=0: return prod([q_int(i,p) for i in range(1, n+1)]) else: raise ValueError, "argument (%s) must be nonnegative" %n def q_binomial(n,k,p=None): """ def q_binomial(n,k,p=None): sage: q_analogues.q_binomial(4,2,p) p^4 + p^3 + 2*p^2 + p + 1 """ return q_factorial(n,p)/(q_factorial(k,p)*q_factorial(n-k,p)) if 0<=k and k<=n: return q_factorial(n,p)/(q_factorial(k,p)*q_factorial(n-k,p)) else: return 0 def qt_catalan_number(n): """