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 -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.
q
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
Partial sums
Hypergeometric functions have the following definition:
p
F
q
a
1
a
p
b
1
b
q
∞
∑
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]
In[]:=
n
∑
k=0
Pochhammer[a,k]
Pochhammer[f,k]Pochhammer[g,k]
k
z
k!
Out[]=
HypergeometricPFQ[{a},{f,g},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])
1+n
z
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, ……. By using an index shift so that the summation starts at 0, along with the addition identity = 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!
(a)
k+n
(a)
n
(a+n)
k
∞
∑
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
a
1
a
p
b
1
b
q
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]-HypergeometricPFQ[Append[a+n+1,1],Append[b+n+1,n+2],z]
n+1
z
(n+1)!
Product[Pochhammer[ak,n+1],{ak,a}]
Product[Pochhammer[bk,n+1],{bk,b}]
A demonstration:
In[]:=
hypgPartial[HypergeometricPFQ[{a,b,c},{f,g},z],5]==((Pochhammer[a,k]Pochhammer[b,k]Pochhammer[c,k])/(Pochhammer[f,k]Pochhammer[g,k]))//Simplify
5
∑
k=0
k
z
k!
Out[]=
True
Now, consider the basic hypergeometric function:
r
ϕ
s
a
1
a
r
b
1
b
s
∞
∑
k=0
(;q)
a
1
k
(;q)
a
r
k
(;q)
b
1
k
(;q)
b
s
k
s-r+1
k
(-1)
k(k-1)/2
q
k
z
(q;q)
k
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],QPochhammer[a,q,k]QPochhammer[b,q,k]
n
∑
k=0
k
z
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 -Pochhammer symbol:
q
(a;q)
k+n
(a;q)
n
(a;q)
n
q
k
In terms of Mathematica’s functions:
QPochhammer[a,q,k+n]==QPochhammer[a,q,n]QPochhammer[a,q,k]
n
q
With that, the following expression for the tail can be derived:
∞
∑
k=n+1
(;q)
a
1
k
(;q)
a
r
k
(;q)
b
1
k
(;q)
b
s
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
(;q)
a
1
n+1
(;q)
a
r
n+1
(;q)
b
1
n+1
(;q)
b
s
n+1
r
ϕ
s
a
1
n+1
q
a
r
n+1
q
n+2
q
b
1
n+1
q
b
s
n+1
q
(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]-QHypergeometricPFQAppend[a,q],Append[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}]
n+1
q
n+1
q
n+2
q
(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]-QHypergeometricPFQ{q,a,b},f,g,h,,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])
20
q
5
z
5
q
5
q
5
q
5
q
5
q
6
q
10
q
In[]:=
Series[%,{z,0,6}]//FullSimplify
Out[]=
1++(QPochhammer[a,q,2]QPochhammer[b,q,2])(QPochhammer[f,q,2]QPochhammer[g,q,2]QPochhammer[h,q,2]QPochhammer[q,q,2])+(QPochhammer[a,q,3]QPochhammer[b,q,3])(QPochhammer[f,q,3]QPochhammer[g,q,3]QPochhammer[h,q,3]QPochhammer[q,q,3])+(QPochhammer[a,q,4]QPochhammer[b,q,4])(QPochhammer[f,q,4]QPochhammer[g,q,4]QPochhammer[h,q,4]QPochhammer[q,q,4])+
(-1+a)(-1+b)z
(-1+f)(-1+g)(-1+h)(-1+q)
2
q
2
z
6
q
3
z
12
q
4
z
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
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: for Pochhammer (also listed on the Wolfram Functions site), and for -Pochhammer. With these two, one can write the following multisection function:
(a)
mk+r
(a)
r
mk
m
m-1
∏
j=0
a+j+r
m
k
(a;q)
mk+r
(a;q)
r
m-1
∏
j=0
a;
j+r
q
m
q
k
q
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];TableHypergeometricPFQAppend,1,Join,,,{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];TableQHypergeometricPFQAppendFlattenOuterTimes,a,,,JoinFlattenOuterTimes,b,,,,,{k,0,n-1};
k
z
k!
Product[Pochhammer[ak,k],{ak,a}]
Product[Pochhammer[bk,k],{bk,b}]
Flatten[Outer[Plus,a,Range[0,n-1]]]+k
n
Flatten[Outer[Plus,b,Range[0,n-1]]]+k
n
Range[n]+k
n
n(p-q-1)
n
n
z
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}]
k+Range[0,n-1]
q
n
q
k+Range[0,n-1]
q
Range[n]+k
q
n
q
(Binomial[n,2]+nk)(s-r+1)
q
n
z
(Note that the multisection formula for the hypergeometric function is also in the Wolfram Functions site. The -analog does not seem to have been explicitly stated in previous literature.)
q
For an explicit demonstration, let us perform a splitting into even and odd parts:
In[]:=
hypgMulti[HypergeometricPFQ[{a,b},{c},z],2]
Out[]=
HypergeometricPFQ+,,+,,,+,,,abzHypergeometricPFQ+,1+,+,1+,,+,1+,
1
2
a
2
a
2
1
2
b
2
b
2
1
2
1
2
c
2
c
2
2
z
1
c
1
2
a
2
a
2
1
2
b
2
b
2
3
2
1
2
c
2
c
2
2
z
In[]:=
hypgMulti[QHypergeometricPFQ[{a,b},{c},q,z],2]
Out[]=
QHypergeometricPFQ[{a,b,aq,bq},{c,q,cq},,],(1-a)(1-b)zQHypergeometricPFQ[{aq,bq,a,b},{cq,c,},,]((1-c)(1-q))
2
q
2
z
2
q
2
q
2
q
3
q
2
q
2
z
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+,+,+,,+,+,+,,+,+,+,,,,,+,+,+,,+,+,+,,,abczHypergeometricPFQ+,+,+,1+,+,+,+,1+,+,+,+,1+,,,,+,+,+,1+,+,+,+,1+,,a(1+a)b(1+b)c(1+c)HypergeometricPFQ+,+,1+,+,+,+,1+,+,+,+,1+,+,,,,+,+,1+,+,+,+,1+,+,,a(1+a)(2+a)b(1+b)(2+b)c(1+c)(2+c)HypergeometricPFQ+,1+,+,+,+,1+,+,+,+,1+,+,+,,,,+,1+,+,+,+,1+,+,+,
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
c
4
3
4
c
4
c
4
1
4
1
2
3
4
1
4
f
4
1
2
f
4
3
4
f
4
f
4
1
4
g
4
1
2
g
4
3
4
g
4
g
4
4
z
1
fg
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
c
4
3
4
c
4
c
4
1
2
3
4
5
4
1
4
f
4
1
2
f
4
3
4
f
4
f
4
1
4
g
4
1
2
g
4
3
4
g
4
g
4
4
z
1
2f(1+f)g(1+g)
2
z
1
2
a
4
3
4
a
4
a
4
5
4
a
4
1
2
b
4
3
4
b
4
b
4
5
4
b
4
1
2
c
4
3
4
c
4
c
4
5
4
c
4
3
4
5
4
3
2
1
2
f
4
3
4
f
4
f
4
5
4
f
4
1
2
g
4
3
4
g
4
g
4
5
4
g
4
4
z
1
6f(1+f)(2+f)g(1+g)(2+g)
3
z
3
4
a
4
a
4
5
4
a
4
3
2
a
4
3
4
b
4
b
4
5
4
b
4
3
2
b
4
3
4
c
4
c
4
5
4
c
4
3
2
c
4
5
4
3
2
7
4
3
4
f
4
f
4
5
4
f
4
3
2
f
4
3
4
g
4
g
4
5
4
g
4
3
2
g
4
4
z
To obtain the corresponding cosine and sine functions, we can do the following:
CITE THIS NOTEBOOK
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
by J. M.
Wolfram Community, STAFF PICKS, April 25, 2025
https://community.wolfram.com/groups/-/m/t/3450241