QSUM: Indeﬁnite and Deﬁnite Summation of q-hypergeometric Terms
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 16.51 QSUM: Indeﬁnite and Deﬁnite Summation of q-hypergeometric Terms

Authors: Harald Böing and Wolfram Koepf

#### 16.51.1 Introduction

This package is an implementation of the q-analogues of Gosper’s and Zeilberger’s45 algorithm for indeﬁnite, and deﬁnite summation of q-hypergeometric terms, respectively.

An expression ak is called a q-hypergeometric term, if ak∕ak−1 is a rational function with respect to qk. Most q-terms are based on the q-shifted factorial or qpochhammer. Other typical q-hypergeometric terms are ratios of products of powers, q-factorials, q-binomial coeﬃcients, and q-shifted factorials that are integer-linear in their arguments.

#### 16.51.2 Elementary q-Functions

Our package supports the input of the following elementary q-functions:

- qpochhammer(a,q,infinity)@

- qpochhammer(a,q,k)

- qbrackets(k,q)

- qfactorial(k,q)

- qbinomial(n,k,q)

Furthermore it is possible to use an abbreviation for the generalized q-hypergeometric series (basic generalized hypergeometric series, see e. g. [GR90], Chapter 1) which is deﬁned as:

where k is a short form to write the product ∏ j=1rk. An rϕs series terminates if one of its numerator parameters is of the form q−n with n ∈ ℕ. The additional factor 1+s−r (which does not occur in the corresponding deﬁnition of the generalized hypergeometric function) is due to a conﬂuence process. With this factor one gets the simple formula:

Another variation is the bilateral basic hypergeometric series (see e. g. [GR90], Chapter 5) that is deﬁned as

The summands of those generalized q-hypergeometric series may be entered by

- qphihyperterm(a1,a2,...,a3,b1,b2,...,b3,q,z,k) and
- qpsihyperterm(a1,a2,...,a3,b1,b2,...,b3,q,z,k)

respectively.

#### 16.51.3 q-Gosper Algorithm

The q-Gosper algorithm[Koo93] is a decision procedure, that decides by algebraic calculations whether or not a given q-hypergeometric term ak has a q-hypergeometric term antidiﬀerence gk, i. e. ak = gk −gk−1 with gk∕gk−1 rational in qk. The ratio gk∕ak is also rational in qk — an important fact which makes the rational certiﬁcation (see § 16.51.4) of Zeilberger’s algorithm possible. If the procedure is successful it returns gk, in which case we call ak q-Gosper-summable. Otherwise no q-hypergeometric antidiﬀerence exists. Therefore if the q-Gosper algorithm does not return a q-hypergeometric antidiﬀerence, it has proved that no such solution exists, an information that may be quite useful and important.

Any antidiﬀerence is uniquely determined up to a constant, and is denoted by

Finding gk given ak is called indeﬁnite summation. The antidiﬀerence operator Σ is the inverse of the downward diﬀerence operator ∇ak = ak − ak−1. There is an analogous summation theory corresponding to the upward diﬀerence operator Δak = ak+1 − ak.

In case, an antidiﬀerence gk of ak is known, any sum ∑ k=mnak can be easily calculated by an evaluation of g at the boundary points like in the integration case:

#### 16.51.4 q-Zeilberger Algorithm

The q-Zeilberger algorithm [Koo93] deals with the deﬁnite summation of q-hypergeometric terms f(n,k) wrt. n and k:

Zeilberger’s idea is to use Gosper’s algorithm to ﬁnd an inhomogeneous recurrence equation with polynomial coeﬃcients for f(n,k) of the form

| (16.91)

where g(k)∕f(k) is rational in qk and qn. Assuming ﬁnite support of f(n,k) wrt. k (i. e. f(n,k) = 0 for any n and all suﬃciently large k) we can sum equation (16.91) over all k ∈ ℤ. Thus we receive a homogeneous recurrence equation with polynomial coeﬃcients (called holonomic equation) for s(n):

| (16.92)

At this stage the implementation assumes that the summation bounds are inﬁnite and the input term has ﬁnite support wrt. k. If those input requirements are not fulﬁlled the resulting recursion is probably not valid. Thus we strongly advise the user to check those requirements.

Despite this restriction you may still be able to get valuable information by the program: On request it returns the left hand side of the recurrence equation (16.92) and the antidiﬀerence g(k) of equation (16.91).

Once you have the certiﬁcate g(k) it is trivial (at least theoretically) to prove equation (16.92) as long as the input requirements are fulﬁlled. Let’s assume somone gives us equation (16.91). If we divide it by f(n,k) we get a rational identity (in qn and qk) —due to the fact that g(k)∕f(n,k) is rational in qn and qk. Once we conﬁrmed this identity we sum equation (16.91) over k ∈ ℤ:

| (16.93)

Again we exploit the fact that g(k) is a rational multiple of f(n,k) and thus g(k) has ﬁnite support which makes the telescoping sum on the right hand side vanish. If we exchange the order of summation we get equation (16.92) which ﬁnishes the proof.

Note that we may relax the requirements for f(n,k): An inﬁnite support is possible as long as limk→∞g(k) = 0. (This is certainly true if limk→∞p(k)f(k) = 0 for all polynomials p(k).)

For a quite general class of q-hypergeometric terms (proper q-hypergeometric terms) the q-Zeilberger algorithm always ﬁnds a recurrence equation, not necessarily of lowest order though. Unlike Zeilberger’s original algorithm its q-analogue more often fails to determine the recursion of lowest possible order, however (see [PR95]).

If the resulting recurrence equation is of ﬁrst order

s(n) turns out to be a q-hypergeometric term (as a and b are polynomials in qn), and a q-hypergeometric solution can be easily established using a suitable initial value.

If the resulting recurrence equation has order larger than one, this information can be used for identiﬁcation purposes: Any other expression satisfying the same recurrence equation, and the same initial values, represents the same function.

Our implementation is mainly based on [Koo93] and on the hypergeometric analogue described in [Koe95a]. More examples can be found in [GR90], [Gas95], some of which are contained in the test ﬁle qsum.tst.

#### 16.51.5 REDUCE operator QGOSPER

The QSUM package must be loaded by:

1: load qsum;

The qgosper operator is an implementation of the q-Gosper algorithm.

- qgosper(a,q,k) determines a q-hypergeometric antidiﬀerence. (By default it returns a downward antidiﬀerence, which may be changed by the switch qgosper_down; see also § 16.51.8.) If it does not return a q-hypergeometric antidiﬀerence, then such an antidiﬀerence does not exist.
- qgosper(a,q,k,m,n) determines a closed formula for the deﬁnite sum ∑ k=mnak using the q-analogue of Gosper’s algorithm. This is only successful if q-Gosper’s algorithm applies.

Examples: The following two examples can be found in [GR90] ((II.3) and (2.3.4)).

2: qgosper(qpochhammer(a,q,k)*q^k/qpochhammer(q,q,k),q,k);
k
(q *a - 1)*qpochhammer(a,q,k)
-------------------------------
(a - 1)*qpochhammer(q,q,k)
3: qgosper(qpochhammer(a,q,k)*qpochhammer(a*q^2,q^2,k)*
qpochhammer(q^(-n),q,k)*q^(n*k)/(qpochhammer(a,q^2,k)*
qpochhammer(a*q^(n+1),q,k)*qpochhammer(q,q,k)),q,k);
k*n k k n 1
( - q *(q *a - 1)*(q - q )*qpochhammer(----,q,k)
n
q
2 2 2*k n
*qpochhammer(a*q ,q ,k)*qpochhammer(a,q,k))/((q *a - 1)*(q - 1)
n 2
*qpochhammer(q *a*q,q,k)*qpochhammer(a,q ,k)*qpochhammer(q,q,k))

Here are some other simple examples:

4: qgosper(qpochhammer(q^(-n),q,k)*z^k/qpochhammer(q,q,k),q,k);
***** No q-hypergeometric antidifference exists.
5: off qgosper_down;
6: qgosper(q^k*qbrackets(k,q),q,k);
k k
- q *(q + 1 - q )*qbrackets(k,q)
-----------------------------------
k
(q - 1)*(q + 1)*(q - 1)
7: on qgosper_down;
8: qgosper(q^k,q,k,0,n);
n
q *q - 1
----------
q - 1

#### 16.51.6 REDUCE operator QSUMRECURSION

The qsumrecursion operator is an implementation of the q-Zeilberger algorithm. It tries to determine a homogeneous recurrence equation for summ(n) wrt. n with polynomial coeﬃcients (in n), where

If successful the left hand side of the recurrence equation (16.92) is returned.

There are three diﬀerent ways to pass a summand f(n,k) to qsumrecursion:

- qsumrecursion(f,q,k,n), where f is a q-hypergeometric term wrt. k and n, k is the summation variable and n the recursion variable, q is a symbol.
- qsumrecursion(upper,lower,q,z,n) is a shortcut for
  qsumrecursion(qphihyperterm(upper,lower,q,z,k),q,k,n)
- qsumrecursion(f,upper,lower,q,z,n) is a similar shortcut for
  qsumrecursion(f*qphihyperterm(upper,lower,q,z,k),q,k,n),

i. e. upper and lower are lists of upper and lower parameters of the generalized q-hypergeometric function. The third form is handy if you have any additional factors.

For all three instances the following variations are allowed:

- If for some reason the recursion order is known in advance you can specify it as an additional (optional ) argument at the very end of the parameter sequence. There are two ways. If you just specify a positive integer, qsumrecursion looks only for a recurrence equation of this order. You can also specify a range by a list of two positive integers, i. e. the ﬁrst one specifying the lowest and the second one the highest order.

  By default qsumrecursion will search for recurrences of order from 1 to 5. (The global variable qsumrecursion_recrange!* controls this behavior, see § 16.51.8.)

- Usually qsumrecursion uses summ as a name for the summ-function deﬁned above. If you want to use another operator, say e. g. s, then the following syntax applies: qsumrecursion(f,q,k,s(n))

As a ﬁrst example we want to consider the q-binomial theorem:

provided that |z|,|q| < 1. It is the q-analogue of the binomial theorem in the sense that

For a := q−n with n ∈ ℕ our implementation gets:

9: qsumrecursion(qpochhammer(q^(-n),q,k)*z^k/
qpochhammer(q,q,k),q,k,n);
n n
- ((q - z)*summ(n - 1) - q *summ(n))

Notice that the input requirements are fulﬁlled. For n ∈ ℕ the summand is zero for all k > n as k = 0 and the k-term in the denominator makes the summand vanish for all k < 0.

With the switch qsumrecursion_certificate it is possible to get the antidiﬀerence gk described above. When switched on, qsumrecursion returns a list with ﬁve entries, see § 16.51.8. For the last example we get:

10: on qsumrecursion_certificate;
11: proof:= qsumrecursion(qpochhammer(q^(-n),q,k)*z^k/
qpochhammer(q,q,k),q,k,n);
n n
proof := - ((q - z)*summ(n - 1) - q *summ(n)),
k n
- (q - q )*z
----------------,
n
q - 1
k 1
z *qpochhammer(----,q,k)
n
q
--------------------------,
qpochhammer(q,q,k)
k,
downward_antidifference
12: off qsumrecursion_certificate;

Let’s deﬁne the list entries as {rec,cert,f,k,dir}. If you substitute summ(n + j) by f(n + j,k) in rec then you obtain the left hand side of equation (16.91), where f is the input summand. The function g(k) := f*cert is the corresponding antidiﬀerence, where dir states which sort of antidiﬀerence was calculated downward_antidifference or upward_antidifference, see also § 16.51.8. Those informations enable you to prove the recurrence equation for the sum or supply you with the necessary informations to determine an inhomogeneous recurrence equation for a sum with nonnatural bounds.

For our last example we can now calculate both sides of equation (16.91):

13: lhside:= qsimpcomb(sub(summ(n)=part(proof,3),
summ(n-1)=sub(n=n-1,part(proof,3)),part(proof,1)));
k k n n 1
z *(q *(q - z) + q *(z - 1))*qpochhammer(----,q,k)
n
q
lhside := -----------------------------------------------------
n
(q - 1)*qpochhammer(q,q,k)
14: rhside:= qsimpcomb((part(proof,2)*part(proof,3)-
sub(k=k-1,part(proof,2)*part(proof,3))));
k k n n k 1
- z *((q - q )*z - q *(q - 1))*qpochhammer(----,q,k)
n
q
rhside := ---------------------------------------------------------
n
(q - 1)*qpochhammer(q,q,k)
15: qsimpcomb((rhside-lhside)/part(proof,3));
0

Thus we have proved the validity of the recurrence equation.

As some other examples we want to consider some generalizations of orthogonal polynomials from the Askey–Wilson–scheme [KS94]: The q-Laguerre (3.21), q-Charlier (3.23) and the continuous q-Jacobi (3.10) polynomials.

16: operator qlaguerre,qcharlier;
17: qsumrecursion(qpochhammer(q^(alpha+1),q,n)/qpochhammer(q,q,n),
{q^(-n)}, {q^(alpha+1)}, q, -x*q^(n+alpha+1), qlaguerre(n));
n alpha + n n
((q + 1 - q )*q - q *(q *x + q))*qlaguerre(n - 1)
alpha + n n
+ ((q - q)*qlaguerre(n - 2) + (q - 1)*qlaguerre(n))*q
18: qsumrecursion({q^(-n),q^(-x)},{0},q,-q^(n+1)/a,qcharlier(n));
x n n 2*n
- ((q *((q + 1 - q )*a + q )*q - q )*qcharlier(n - 1)
x n n
+ q *((q + a*q)*(q - q)*qcharlier(n - 2) - qcharlier(n)*a*q))
19: on qsum_nullspace;
20: term:= qpochhammer(q^(alpha+1),q,n)/qpochhammer(q,q,n)*
qphihyperterm({q^(-n),q^(n+alpha+beta+1),
q^(alpha/2+1/4)*exp(I*theta), q^(alpha/2+1/4)*exp(-I*theta)},
{q^(alpha+1), -q^((alpha+beta+1)/2), -q^((alpha+beta+2)/2)},
q,q,k)$
21: qsumrecursion(term,q,k,n,2);

n i*theta alpha beta n
- ((q *e *(q *(q *(q *(q + 1) - q) - q
alpha + beta + n n beta + n
+ q *(q + 1 - q - q )) -
(alpha + beta)/2 alpha n beta + n n
q *(q *(q *(q + 1) - q + q *(q + 1 - q ))
2*alpha + beta + 2*n
- (q + q)))*(sqrt(q) + q) +
(2*alpha + 1)/4 2*i*theta alpha + beta + 2*n 2
q *(e + 1)*(q - q )
alpha + beta + 2*n alpha + beta + 2*n
*(q - 1))*(q - q)*summ(n - 1) -
i*theta (alpha + beta + 2*n)/2 (alpha + beta + 2*n)/2
e *((q *(q + q)
(alpha + beta + 2*n)/2
*(q - q)*(sqrt(q) + q) +
(2*alpha + 2*beta + 4*n + 1)/2
(q + q)
alpha + beta + 2*n 2 alpha + beta + n
*(q - q ))*(q - 1)
n alpha alpha + beta + 2*n
*(q - 1)*summ(n) + (q *(sqrt(q)*q + q )
(3*alpha + beta + 2*n)/2
+ q *(sqrt(q) + q))
alpha + beta + 2*n alpha + n beta + n
*(q - 1)*(q - q)*(q - q)
*summ(n - 2)))
22: off qsum_nullspace;

The setting of qsum_nullspace (see [PR95] and § 16.51.8) results in a faster calculation of the recurrence equation for this example.

#### 16.51.7 Simpliﬁcation Operators

An essential step in the algorithms introduced above is to decide whether a term ak is q-hypergeometric, i. e. if the ratio ak∕ak−1 is rational in qk.

The procedure qsimpcomb provides this facility. It tries to simplify all exponential expressions in the given term and applies some transformation rules to the known elementary q-functions as qpochhammer, qbrackets, qbinomial and qfactorial. Note that the procedure may fail to completely simplify some expressions. This is due to the fact that the procedure was designed to simplify ratios of q-hypergeometric terms in the form f(k)∕f(k − 1) and not arbitrary q-hypergeometric terms.

E. g. an expression like −n ⋅n is not recognized as 1, despite the transformation formula

which is valid for n ∈ ℕ.

Note that due to necessary simpliﬁcation of powers, the switch precise is (locally) turned oﬀ in qsimpcomb. This might produce wrong results if the input term contains e. g. complex variables.

The following synomyms may be used:

- up_qratio(f,k) or qratio(f,k) for qsimpcomb(sub(k=k+1,f)/f) and
- down_qratio(f,k) for qsimpcomp(f/sub(k=k-1,f)).

#### 16.51.8 Global Variables and Switches

The following switches can be used in connection with the QSUM package:

- qsum_trace, default setting is oﬀ. If it is turned on some intermediate results are printed.
- qgosper_down, default setting is on. It determines whether qgosper returns a downward or an upward antidiﬀerence gk for the input term ak, i. e. ak = gk − gk−1 or ak = gk+1 − gk respectively.
- qsumrecursion_down, default setting is on. If it is switched on a downward recurrence equation will be returned by qsumrecursion. Switching it oﬀ leads to an upward recurrence equation.
- qsum_nullspace, default setting is oﬀ. The antidiﬀerence g(k) is always a rational multiple (in qk) of the input term f(k). qgosper and qsumrecursion determine this certiﬁcate, which requires solving a set of linear equations. If the switch qsum_nullspace is turned on a modiﬁed nullspace-algorithm will be used for solving those equations. In general this method is slower. However if the resulting recurrence equation is quite complicated it might help to switch on qsum_nullspace. See also [Knu81] and [PR95].
- qgosper_specialsol, default setting is on. The antidiﬀerence g(k) which is determined by qgosper might not be unique. If this switch is turned on, just one special solution is returned. If you want to see all solutions, you should turn the switch oﬀ.
- qsumrecursion_exp, default setting is oﬀ. This switch determines if the coeﬃcients of the resulting recurrence equation should be factored. Turning it oﬀ might speed up the calculation (if factoring is complicated). Note that when turning on qsum_nullspace usually no speedup occurs by switching qsumrecursion_exp on.
- qsumrecursion_certificate, default oﬀ. As Zeilberger’s algorithm delivers a recurrence equation for a q-hypergeometric term f(n,k), see equation (16.91), this switch is used to get all necessary informations for proving this recurrence equation.

  If it is set on, instead of simply returning the resulting recurrence equation (for the sum)—if one exists—qsumrecursion returns a list {rec,cert,f,k,dir} with ﬁve items: The ﬁrst entry contains the recurrence equation, while the other items enable you to prove the recurrence a posteriori by rational arithmetic.

  If we denote by r the recurrence rec where we substituted the summ-function by the input term f (with the corresponding shifts in n) then the following equation is valid:

  or

  if dir=downward_antidifference or dir=upward_antidifference respectively.

The global variable qsumrecursion_recrange!* controls for which recursion orders the procedure qsumrecursion looks. It has to be a list with two entries, the ﬁrst one representing the lowest and the second one the highest order of a recursion to search for. By default it is set to {1,5}.

#### 16.51.9 Messages

The following messages may occur:

- If your call to qgosper or qsumrecursion reveals some incorrect syntax, e. g. wrong number of arguments or wrong type you may receive the following messages:
  ***** Wrong number of arguments.

  or

  ***** Wrong type of arguments.

- If you call qgosper with a summand term that is free of the summation variable you get
  WARNING: Summand is independent of summation variable.
  ***** No q-hypergeometric antidifference exists.

- If qgosper ﬁnds no antidiﬀerence it returns:
  ***** No q-hypergeometric antidifference exists.

- If qsumrecursion ﬁnds no recursion in the speciﬁed range it returns:
  ***** Found no recursion. Use higher order.

  (If you do not pass a range as an argument to qsumrecursion the default range in qsumrecursion_recrange!* will be used.)

- If the input term passed to qgosper (qsumrecursion) is not q-hypergeometric wrt. the summation variable — say k — (and the recursion variable) then you get
  ***** Input term is probably not q-hypergeometric.

  With all the examples we tested, our procedures decided properly whether the input term was q-hypergeometric or not. However, we cannot guarantee in general that qsimpcomb always returns an expression that looks rational in qk if it actually is.

- If the global variable qsumrecursion_recrange!* was assigned an invalid value:
  Global variable qsumrecursion_recrange!* must be a list
  of two positive integers: {lo,hi} with lo<=hi.
  ***** Invalid value of qsumrecursion_recrange!*

Up | Next | Prev | PrevTail | Front