Skip to content

QFactorial ​

The q-factorial [n]q!=[1]q[2]q⋯[n]q[n]_q! = [1]_q [2]_q \cdots [n]_q, where [k]q=1+q+⋯+qk−1[k]_q = 1 + q + \cdots + q^{k-1}. Provided by @enumeratio/analytic.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageQFactorial✓
QFactorial(n, q)the q-factorial [n]q![n]_q!.
SageMathenumeratio_q_factorial(n, q)
Typed signatures
TypePackageApplies
(real, complex) -> numberanalyticalways

Domain: Special functions

Details
  • Built as a product of q-integers [k]q[k]_q, each a sum of kk powers of qq — exact boxed arithmetic throughout, so it reduces to a number for numeric qq (rational stays rational) and to a genuine polynomial in qq that Expand can open up for symbolic qq.
  • At q=1q = 1, [k]1=k[k]_1 = k termwise (no division, so no q→1q \to 1 limit to take), reducing exactly to n!n!.
  • A non-integer nn is the q-Gamma function, [n]q!=Γq(n+1)[n]_q! = \Gamma_q(n+1), which N() evaluates for real q>0q > 0 through the infinite products (q;q)∞/((qn+1;q)∞(1−q)n)(q;q)_\infty / \big((q^{n+1};q)_\infty (1-q)^n\big) (for q>1q > 1 reflected by [n]q!=qn(n−1)/2[n]1/q![n]_q! = q^{n(n-1)/2}[n]_{1/q}!, and Γ(n+1)\Gamma(n+1) at q=1q = 1). A negative integer nn is a pole, and q≤0q \le 0 stays symbolic.
  • A symbolic, non-integer or negative nn is a held call (still canonical). At q=0q = 0 with a non-integer rational nn, Series expands the same product quotient as a series in q1/dq^{1/d}, with Wolfram's truncation; for −2<n<−1-2 < n < -1 the leading factor makes it start at a positive fractional power, and a lower nn stays unevaluated.

Plot

the complex plot cannot lower QFactorial

Examples

4 more kept as data, checked against the oracles
Basic #

[1]2[2]2[3]2=1⋅3⋅7[1]_2 [2]_2 [3]_2 = 1 \cdot 3 \cdot 7

live ↗
InQFactorial(3,2)\mathrm{QFactorial}(3, 2)Out2121
live ↗
InQFactorial(4,2)\mathrm{QFactorial}(4, 2)Out315315
live ↗
InSeries⁡((q9+q8+q7+q6+q5+q4+q3+q2+q+1)(q8+q7+q6+q5+q4+q3+q2+q+1)(q7+q6+q5+q4+q3+q2+q+1)(q6+q5+q4+q3+q2+q+1)(q5+q4+q3+q2+q+1)(q4+q3+q2+q+1)(q3+q2+q+1)(q2+q+1)(q+1),q,0,10)\operatorname{Series}((q^9+q^8+q^7+q^6+q^5+q^4+q^3+q^2+q+1)(q^8+q^7+q^6+q^5+q^4+q^3+q^2+q+1)(q^7+q^6+q^5+q^4+q^3+q^2+q+1)(q^6+q^5+q^4+q^3+q^2+q+1)(q^5+q^4+q^3+q^2+q+1)(q^4+q^3+q^2+q+1)(q^3+q^2+q+1)(q^2+q+1)(q+1), q, 0, 10)Out1+9q+44q2+155q3+440q4+1 068q5+2 298q6+4 489q7+8 095q8+13 640q9+21 670q10+O(q11)1+9q+44q^2+155q^3+440q^4+1\,068q^5+2\,298q^6+4\,489q^7+8\,095q^8+13\,640q^9+21\,670q^{10}+O\left(q^{11}\right)
live ↗
InSeries⁡((x2+x+1)(x+1),x,∞,6)\operatorname{Series}((x^2+x+1)(x+1), x, ∞, 6)Outx3+2x2+2x+1x^3+2x^2+2x+1
Scope #
live ↗
InQFactorial(3,12)\mathrm{QFactorial}(3, \frac{1}{2})Out218\frac{21}{8}

A matrix function of a polynomial gives 0 at −1-1 and 186 at 5

live ↗
InMatrixFunction(_1⁡↦(_1⁡2+_1⁡+1)(_1⁡+1),[[−1,0],[0,5]])\mathrm{MatrixFunction}(\operatorname{\_1}↦(\operatorname{\_1}^2+\operatorname{\_1}+1)(\operatorname{\_1}+1), \bigl\lbrack\bigl\lbrack-1, 0\bigr\rbrack, \bigl\lbrack0, 5\bigr\rbrack\bigr\rbrack)Out[[0,0],[0,186]]\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack0, 186\bigr\rbrack\bigr\rbrack
live ↗
InN(QFactorial(13,6),50)N(\mathrm{QFactorial}(\frac{1}{3}, 6), 50)Out0.786 862 823 421 685 819 914 448 763 102 170 857 654 681 413 752 970.786\,862\,823\,421\,685\,819\,914\,448\,763\,102\,170\,857\,654\,681\,413\,752\,97
live ↗
InFullSimplify(Normal⁡(Series⁡(QFactorial(x,q),x,0,3)))\mathrm{FullSimplify}(\operatorname{Normal}(\operatorname{Series}(\mathrm{QFactorial}(x, q), x, 0, 3)))Out16QFactorial(3,0)(0,q)x3+12QFactorial(2,0)(0,q)x2+xQFactorial(1,0)(0,q)+1\frac{1}{6}\mathrm{QFactorial}^{(3, 0)}(0, q)x^3+\frac{1}{2}\mathrm{QFactorial}^{(2, 0)}(0, q)x^2+x\mathrm{QFactorial}^{(1, 0)}(0, q)+1
live ↗
InFullSimplify(Normal⁡(Series⁡(QFactorial(x,q),x,x0,2)))\mathrm{FullSimplify}(\operatorname{Normal}(\operatorname{Series}(\mathrm{QFactorial}(x, q), x, \mathrm{x0}, 2)))Out12∂2∂x02QFactorial(x0,q)(x−x0)2+(x−x0)∂∂x0QFactorial(x0,q)+QFactorial(x0,q)\frac{1}{2}\frac{∂^{2}}{∂\mathrm{x0}^{2}} \mathrm{QFactorial}(\mathrm{x0}, q)(x-\mathrm{x0})^2+(x-\mathrm{x0})\frac{∂}{∂\mathrm{x0}} \mathrm{QFactorial}(\mathrm{x0}, q)+\mathrm{QFactorial}(\mathrm{x0}, q)
Applications #

The inversion generating function of SymmetricGroup(3): ∑πqinv(π)\sum_\pi q^{\mathrm{inv}(\pi)}

live ↗
InExpand(QFactorial(3,q))\mathrm{Expand}(\mathrm{QFactorial}(3, q))Outq3+2q2+2q+1q^3+2q^2+2q+1
Properties #

At q=1q = 1 it is the ordinary factorial

live ↗
InQFactorial(5,1)\mathrm{QFactorial}(5, 1)Out120120

A non-integer argument gives a series in q1/2q^{1/2}

live ↗
InSeries⁡(QFactorial(12,q),q,0,3)\operatorname{Series}(\mathrm{QFactorial}(\frac{1}{2}, q), q, 0, 3)Out−18×5q7+q52+q3+1−q2−9q28+7q316+O(q4)-\frac{1}{8}×5\sqrt{q}^{7}+\frac{\sqrt{q}^{5}}{2}+\sqrt{q}^{3}+1-\frac{q}{2}-\frac{9q^2}{8}+\frac{7q^3}{16}+O\left(q^4\right)

A negative order starts the series at a positive fractional power

live ↗
InSeries⁡(QFactorial(−32,q),q,0,3)\operatorname{Series}(\mathrm{QFactorial}(-\frac{3}{2}, q), q, 0, 3)Out−q32−18×3q5−q−2q+3q34+O(q7)-\frac{\sqrt{q}^{3}}{2}-\frac{1}{8}×3\sqrt{q}^{5}-\sqrt{q}-2q+\frac{3q^3}{4}+O\left(\sqrt{q}^{7}\right)
About
Examples17
Checked againstWolfram Language 17 agreeSageMath 9 agree2 unevaluated5 errorSymPy 2 agree1 error
CrosswalkWolfram LanguageSageMath

Implementation

primitive · kernela kernel — an algorithm over mutable state that would not be readable as a tree

nativeenginetypescriptpackages/symbols/analysis/analytic/src/q-series.ts

product of q-integers, built at canonicalization time (not evaluate) so Expand sees the tree to open up.

mappedexternalwolframpackages/oracle/src/mappings.ts

QFactorial[n, q].

mappedsagepackages/oracle/src/mappings.ts

See also: QPochhammer, QBinomial, Factorial