The QDifferenceEquations Package
The QDifferenceEquations package provides algorithms for solving linear q-difference (q-recurrence) equations or systems in terms of polynomials or rational functions.
Let K be a field and q an indeterminate over K. A linear q-difference equation with polynomial coefficients has the form an⁢Qn⁢y+an−1⁢Qn−1⁢y+...+a1⁢Q⁢y+a0⁢y=b , where an,an−1,...,a1,a0,b are polynomials in x with coefficients from K⁡q and Q is the q-shift operator Qi⁢y⁡x=y⁡qi⁢x for all integers i . (This is a multiplicative analog of the ordinary shift operator Ei⁢y⁡x=y⁡x+i .)
The goal is to find all solutions y that are polynomials or rational functions with coefficients from K⁡q. More generally, a system of such equations has the same form as above, but now y is a vector of m unknown functions, a[n], ..., a[0], which are m by k matrices with polynomial entries, and b is a vector with k polynomial entries. As in the case of (systems of) ordinary difference equations, the polynomial (or rational) solutions form a finite-dimensional vector space over K⁡q .
Note: The Maple LREtools package provides methods for solving ordinary difference equations or systems. For information on solving systems of ordinary or q-difference equations, see the LinearFunctionalSystems package.
Simple Example
To illustrate the connection between ordinary and q-difference equations, a simple example is provided. Consider the recurrence equation y⁡q⁢x=q2⁢y⁡x+x. Substituting qx for x and letting z⁡x=y⁡qx, you obtain the ordinary difference equation z⁡x+1=q2⁢z⁡x+qx. Use LREtools to solve this recurrence equation.
restart:
de:=zx+1=q2⁢zx+qx:LREtoolshypergeomsolsde,zx,
−z⁡0⁢q+1+z⁡0⁢q2⁢q2xq⁢q−1−qxq⁢q−1
Here, z⁡0 represents an arbitrary constant. But you can also solve the original q-difference equation. In the notation from above, you have n=1, a1=1, a0=−q2, and b=x :
qe:=yq⁢x=q2⁢y⁡x+x:QDifferenceEquations[RationalSolution]⁡qe,y⁡x
_C1⁢x2−xq⁢q−1
The arbitrary constant is represented by _C1 in this case, and after substituting qx for x, this solution is equivalent to the one above, which uses a slightly different parametrization.
Commands Exported by QDifference Equations
The remainder of this worksheet describes the commands exported by QDifferenceEquations.
withQDifferenceEquations:
In analogy to LREtools[REcreate], the QECreate command returns a data structure with a normalized representation of the input equation(s) together with some useful information, for example, whether the equation is linear, the order of the equation, and the list of coefficients. This information is used internally by the other commands in the package.
Q1 ≔QECreateqe,y⁡x
Q1:=QESol⁡y⁡q⁢x−q2⁢y⁡x=x,y⁡x,INFO
eval⁡op⁡3,Q1
tablevars=x,qshifts=0,1,alpha_coeffs=0,0,order=1,functions=y,coeffs=−x,−q2,1,zero_coeffs=−q2,1,q_par=q,linear=true,Qeqn=&Qx,q⁡y−q2
This works for non-linear equations, with less information, though.
Q2 ≔ QECreatey⁡q⁢x⁢y⁡x=y⁡x+1,y⁡x
Q2:=QESol⁡y⁡x⁢y⁡q⁢x−1=1,y⁡x,INFO
eval⁡op⁡3,Q2
tablevars=x,functions=y,q_par=q,linear=false
Here is an example of a system of linear q-difference equations.
qsys:=q2⁢x+q⁢x+q⁢y2⁡q⁢x−q+1⁢q2⁢x+x+1⁢y2⁡x+q2⁢x+q⁢x+1⁢y1⁡x=0,y1⁡q⁢x=y2⁡x:
Q3 ≔QECreateqsys,y1⁡x,y2⁡x
Q3:=QESol⁡q2⁢x+q⁢x+q⁢y2⁡q⁢x−q+1⁢q2⁢x+x+1⁢y2⁡x+q2⁢x+q⁢x+1⁢y1⁡x=0,y1⁡q⁢x=y2⁡x,y1⁡x,y2⁡x,INFO
eval⁡op⁡3,Q3
tablevars=x,systemproperties=tablemethod=ordinary,system=y1⁡q⁢x−y2⁡x,y2⁡q⁢x⁢q2⁢x+y2⁡q⁢x⁢q⁢x+y2⁡q⁢x⁢q−y2⁡x⁢q3⁢x−y2⁡x⁢q⁢x−y2⁡x⁢q−y2⁡x⁢q2⁢x−y2⁡x⁢x−y2⁡x+y1⁡x⁢q2⁢x+y1⁡x⁢q⁢x+y1⁡x,var=x,case=qdifference,system0=y1⁡q⁢x−y2⁡x,y2⁡q⁢x⁢q2⁢x+y2⁡q⁢x⁢q⁢x+y2⁡q⁢x⁢q−y2⁡x⁢q3⁢x−y2⁡x⁢q⁢x−y2⁡x⁢q−y2⁡x⁢q2⁢x−y2⁡x⁢x−y2⁡x+y1⁡x⁢q2⁢x+y1⁡x⁢q⁢x+y1⁡x,qshifts=0,1,0,1,order=1,functions=y1⁡x,y2⁡x,f_names=y1,y2,input=lists,q_par=q,functions=y1,y2,q_par=q,linear=true
evalsystemproperties
tablemethod=ordinary,system=y1⁡q⁢x−y2⁡x,y2⁡q⁢x⁢q2⁢x+y2⁡q⁢x⁢q⁢x+y2⁡q⁢x⁢q−y2⁡x⁢q3⁢x−y2⁡x⁢q⁢x−y2⁡x⁢q−y2⁡x⁢q2⁢x−y2⁡x⁢x−y2⁡x+y1⁡x⁢q2⁢x+y1⁡x⁢q⁢x+y1⁡x,var=x,case=qdifference,system0=y1⁡q⁢x−y2⁡x,y2⁡q⁢x⁢q2⁢x+y2⁡q⁢x⁢q⁢x+y2⁡q⁢x⁢q−y2⁡x⁢q3⁢x−y2⁡x⁢q⁢x−y2⁡x⁢q−y2⁡x⁢q2⁢x−y2⁡x⁢x−y2⁡x+y1⁡x⁢q2⁢x+y1⁡x⁢q⁢x+y1⁡x,qshifts=0,1,0,1,order=1,functions=y1⁡x,y2⁡x,f_names=y1,y2,input=lists,q_par=q
The PolynomialSolution command computes all polynomial solutions of a given q-difference equation. It returns them in the form of a general solution involving arbitrary constants _C0,_C1,... . The number of these constants is equal to the dimension of the space of all polynomial solutions and is generally less or equal to the order n of the equation. If it is strictly less, then the equation has non-polynomial solutions.
qe:=q2⁢x+q⁢x+q⁢y⁡q2⁢x−q+1⁢q2⁢x+x+1⁢y⁡q⁢x+q2⁢x+q⁢x+1⁢y⁡x=0:
psol:=PolynomialSolution⁡qe,y⁡x
psol:=_C1+x⁢_C1
Using IsSolution, verify this solution for values of _C1:
IsSolution⁡psol,qe,y⁡x
true
IsSolution⁡x+1,qe,y⁡x
IsSolution⁡3⁢x+3,qe,y⁡x
If IsSolution is applied to an expression that does not solve the given equation, then it returns the degree of the difference of both sides of the equation.
sSolution⁡x,qe,y⁡x=degree⁡expand⁡lhs⁡qe−rhs⁡qey=x→x|lhs⁡qe−rhs⁡qey=x→x,x
sSolution⁡x,q2⁢x+q⁢x+q⁢y⁡q2⁢x−q+1⁢q2⁢x+x+1⁢y⁡q⁢x+q2⁢x+q⁢x+1⁢y⁡x=0,y⁡x=1
The q-difference equation qe has order two, but the polynomial solution space has dimension only one, so there are non-polynomial solutions. All solutions of this equation are rational.
rsol:=RationalSolution⁡qe,y⁡x
rsol:=_C0+x⁢_C2+x2⁢_C2x
IsSolution⁡1x,qe,y⁡x
IsSolution⁡x+1+2x,qe,y⁡x
Both PolynomialSolution and RationalSolution work for systems of linear q-difference equations.
PolynomialSolution⁡qsys,y1⁡x,y2⁡x
_C1q+x⁢_C1q,_C1q+x⁢_C1
RationalSolution⁡qsys,y1⁡x,y2⁡x
q2⁢_C1+x⁢_C2+x2⁢_C2q⁢x,q⁢_C1+x⁢_C2+q⁢x2⁢_C2q⁢x
The AreSameSolution command checks whether two given general solutions of a q-difference equation are equivalent, that is, they describe the same solution space. The command assumes that both its arguments solve the equation, but does not check this.
AreSameSolution⁡psol,rsol
false
AreSameSolution⁡psol+2⁢_C3x,rsol,x
AreSameSolution⁡psol+_C0+_C1x,rsol,x
The q-dispersion of two polynomials f,g is defined analogously to the dispersion in the ordinary difference case, namely as the maximal non-negative integer d such that Qd⁢f and g have a nonconstant common divisor (that is, a common root). However, powers of the independent variable (that is, the root 0) are excluded. More generally, the set of all such non-negative integers is called the q-dispersion set of f and g. The QDispersion command returns this set, or if the option maximal is specified, it returns the q-dispersion. If no such d exists, or if the only common divisors are powers of the independent variable, FAIL is returned.
QDispersion⁡x+q5⁢x+q⁢q⁢x+1,x3−x,q,x
1,5
QDispersion⁡x+q5⁢x+q⁢q⁢x+1,x3−x,q,x,'maximal'
5
QDispersion⁡x+1,x+q,q,x
FAIL
QDispersion⁡x2,q⁢x2+x,q,x,'maximal'
The UniversalDenominator command computes a common multiple of the denominators of all rational solutions of a given q-difference equation.
UniversalDenominator⁡qe,y⁡x
x
Return to Index for Example Worksheets
Download Help Document