Mathematica’s support for the hypergeometric function (HypergeometricPFQ) is quite extensive, in that symbolic functions like Sum and Integrate are capable of returning hypergeometric results, and the function itself is amenable to both symbolic and numeric evaluation. By contrast, the corresponding
q
-analog QHypergeometricPFQ (a.k.a. the basic hypergeometric function) has less extensive support in the system, although there have been some improvements as of late.
In the course of experimentation with these functions, I have been able to obtain formulae that, to the best of my knowledge, have not been explicitly stated in the literature. It is my hope that the identities demonstrated here can be of some use, or (even better!) be someday incorporated into Mathematica.

Partial sums

Hypergeometric functions have the following definition:
p
F
q
(
a
1
,…,
a
p
;
b
1
,…,
b
q
;z)=
∞
∑
k=0
(
a
1
)
k
…
(
a
p
)
k
(
b
1
)
k
…
(
b
q
)
k
k
z
k!
Sum, as expected, knows how to deal with specific cases of the hypergeometric function:
In[]:=
∞
∑
k=0
Pochhammer[a,k]
Pochhammer[f,k]Pochhammer[g,k]
k
z
k!
Out[]=
HypergeometricPFQ[{a},{f,g},z]
Somewhat surprising is that Sum also knows how to deal with the partial sum (note the upper limit):
In[]:=
n
∑
k=0
Pochhammer[a,k]
Pochhammer[f,k]Pochhammer[g,k]
k
z
k!
Out[]=
HypergeometricPFQ[{a},{f,g},z]-
1+n
z
Gamma[f]Gamma[g]Gamma[1+a+n]HypergeometricPFQ[{1,1+a+n},{2+n,1+f+n,1+g+n},z](Gamma[a]Gamma[2+n]Gamma[1+f+n]Gamma[1+g+n])
Some amount of thought should help you realize that the complicated second term is in fact an expression for the “tail” of the infinite sum,
∞
∑
k=n+1
(
a
1
)
k
…
(
a
p
)
k
(
b
1
)
k
…
(
b
q
)
k
k
z
k!
. By using an index shift so that the summation starts at 0, along with the addition identity
(a)
k+n
=
(a)
n
(a+n)
k
for the Pochhammer symbol, we have the following identity:
∞
∑
k=n+1
(
a
1
)
k
…
(
a
p
)
k
(
b
1
)
k
…
(
b
q
)
k
k
z
k!
=
n+1
z
(n+1)!
(
a
1
)
n+1
…
(
a
p
)
n+1
(
b
1
)
n+1
…
(
b
q
)
n+1
p
F
q
(1,
a
1
+n+1,…,
a
p
+n+1;n+2,
b
1
+n+1,…,
b
q
+n+1;z)
Here is the corresponding function for generating the partial sum, using the formula given above:
In[]:=
SetAttributes[hypgPartial,HoldFirst];​​​​hypgPartial[HypergeometricPFQ[a_,b_,z_],n_Integer?NonNegative]:=Module{ak,bk},​​HypergeometricPFQ[a,b,z]-
n+1
z
(n+1)!
Product[Pochhammer[ak,n+1],{ak,a}]
Product[Pochhammer[bk,n+1],{bk,b}]
HypergeometricPFQ[Append[a+n+1,1],Append[b+n+1,n+2],z]​​
A demonstration:
In[]:=
hypgPartial[HypergeometricPFQ[{a,b,c},{f,g},z],5]==
5
∑
k=0
((Pochhammer[a,k]Pochhammer[b,k]Pochhammer[c,k])/(Pochhammer[f,k]Pochhammer[g,k]))
k
z
k!
//Simplify
Out[]=
True
Now, consider the basic hypergeometric function:
r
ϕ
s
(
a
1
,…,
a
r
;
b
1
,…,
b
s
;q;z)=
∞
∑
k=0
(
a
1
;q)
k
…
(
a
r
;q)
k
(
b
1
;q)
k
…
(
b
s
;q)
k
s-r+1

k
(-1)
k(k-1)/2
q

k
z
(q;q)
k
Although Sum recognizes the infinite sum, it knows nothing about the partial sum:
In[]:=

∞
∑
k=0
QPochhammer[a,q,k]QPochhammer[b,q,k]
QPochhammer[c,q,k]
k
z
QPochhammer[q,q,k]
,
n
∑
k=0
QPochhammer[a,q,k]QPochhammer[b,q,k]
QPochhammer[c,q,k]
k
z
QPochhammer[q,q,k]

Out[]=
QHypergeometricPFQ[{a,b},{c},q,z],
n
∑
k=0
k
z
QPochhammer[a,q,k]QPochhammer[b,q,k]
QPochhammer[c,q,k]QPochhammer[q,q,k]

Thus, one must derive an expression for the tail of the basic hypergeometric series, in analogy to what was done for the hypergeometric series. The critical identity here is the following identity for the
q
-Pochhammer symbol:
(a;q)
k+n
=
(a;q)
n
(a
n
q
;q)
k
In terms of Mathematica’s functions:
QPochhammer[a,q,k+n]==QPochhammer[a,q,n]QPochhammer[a
n
q
,q,k]
With that, the following expression for the tail can be derived:
∞
∑
k=n+1
(
a
1
;q)
k
…
(
a
r
;q)
k
(
b
1
;q)
k
…
(
b
s
;q)
k
s-r+1

k
(-1)
k(k-1)/2
q

k
z
(q;q)
k
=
s-r+1

n+1
(-1)
n(n+1)/2
q

n+1
z
(q;q)
n+1
(
a
1
;q)
n+1
…
(
a
r
;q)
n+1
(
b
1
;q)
n+1
…
(
b
s
;q)
n+1
r
ϕ
s
q,
a
1
n+1
q
,…,
a
r
n+1
q
;
n+2
q
,
b
1
n+1
q
,…,
b
s
n+1
q
;q;z
(n+1)(s-r+1)
q

Here is the corresponding function:
In[]:=
hypgPartial[QHypergeometricPFQ[a_,b_,q_,z_],n_Integer?NonNegative]:=Module{ak,bk,r,s},​​r=Length[a];s=Length[b];​​QHypergeometricPFQ[a,b,q,z]-
s-r+1

n+1
(-1)
Binomial[n+1,2]
q

n+1
z
QPochhammer[q,q,n+1]
Product[QPochhammer[ak,q,n+1],{ak,a}]
Product[QPochhammer[bk,q,n+1],{bk,b}]
QHypergeometricPFQAppend[a
n+1
q
,q],Append[b
n+1
q
,
n+2
q
],q,z
(n+1)(s-r+1)
q
​​
We can use series expansion to verify that the supposedly removed terms are indeed missing:
In[]:=
hypgPartial[QHypergeometricPFQ[{a,b},{f,g,h},q,z],4]
Out[]=
QHypergeometricPFQ[{a,b},{f,g,h},q,z]-
20
q
5
z
QHypergeometricPFQ{q,a
5
q
,b
5
q
},f
5
q
,g
5
q
,h
5
q
,
6
q
,q,
10
q
zQPochhammer[a,q,5]QPochhammer[b,q,5](QPochhammer[f,q,5]QPochhammer[g,q,5]QPochhammer[h,q,5]QPochhammer[q,q,5])
In[]:=
Series[%,{z,0,6}]//FullSimplify
Out[]=
1+
(-1+a)(-1+b)z
(-1+f)(-1+g)(-1+h)(-1+q)
+(
2
q
QPochhammer[a,q,2]QPochhammer[b,q,2]
2
z
)(QPochhammer[f,q,2]QPochhammer[g,q,2]QPochhammer[h,q,2]QPochhammer[q,q,2])+(
6
q
QPochhammer[a,q,3]QPochhammer[b,q,3]
3
z
)(QPochhammer[f,q,3]QPochhammer[g,q,3]QPochhammer[h,q,3]QPochhammer[q,q,3])+(
12
q
QPochhammer[a,q,4]QPochhammer[b,q,4]
4
z
)(QPochhammer[f,q,4]QPochhammer[g,q,4]QPochhammer[h,q,4]QPochhammer[q,q,4])+
7
O[z]
We can also do a numerical verification:
In[]:=
With{n=8,a=RandomReal[{-3,3},1,WorkingPrecision->25],b=RandomReal[{-3,3},5,WorkingPrecision->25],q=RandomReal[1,WorkingPrecision->25]Exp[2πRandomReal[1,WorkingPrecision->25]],​​z=RandomComplex[{-1-,1+},WorkingPrecision->25]},​​hypgPartial[QHypergeometricPFQ[a,b,q,z],n],
n
∑
k=0
Product[QPochhammer[aj,q,k],{aj,a}]
Product[QPochhammer[bj,q,k],{bj,b}]
Length[b]-Length[a]+1

k
(-1)
Binomial[k,2]
q

k
z
QPochhammer[q,q,k]

Out[]=
{0.471061533960840248000938-0.562966354299895976498477,0.47106153396084024800094-0.562966354299895976498477}

Multisection

Multisection is a generalization of the idea of splitting a function into its odd and even parts. That is, one only considers the result of only taking every other term in the defining sum. The resulting general formulae are complicated, but can be readily built up from the appropriate generalized multiplication identities:
(a)
mk+r

(a)
r
mk
m
m-1
∏
j=0
a+j+r
m
k
for Pochhammer (also listed on the Wolfram Functions site), and
(a;q)
mk+r

(a;q)
r
m-1
∏
j=0
a
j+r
q
;
m
q

k
for
q
-Pochhammer. With these two, one can write the following multisection function:
In[]:=
SetAttributes[hypgMulti,HoldFirst];​​​​hypgMulti[HypergeometricPFQ[a_,b_,z_],n_Integer]/;n>1:=Module{ak,bk,k,p,q},​​p=Length[a];q=Length[b];​​Table
k
z
k!
Product[Pochhammer[ak,k],{ak,a}]
Product[Pochhammer[bk,k],{bk,b}]
HypergeometricPFQAppend
Flatten[Outer[Plus,a,Range[0,n-1]]]+k
n
,1,Join
Flatten[Outer[Plus,b,Range[0,n-1]]]+k
n
,
Range[n]+k
n
,
n(p-q-1)
n
n
z
,{k,0,n-1}​​;​​​​hypgMulti[QHypergeometricPFQ[a_,b_,q_,z_],n_Integer]/;n>1:=Module{ak,bk,k,r,s},​​r=Length[a];s=Length[b];​​Table
s-r+1

k
(-1)
Binomial[k,2]
q

k
z
QPochhammer[q,q,k]
Product[QPochhammer[ak,q,k],{ak,a}]
Product[QPochhammer[bk,q,k],{bk,b}]
QHypergeometricPFQAppendFlattenOuterTimes,a,
k+Range[0,n-1]
q
,
n
q
,JoinFlattenOuterTimes,b,
k+Range[0,n-1]
q
,
Range[n]+k
q
,
n
q
,
(Binomial[n,2]+nk)(s-r+1)
q
n
z
,{k,0,n-1}​​;
(Note that the multisection formula for the hypergeometric function is also in the Wolfram Functions site. The
q
-analog does not seem to have been explicitly stated in previous literature.)
For an explicit demonstration, let us perform a splitting into even and odd parts:
In[]:=
hypgMulti[HypergeometricPFQ[{a,b},{c},z],2]
Out[]=
HypergeometricPFQ
1
2
+
a
2
,
a
2
,
1
2
+
b
2
,
b
2
,
1
2
,
1
2
+
c
2
,
c
2
,
2
z
,
1
c
abzHypergeometricPFQ
1
2
+
a
2
,1+
a
2
,
1
2
+
b
2
,1+
b
2
,
3
2
,
1
2
+
c
2
,1+
c
2
,
2
z

In[]:=
hypgMulti[QHypergeometricPFQ[{a,b},{c},q,z],2]
Out[]=
QHypergeometricPFQ[{a,b,aq,bq},{c,q,cq},
2
q
,
2
z
],(1-a)(1-b)zQHypergeometricPFQ[{aq,bq,a
2
q
,b
2
q
},{cq,c
2
q
,
3
q
},
2
q
,
2
z
]((1-c)(1-q))
Here is a more elaborate example. We use series expansion to verify that adding all the parts together gives the original function:
In[]:=
hparts=hypgMulti[HypergeometricPFQ[{a,b,c},{f,g},z],4]
Out[]=
HypergeometricPFQ
1
4
+
a
4
,
1
2
+
a
4
,
3
4
+
a
4
,
a
4
,
1
4
+
b
4
,
1
2
+
b
4
,
3
4
+
b
4
,
b
4
,
1
4
+
c
4
,
1
2
+
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can do the following:

CITE THIS NOTEBOOK

Some useful identities for (basic) hypergeometric functions​
by J. M.​
Wolfram Community, STAFF PICKS, April 25, 2025
​https://community.wolfram.com/groups/-/m/t/3450241​
​