\documentclass[12pt]{article}
\textwidth18cm
\textheight24cm
\oddsidemargin0cm
\topmargin-1cm
\hoffset-1truecm
\voffset-0.5truecm

\catcode`\@=11
\def\AmSTeX{{\textfontii A}\kern-.1667em\lower.5ex\hbox
 {\textfontii M}\kern-.125em{\textfontii S}-\TeX}
\def\textfontii{\the\textfont\tw@}
\def\setboxz@h{\setbox\z@\hbox}
\def\wdz@{\wd\z@}
\def\boxz@{\box\z@}
\def\setbox@ne{\setbox\@ne}
\def\wd@ne{\wd\@ne}
\def\RIfM@{\relax\ifmmode}
\def\pmb{\RIfM@\expandafter\mathpalette\expandafter\pmb@\else
 \expandafter\pmb@@\fi}
\def\pmb@@#1{\leavevmode\setboxz@h{#1}\kern-.025em\copy\z@\kern-\wdz@
 \kern-.05em\copy\z@\kern-\wdz@\kern-.025em\raise.0433em\boxz@}
\def\binrel@@#1{\ifdim\wd2<\z@\mathbin{#1}\else\ifdim\wd\tw@>\z@
 \mathrel{#1}\else{#1}\fi\fi}
\newdimen\pmbraise@
\def\pmb@#1#2{\setbox\thr@@\hbox{$\m@th#1{#2}$}%
 \setbox4 \hbox{$\m@th#1\mkern.7794mu$}\pmbraise@\wd4
 \binrel@{#2}\binrel@@{\mkern-.45mu\copy\thr@@\kern-\wd\thr@@
 \mkern-.9mu\copy\thr@@\kern-\wd\thr@@\mkern-.45mu\raise\pmbraise@\box\thr@@}}
\catcode`\@=12
\def\poq#1#2{(#1;q)_#2}
\def\po#1#2{(#1)_#2}
\def\bmatrix#1\\#2\endbmatrix{\left[\hspace{-2pt}%
        \begin{array}{c}#1\\#2\end{array}\hspace{-2pt}\right]}
\def\binom#1#2{{#1\choose #2}}
\def\qed{\vrule height5pt depth2pt width5pt}


{\obeylines
\gdef\MATH{\begingroup\parindent0pt\parskip0pt plus 0.25pt\obeylines%
        \def^^M{\penalty10000\par\penalty10000%
        \vrule height10pt depth2pt width0pt\leavevmode}%
        \obeyspaces\tt}%
}
\def\goodbreakpoint{\par\penalty-5000%
         \vrule height10pt depth2pt width0pt\leavevmode}
\def\endMATH{\endgroup}
\def\MATHphi{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\phi$\hss}\hss}}
\def\MATHGamma{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\Gamma$\hss}\hss}}
\def\MATHpi{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\pi$\hss}\hss}}
\def\MATHinfty{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\infty$\hss}\hss}}
\def\MATHhStrich{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\vrule height4.5pt depth-3.5pt width5.24995pt}\hss}}
\def\MATHluEck{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hskip2.12497pt
         \vrule height4.5pt depth1pt width1pt
         \vrule height4.5pt depth-3.5pt width2.12498pt}\hss}}
\def\MATHruEck{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{%
         \vrule height4.5pt depth-3.5pt width2.12497pt
         \vrule height4.5pt depth1pt width1pt
         \hskip2.12498pt}\hss}}
\def\MATHloEck{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hskip2.12497pt
         \vrule height9pt depth-3.5pt width1pt
         \vrule height4.5pt depth-3.5pt width2.12498pt}\hss}}
\def\MATHroEck{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{%
         \vrule height4.5pt depth-3.5pt width2.12497pt
         \vrule height9pt depth-3.5pt width1pt
         \hskip2.12498pt}\hss}}
\def\MATHvStrich{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hskip2.12497pt
         \vtop to 0pt{\hsize1pt\vss%
                \vrule height17pt depth6pt width1pt\vskip8pt\vss\par}%
         \hskip2.12498pt}\hss}}
\def\MATHtStueck{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{%
         \vrule height4.5pt depth-3.5pt width2.12497pt
         \vrule height4.5pt depth2pt width1pt
         \vrule height4.5pt depth-3.5pt width2.12498pt}\hss}}
\def\MATHbackslash{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\backslash$\hss}\hss}}
\def\MATHlbrace{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\{$\hss}\hss}}
\def\MATHrbrace{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\}$\hss}\hss}}
\def\MATHkleiner{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\langle$\hss}\hss}}
\def\MATHgroesser{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$\rangle$\hss}\hss}}
\def\MATHhoch{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss$^\land$\hss}\hss}}
\def\MATHtief{\leavevmode
        \hbox to 0pt{\hbox to 5.24995pt{\hss\vrule height0pt depth.8pt width3pt\hss}\hss}}


\title{HYP and HYPQ\\\vskip10pt
\Large {\sl Mathematica\/} packages for the manipulation of
binomial sums and hypergeometric series respectively $q$-binomial
sums and basic hypergeometric series}
\author{C.~Krattenthaler\\
Institut f\"ur Mathematik der Universit\"at Wien,\\
Strudlhofgasse 4, A-1090 Wien, Austria.\\
e-mail: KRATT@PAP.UNIVIE.AC.AT
}
%\tracingmacros=2 \tracingcommands=2
\date{}

\begin{document}

\maketitle
\begin{abstract}
We give a brief description of the main features of the 
\hbox{\sl Mathematica} packages HYP and HYPQ. HYP allows a convenient
handling of binomial sums and hypergeometric series, while its
``$q$-analogue", the package HYPQ, allows a convenient handling of
$q$-binomial sums and basic hypergeometric series.
\end{abstract}

\section{Introduction}
In some branches of mathematics, in particular in combinatorics,
research workers frequently have to deal with
binomial sums and $q$-binomial sums. Hence it would be desirable to
have something like a standardized list of binomial and $q$-binomial
identities. An attempt for binomial identities was made by
H.~W.~Gould \cite{GOulAS}. However, since there are many different
ways of writing the same binomial (respectively $q$-binomial) sum,
such a list could be never satisfying. But ``almost all" binomial
respectively $q$-binomial sums admit a normal form, namely when
written as a hypergeometric respectively basic hypergeometric series.
And even better, there are not too many basic identities for
hypergeometric respectively basic hypergeometric series (most of
them being known for more than 50 years) from which ``everything else"
can be derived, and so are sufficient to work with. These facts were
emphatically pointed out by G.~E.~Andrews \cite{AndrAC} in 1974,
however even now are not as accepted as they should be. A reason for
this might be that until recently no attempt has been made to set up
a comprehensive list of hypergeometric and basic hypergeometric
identities, which are spread over the literature. Until 1990 the main
sources to be recommended had to be W.~N.~Bailey's booklet
\cite{BailAA} and its ``enhanced version" \cite{SlatAC} by
L.~J.~Slater. At least Slater's book in the appendix contains a list
(though narrow) of hypergeometric and basic hypergeometric
summation formulas, however no transformation formulas. So, for the
unexperienced it remained to be a difficult task to conveniently
search for identities which might help in a particular problem.
Finally, in 1990 G.~Gasper and M.~Rahman published a long-sought book
\cite{GaRaAA} about basic hypergeometric series. The appendix of
this book contains a list of the most important basic hypergeometric
summations {\it and} transformations. This list can also be used by
those who are only interested in hypergeometric identities since
``almost all" hypergeometric identities have their $q$-analogues
(i.e.\ basic hypergeometric analogues), and it is fairly easy to
deduce from a basic hypergeometric identity its hypergeometric (i.e.\
$q\uparrow 1$) special case.

So, only one inconvenience remained. Everybody who ever dealt with
(basic) hypergeometric series knows that doing manipulations with
(basic) hypergeometric expressions amounts to working with cumbersome
expressions which involve a lot of parameters. 
Therefore the probability of mistakes during computations
done by hand is very high. Obviously, since manipulations of (basic)
hypergeometric expressions usually are symbolic in nature, symbolic
computer algebra must be the appropriate tool for a
convenient treatment of (basic) hypergeometric expressions, in
particular if a specialized package is available for this purpose.
This is just what the \hbox{\sl Mathematica\/} packages HYP and HYPQ are
supposed to be: They provide researchers with a tool box for doing
manipulations of such expressions fast and error-free. The package
HYP provides tools for manipulating binomial and hypergeometric
expressions, while its ``$q$-analogue", the
package HYPQ, provides tools for manipulating $q$-binomial and basic
hypergeometric expressions. 

\section{The structure of HYP and HYPQ}
The packages HYP and HYPQ provide tools for
\begin{enumerate}
\item [(A)] manipulating factorial respectively $q$-factorial
expressions,
\item [(B)] transforming binomial respectively $q$-binomial sums
into hypergeometric respectively basic hypergeometric notation,
\item [(C)] summing hypergeometric respectively basic hypergeometric
series,
\item [(D)] transforming hypergeometric respectively basic hypergeometric
series,
\item [(E)] doing formal limits of hypergeometric respectively basic hypergeometric
expressions,
\item [(F)] transforming hypergeometric respectively basic 
hypergeometric \hbox{\sl MATHEMATICA} expressions
into \TeX-code.
\end{enumerate}
By now the collection of summations and transformations that is
included basically consists of the Appendices II and III
(respectively their hypergeometric, i.e.\ $q\uparrow1$, special cases)
of \cite{GaRaAA}. Of
course it is planned to enlarge this collection in the future.

The philosophy behind both packages is:

\bigskip
\centerline{\large\it Do it by yourself!}
\bigskip

The idea is that 
every step in a series of manipulations should be controlled by the
user. Consequently, these packages do not make any attempt to sum or
transform a series automatically. (This is in contrary to the MAPLE
program, which automatically tries to sum a series and, if
successful, displays the result without any information how the system
found the result, which is not what a serious research worker actually
desires.) It is the user who has to tell the packages HYP and HYPQ which
command has to be applied next. In order to help the user to decide
which command {\it could} be applied next, for both packages a
comprehensive manual
(88 respectively 114 pages) giving a complete list
of all the available objects with detailed descriptions, examples, and cross
references is provided. 

Both packages are
mainly {\it rule}-based (a feature which is heavily supported by
\hbox{\sl
Mathematica\/} but unfortunately not by MAPLE). This gives a lot more 
flexibility in doing manipulations compared to sticking to functions
only.

\section{Requirements and how to get the packages}
In order to use these packages you need a computer with some version
of \hbox{\sl Mathematica\/} installed. The input files for the packages
and the \TeX-files for the manuals are available by anonymous {\tt
ftp} at node \hbox{\tt pap.univie.ac.at} Contact the author for
further information. In order to use the packages efficiently it
suffices to have a basic knowledge of \hbox{\sl Mathematica\/}. It is of
great help to have an advanced knowledge of pattern matching, rules,
and pure functions (cf.\ \cite[sections~2.3, 2.4, 2.2.5]{WolfAA}).

\bigskip
In the following I am describing the main features of the packages.
The examples should give a flavour of how to work with these
packages. The displayed output of the examples imitates the output
of the packages under the DOS-version of \hbox{MATHEMATICA}. The output
under other versions of \hbox{MATHEMATICA} is a little bit less
attractive, but similar.

\section{The package HYP}
\subsection{The basic objects}
Of course, the basic objects of HYP are the binomial coefficient $\binom nk$,
the Pochhammer symbol $(a)_n$, the Gamma function $\Gamma(x)$, and
the (generalized) hypergeometric series 
$${}_r F_s\!\left[\matrix {a_1,\dots,a_r\cr b_1,\dots,b_s}; 
z\right]=\sum _{n=0} ^{\infty}\frac {\po{a_1}{n}\cdots\po{a_r}{n}}
{n!\,\po{b_1}{n}\cdots\po{b_s}{n}} z^n\ .$$
(All the notation and terminology is adopted from \cite[pp.~1--6]{GaRaAA}.) 
The example below shows how to enter these basic objects.
\MATH
\goodbreakpoint%
In[1]:= Binomial[n,k]*p[a,n]*GAMMA[x]*F[%
\MATHlbrace a,b,c%
\MATHrbrace ,%
\MATHlbrace d,e%
\MATHrbrace ,z]
\goodbreakpoint%
        (   )    %
\MATHluEck             %
\MATHruEck 
        ( n )    %
\MATHvStrich  a, b, c    %
\MATHvStrich 
Out[1]= (   )  F %
\MATHvStrich         ; z %
\MATHvStrich  \MATHGamma (x) (a)
        ( k ) 3 2%
\MATHvStrich   d, e      %
\MATHvStrich          n
        (   )    %
\MATHloEck             %
\MATHroEck 
\goodbreakpoint%
\endMATH
\subsection{Converting binomial sums into hypergeometric notation}
As mentioned in the Introduction, ``almost all" binomial 
sums can be written in 
hypergeometric notation. For accomplishing this
task quickly there are the rules \hbox{\tt SumRegeln} and
\hbox{\tt SumF}.
\hbox{\tt SumRegeln} tries to transform a binomial sum into
a form that finally can be written as a hypergeometric
series. This last step (if possible) is done by the rule \hbox{\tt SumF}.
As an example we consider the Vandermonde sum.
\MATH
\goodbreakpoint%
In[2]:= Sum[Binomial[N,l]*Binomial[M,K-l],%
\MATHlbrace l,0,Infinity%
\MATHrbrace ]
\goodbreakpoint%
          \MATHinfty 
        %
\MATHluEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHruEck (       ) (   )
         \MATHbackslash    (   M   ) ( N )
Out[2]=   \MATHgroesser   (       ) (   )
         /   ( K - l ) ( l )
        %
\MATHloEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHroEck (       ) (   )
         l=0
\goodbreakpoint%
\endMATH
and convert it into hypergeometric notation
\MATH
\goodbreakpoint%
In[3]:= \%//.SumRegeln
\goodbreakpoint%
           \MATHinfty 
         %
\MATHluEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHruEck    (-K)  (-N)
          \MATHbackslash           l     l
        (  \MATHgroesser   -----------------) (1 - K + M)
          /   (1)  (1 - K + M)              K
         %
\MATHloEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHroEck    l            l
          l=0
Out[3]= -------------------------------------
                        (1)
                           K
\goodbreakpoint%
In[4]:= \%/.SumF
\goodbreakpoint%
           %
\MATHluEck               %
\MATHruEck 
           %
\MATHvStrich   -K, -N      %
\MATHvStrich 
         F %
\MATHvStrich           ; 1 %
\MATHvStrich  (1 - K + M)
        2 1%
\MATHvStrich  1 - K + M    %
\MATHvStrich             K
           %
\MATHloEck               %
\MATHroEck 
Out[4]= --------------------------------
                      (1)
                         K
\goodbreakpoint%
\endMATH

\subsection{Summations for hypergeometric series}
By now, the package HYP includes 17 summation formulas in form of
rules. All the available summations (with references) 
are listed and displayed in the 
manual. Besides, there is the rule \hbox{\tt SListe} which for a
hypergeometric series gives a list of applicable summations.
\MATH
\goodbreakpoint%
In[5]:= \%4/.SListe
Is N a nonnegative integer?
[y|n]:  y
\goodbreakpoint%
Be sure to apply "FOrdne" before using the following information!
\goodbreakpoint%
          S02 (1 - K + M)     S04 (1 - K + M)
                         K                   K
Out[5]= %
\MATHlbrace %
\MATHlbrace ----------------%
\MATHrbrace , %
\MATHlbrace ----------------%
\MATHrbrace %
\MATHrbrace 
                (1)                 (1)
                   K                   K
\goodbreakpoint%
\endMATH
Hence, let us apply {\tt S02} (the Vandermonde summation 
\cite[(1.7.7)]{SlatAC}; {\tt S04} is Gauss'
$_2F_1[1]$-evaluation \cite[(1.7.6)]{SlatAC}).
\MATH
\goodbreakpoint%
In[6]:= \%4/.S02
Is N a nonnegative integer?
[y|n]:  y
\goodbreakpoint%
        (1 + M)  (1 - K + M)
               N            K
Out[6]= ---------------------
          (1)  (1 - K + M)
             K            N
\goodbreakpoint%
\endMATH

\subsection{Manipulations of hypergeometric expressions}
The result in {\tt Out[6]} is not completely convincing since
everybody knows that the result for the Vandermonde sum {\tt Out[2]}
should read $\binom {M+N}K$. To do simplifications of hypergeometric
expressions there are 15 rules which allow to do all the
manipulations which are the contents of Appendix~I in \cite{SlatAC}.
Besides, there are two functions for {\it controlled} application of
rules: \hbox{\tt PosListe} gives a list of all subexpressions of an
expression, together with their respective positions. {\tt Ers}
allows the application of a rule to a specified subexpression.

Now starting with {\tt Out[6]}, we first want to replace
$(1+M)_N\,(1-K+M)_K$ by $(1-K+M)_{K+N}$. This is done with the help
of the rule {\tt erw1}, which replaces $(a)_n$ by $(a)_{n+m}/(a+n)_m$
where $m$ has to be entered on request.
\MATH
\goodbreakpoint%
In[7]:= PosListe[\%]
\goodbreakpoint%
           1
Out[7]= %
\MATHlbrace %
\MATHlbrace ----, %
\MATHlbrace %
\MATHlbrace 1%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , %
\MATHlbrace (1 + M) , %
\MATHlbrace %
\MATHlbrace 2%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , %
\MATHlbrace (1 - K + M) , %
\MATHlbrace %
\MATHlbrace 3%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , 
          (1)                   N                      K
             K
 
           1
\MATHgroesser     %
\MATHlbrace ------------, %
\MATHlbrace %
\MATHlbrace 4%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace %
\MATHrbrace 
      (1 - K + M)
                 N
\goodbreakpoint%
In[8]:= Ers[\%\%,erw1,%
\MATHlbrace 3%
\MATHrbrace ]
top-extend by: N
\goodbreakpoint%
        (1 - K + M)
                   K + N
Out[8]= -----------------
        (1)  (1 - K + M)
           K            N
\goodbreakpoint%
\endMATH
Next we want to replace $(1-K+M)_{K+N}/(1-K+M)_{N}$ by $(1-K+M+N)_K$.
This is done with the help of {\tt zerl} which splits $(a)_n$ into
$(a)_m\,(a+m)_{n-m}$ where $m$ has to be entered on request.
\MATH
\goodbreakpoint%
In[9]:= PosListe[\%]
\goodbreakpoint%
           1                  1
Out[9]= %
\MATHlbrace %
\MATHlbrace ----, %
\MATHlbrace %
\MATHlbrace 1%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , %
\MATHlbrace ------------, %
\MATHlbrace %
\MATHlbrace 2%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , %
\MATHlbrace (1 - K + M)     , %
\MATHlbrace %
\MATHlbrace 3%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace %
\MATHrbrace 
          (1)            (1 - K + M)                       K + N
             K                      N
\goodbreakpoint%
In[10]:= Ers[\%\%,zerl,%
\MATHlbrace 3%
\MATHrbrace ]
bottom-split by: N
\goodbreakpoint%
         (1 - K + M + N)
                        K
Out[10]= ----------------
               (1)
                  K
\goodbreakpoint%
\endMATH
The last expression clearly is identical with $\binom{M+N}K$.

Additional tools are provided for reversing finite summations, for
splitting summations, for shifting summation indices, for exchanging
sums, etc.

\subsection{Transformations of hypergeometric series}
By now, the package HYP includes 35 transformation formulas in form
of rules. All the available transformations (with references) 
are listed and displayed in the 
manual. Besides, there is the rule \hbox{\tt TListe} which for a
hypergeometric series gives a list of applicable transformations.

 As an example, we find a proof for
\MATH
\goodbreakpoint%
In[11]:= Sum[Binomial[n,j]\MATHhoch 3,%
\MATHlbrace j,0,Infinity%
\MATHrbrace ]==
         Sum[Binomial[n,k]\MATHhoch 2*Binomial[2*(n-k),n],%
\MATHlbrace k,0,Infinity%
\MATHrbrace ]
\goodbreakpoint%
           \MATHinfty               \MATHinfty 
         %
\MATHluEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHruEck (   )     %
\MATHluEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHruEck (   )  (            )
          \MATHbackslash    ( n )3     \MATHbackslash    ( n )2 ( 2 (-k + n) )
Out[11]=   \MATHgroesser   (   )  ==   \MATHgroesser   (   )  (            )
          /   ( j )      /   ( k )  (     n      )
         %
\MATHloEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHroEck (   )     %
\MATHloEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHroEck (   )  (            )
          j=0            k=0
\goodbreakpoint%
\endMATH
an identity that occured in the work of V.~Strehl \cite{StreAD}. Of
course, the first step is to transform {\tt Out[11]} into
hypergeometric notation.
\MATH
\goodbreakpoint%
In[12]:= \%//.SumRegeln
\goodbreakpoint%
                                 \MATHinfty    1   n          -n
                               %
\MATHluEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHruEck (- - -)  (-n)  (--)
                                \MATHbackslash     2   2 k     k  2  k
                              (  \MATHgroesser   --------------------) (1 + n)
           \MATHinfty       j      3      /          2  1                  n
         %
\MATHluEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHruEck (-1)  (-n)       %
\MATHloEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHroEck    (1)   (- - n)
          \MATHbackslash              j       k=0       k   2     k
Out[12]=   \MATHgroesser   ------------ == ------------------------------------
          /          3                        (1)
         %
\MATHloEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHroEck    (1)                             n
          j=0       j
\goodbreakpoint%
In[13]:= \%/.SumF
\goodbreakpoint%
                                           1   n  -n
                                     %
\MATHluEck  -n, - - -, --    %
\MATHruEck 
                                     %
\MATHvStrich      2   2  2     %
\MATHvStrich 
                                   F %
\MATHvStrich               ; 1 %
\MATHvStrich  (1 + n)
                                  3 2%
\MATHvStrich       1           %
\MATHvStrich         n
            %
\MATHluEck                 %
\MATHruEck        %
\MATHloEck    1, - - n       %
\MATHroEck 
            %
\MATHvStrich  -n, -n, -n     %
\MATHvStrich               2
Out[13]=  F %
\MATHvStrich            ; -1 %
\MATHvStrich  == --------------------------------
         3 2%
\MATHvStrich     1, 1        %
\MATHvStrich                   (1)
            %
\MATHloEck                 %
\MATHroEck                      n
\goodbreakpoint%
\endMATH
Now, let us continue with the left-hand side,
\MATH
\goodbreakpoint%
In[14]:= \%[[1]]
\goodbreakpoint%
            %
\MATHluEck                 %
\MATHruEck 
            %
\MATHvStrich  -n, -n, -n     %
\MATHvStrich 
Out[14]=  F %
\MATHvStrich            ; -1 %
\MATHvStrich 
         3 2%
\MATHvStrich     1, 1        %
\MATHvStrich 
            %
\MATHloEck                 %
\MATHroEck 
\goodbreakpoint%
\endMATH
We apply \hbox{\tt TListe} to find out which transformation might be
applicable. 
\MATH
\goodbreakpoint%
In[15]:= \%/.TListe
\goodbreakpoint%
Be sure to apply "FOrdne" before using the following information!
\goodbreakpoint%
Out[15]= %
\MATHlbrace %
\MATHlbrace T36%
\MATHrbrace %
\MATHrbrace 
\goodbreakpoint%
\endMATH
There is only a single transformation provided by HYP 
(namely \cite[Ex.~4.(iv), p.~97]{BailAA}) which can be
applied. So, let us apply this transformation.
\MATH
\goodbreakpoint%
In[16]:= \%14/.T36
\goodbreakpoint%
               %
\MATHluEck  -n  1 - n           %
\MATHruEck 
          n    %
\MATHvStrich  --, -----, 1 + n    %
\MATHvStrich 
Out[16]= 2   F %
\MATHvStrich  2     2         ; 1 %
\MATHvStrich 
            3 2%
\MATHvStrich                      %
\MATHvStrich 
               %
\MATHloEck        1, 1          %
\MATHroEck 
\goodbreakpoint%
\endMATH
Now there are several $_3F_2[1]$-transformations which can be
applied.
\MATH
\goodbreakpoint%
In[17]:= \%16/.TListe
Is -1 - n a nonnegative integer?
[y|n]:  n
Is n/2 a nonnegative integer?
[y|n]:  y
Is -1 - n a nonnegative integer?
[y|n]:  n
Is n/2 a nonnegative integer?
[y|n]:  y
\goodbreakpoint%
Be sure to apply "FOrdne" before using the following information!
\goodbreakpoint%
            n         n         n         n         n         n
Out[17]= %
\MATHlbrace %
\MATHlbrace 2  T23%
\MATHrbrace , %
\MATHlbrace 2  T24%
\MATHrbrace , %
\MATHlbrace 2  T25%
\MATHrbrace , %
\MATHlbrace 2  T26%
\MATHrbrace , %
\MATHlbrace 2  T95%
\MATHrbrace , %
\MATHlbrace 2  T96%
\MATHrbrace %
\MATHrbrace 
\goodbreakpoint%
\endMATH
(Respective references are \cite[Ex.~7, p.~98]{BailAA},
\cite[((2.3.3.7)]{SlatAC}, \cite[Ex.~7, p.~98]{BailAA},
\cite[(3.1.1), $q\uparrow 1$]{GaRaAA}, \cite[(III.33), $q\uparrow
1$]{GaRaAA}, \cite[(4.3.4.2)]{SlatAC}.)
The task is to apply {\tt T23}--{\tt T26} ({\tt T95} and {\tt T96}
are three-term relations) and parameter permutations
(being performed by the rules \hbox{\tt FPerm} and \hbox{\tt FTausche})
in some order until we arrive at the right-hand side of {\tt
Out[13]}. After some trials we may find the following series of
transformations.
\MATH
\goodbreakpoint%
In[18]:= \%16/.FTausche[1,3,u]
\goodbreakpoint%
               %
\MATHluEck  1 - n         -n    %
\MATHruEck 
          n    %
\MATHvStrich  -----, 1 + n, --    %
\MATHvStrich 
Out[18]= 2   F %
\MATHvStrich    2           2 ; 1 %
\MATHvStrich 
            3 2%
\MATHvStrich                      %
\MATHvStrich 
               %
\MATHloEck        1, 1          %
\MATHroEck 
\goodbreakpoint%
In[19]:= \%/.T23
\goodbreakpoint%
                 1 - n          n                1 - n   n
               %
\MATHluEck  -----, -n, 1 + -    %
\MATHruEck   %
\MATHluEck  1, 1 - ----- - - %
\MATHruEck 
          n    %
\MATHvStrich    2            2    %
\MATHvStrich   %
\MATHvStrich           2     2 %
\MATHvStrich 
Out[19]= 2   F %
\MATHvStrich                  ; 1 %
\MATHvStrich  \MATHGamma %
\MATHvStrich                   %
\MATHvStrich 
            3 2%
\MATHvStrich             n        %
\MATHvStrich   %
\MATHvStrich      1 - n      n %
\MATHvStrich 
               %
\MATHloEck      1, 1 - -        %
\MATHroEck   %
\MATHloEck  1 - -----, 1 - - %
\MATHroEck 
                            2                   2        2
\goodbreakpoint%
In[20]:= \%/.FPerm[3,1,2,u]
\goodbreakpoint%
                     n  1 - n                    1 - n   n
               %
\MATHluEck  1 + -, -----, -n    %
\MATHruEck   %
\MATHluEck  1, 1 - ----- - - %
\MATHruEck 
          n    %
\MATHvStrich      2    2          %
\MATHvStrich   %
\MATHvStrich           2     2 %
\MATHvStrich 
Out[20]= 2   F %
\MATHvStrich                  ; 1 %
\MATHvStrich  \MATHGamma %
\MATHvStrich                   %
\MATHvStrich 
            3 2%
\MATHvStrich             n        %
\MATHvStrich   %
\MATHvStrich      1 - n      n %
\MATHvStrich 
               %
\MATHloEck      1, 1 - -        %
\MATHroEck   %
\MATHloEck  1 - -----, 1 - - %
\MATHroEck 
                            2                   2        2
\goodbreakpoint%
In[21]:= \%/.T26
Is n a nonnegative integer?
[y|n]:  y
\goodbreakpoint%
                     1 - n  -n                1 - n   n
               %
\MATHluEck  -n, -----, --    %
\MATHruEck   %
\MATHluEck  1, 1 - ----- - - %
\MATHruEck 
          n    %
\MATHvStrich        2    2     %
\MATHvStrich   %
\MATHvStrich           2     2 %
\MATHvStrich       1 - n   n
         2   F %
\MATHvStrich               ; 1 %
\MATHvStrich  \MATHGamma %
\MATHvStrich                   %
\MATHvStrich  (1 - ----- - -)
            3 2%
\MATHvStrich     1 - n   n     %
\MATHvStrich   %
\MATHvStrich      1 - n      n %
\MATHvStrich         2     2 n
               %
\MATHloEck  1, ----- - -     %
\MATHroEck   %
\MATHloEck  1 - -----, 1 - - %
\MATHroEck 
                      2     2                2        2
Out[21]= -----------------------------------------------------------------
                                          n
                                     (1 - -)
                                          2 n
\goodbreakpoint%
In[22]:= ExpandAll[\%]
\goodbreakpoint%
                     1   n  -n                1
               %
\MATHluEck  -n, - - -, --    %
\MATHruEck   %
\MATHluEck      1, -     %
\MATHruEck 
          n    %
\MATHvStrich      2   2  2     %
\MATHvStrich   %
\MATHvStrich         2     %
\MATHvStrich   1
         2   F %
\MATHvStrich               ; 1 %
\MATHvStrich  \MATHGamma %
\MATHvStrich               %
\MATHvStrich  (-)
            3 2%
\MATHvStrich       1           %
\MATHvStrich   %
\MATHvStrich  1   n      n %
\MATHvStrich   2 n
               %
\MATHloEck    1, - - n       %
\MATHroEck   %
\MATHloEck  - + -, 1 - - %
\MATHroEck 
                      2                2   2      2
Out[22]= -------------------------------------------------
                                  n
                             (1 - -)
                                  2 n
\goodbreakpoint%
\endMATH
The $_3F_2$ agrees with the $_3F_2$ at the right-hand side of {\tt Out[13]}.
It is easy to show that the other terms simplify to
$(1+n)_n/n!$. Hence {\tt Out[11]} is proved.

\subsection{Explicit evaluation}
Very often one wants to compute special values of hypergeometric
expressions, in particular when checking if some identity might be
true or not. For this purpose one should use the {\it evaluation mode}
of HYP. So far, all examples were done in the {\it symbolic mode} of
HYP. In symbolic mode even expressions like $(a)_3$ (which equals
$a(a+1)(a+2)$) are not evaluated explicitely. In evaluation mode
every expressions (that can be evaluated) is evaluated explicitely.
There is the switch {\tt P} that toggles between the two modes of HYP.
For example, let us evaluate the Vandermonde sum {\tt Out[4]} for $K=2$
(which must result into $\binom {M+N}2$).
\MATH
\goodbreakpoint%
In[23]:= \%4/.K-\MATHgroesser 2
\goodbreakpoint%
            %
\MATHluEck            %
\MATHruEck 
            %
\MATHvStrich  -2, -N    %
\MATHvStrich 
          F %
\MATHvStrich        ; 1 %
\MATHvStrich  (-1 + M)
         2 1%
\MATHvStrich  -1 + M    %
\MATHvStrich          2
            %
\MATHloEck            %
\MATHroEck 
Out[23]= --------------------------
                    (1)
                       2
\goodbreakpoint%
In[24]:= P
\goodbreakpoint%
In[25]:= \%23
Is N a nonnegative integer?
[y|n]:  n
\goodbreakpoint%
                          2 N     (1 - N) N
         (-1 + M) M (1 + ------ - ----------)
                         -1 + M   (-1 + M) M
Out[25]= ------------------------------------
                          2
\goodbreakpoint%
In[26]:= Factor[\%]
\goodbreakpoint%
         (-1 + M + N) (M + N)
Out[26]= --------------------
                  2
\goodbreakpoint%
In[27]:= P
\goodbreakpoint%
\endMATH
The last {\tt P} was entered to switch back to symbolic mode.

\subsection{Formal limits of hypergeometric expressions}
The function \hbox{\tt Limes} enables the user to do {\it formal\/}
limits of hypergeometric expressions fast. However, it is
left to the user to check in each particular situation 
if taking the limit in a formal way is actually allowed. As an
example we derive Bailey's \cite[Appendix, (III.7)]{SlatAC}
$_2F_1[\frac {1} {2}]$-sum from Whipple's \cite[Appendix, (III.24)]{SlatAC} 
$_3F_2$-sum.
\MATH
\goodbreakpoint%
In[28]:= Sgl33
Do you want to set values for the equation? [y|n]: n
\goodbreakpoint%
            %
\MATHluEck                    %
\MATHruEck 
            %
\MATHvStrich   a, 1 - a, c      %
\MATHvStrich 
Out[28]=  F %
\MATHvStrich                ; 1 %
\MATHvStrich  == 
         3 2%
\MATHvStrich  d, 1 + 2 c - d    %
\MATHvStrich 
            %
\MATHloEck                    %
\MATHroEck 
 
                 %
\MATHluEck                      d, 1 + 2 c - d                     %
\MATHruEck 
      1 - 2 c    %
\MATHvStrich                                                         %
\MATHvStrich 
\MATHgroesser     2        \MATHpi  \MATHGamma %
\MATHvStrich  a   d  a   1 + 2 c - d  1   a   d  1   a   1 + 2 c - d %
\MATHvStrich 
                 %
\MATHvStrich  - + -, - + -----------, - - - + -, - - - + ----------- %
\MATHvStrich 
                 %
\MATHloEck  2   2  2        2       2   2   2  2   2        2      %
\MATHroEck 
\goodbreakpoint%
In[29]:= Limes[\%,c-\MATHgroesser Infinity]
\goodbreakpoint%
            %
\MATHluEck              %
\MATHruEck       1 - d
            %
\MATHvStrich  a, 1 - a  1 %
\MATHvStrich      2      Sqrt[\MATHpi ] \MATHGamma (d)
Out[29]=  F %
\MATHvStrich          ; - %
\MATHvStrich  == ---------------------
         2 1%
\MATHvStrich     d      2 %
\MATHvStrich       1   a   d    a   d
            %
\MATHloEck              %
\MATHroEck     \MATHGamma (- - - + -) \MATHGamma (- + -)
                                 2   2   2    2   2
\goodbreakpoint%
\endMATH
Incidentally, this example shows another feature of the packages:
Every summation or transformation is not only available in form of a
rule, but also directly in form of an equation. This saves a lot of
typing in many situations.

\subsection{Transforming hypergeometric and basic hypergeometric
\hbox{\sl Mathematica} expressions into \TeX-code}
Of course, the package HYP gives full support for writing binomial
or hypergeometric expressions in \TeX-code.
Besides, the user may choose between Plain\TeX-, \LaTeX-, or
\AmSTeX-compatibility.

\section{The package HYPQ}
All the features and the organization of the package HYPQ are 
completely analogous to those of HYP.

Of course, the basic objects of HYPQ are the $q$-binomial coefficient
$\left[n \atop k\right]_q$, the upper $q$-factorial 
$(a;q)_n$, the infinite $q$-factorial $(a;q)_\infty$,
and the basic hypergeometric series
$${}_r\phi_s\!\left[\matrix {a_1,\dots,a_r\cr b_1,\dots,b_s}; q,
z\right]=\sum _{n=0} ^{\infty}\frac {\poq{a_1}{n}\cdots\poq{a_r}{n}}
{\poq{q}{n}\poq{b_1}{n}\cdots\poq{b_s}{n}}\left((-1)^nq^{\binom
n2}\right)^{s-r+1}z^n\ .$$
(Cf.\ \cite[pp.~1--6]{GaRaAA}.)
These objects are entered as follows,
\MATH
\goodbreakpoint%
In[1]:= Binomialq[n,k]*pq[a,n,q\MATHhoch 2]*Gammaq[x,1/q]*ph[%
\MATHlbrace a,b,c%
\MATHrbrace ,%
\MATHlbrace d,e%
\MATHrbrace ,q,z]
\goodbreakpoint%
        %
\MATHluEck    %
\MATHruEck             %
\MATHluEck                %
\MATHruEck 
        %
\MATHvStrich  n %
\MATHvStrich      1      %
\MATHvStrich  a, b, c       %
\MATHvStrich       2
Out[1]= %
\MATHvStrich    %
\MATHvStrich   (x;-)   \MATHphi  %
\MATHvStrich         ; q, z %
\MATHvStrich  (a; q )
        %
\MATHvStrich  k %
\MATHvStrich      q \MATHinfty  3 2%
\MATHvStrich   d, e         %
\MATHvStrich         n
        %
\MATHloEck    %
\MATHroEck             %
\MATHloEck                %
\MATHroEck 
             q
\goodbreakpoint%
\endMATH

The conversion of $q$-binomal sums into basic hypergeometric notation
is accomplished by the rules \hbox{\tt SumRegeln} and \hbox{\tt Sumph}
(see the example below).

By now, the package HYPQ includes 18 rules for the simplification of
$q$-factorial expressions, 22 summations in form of rules, 46
transformations in form of rules, and of course the same rules for
reversing, splitting, exchanging, etc., sums, and the functions \hbox{\tt
PosListe} and {\tt Ers} for the controlled application of rules. Also
the writing of $q$-binomial or basic hypergeometric expressions in
\TeX-code is fully supported, again leaving the user the choice
between Plain\TeX-, \LaTeX-, or \AmSTeX-compatibility.

Once being introduced to HYP, a single example should suffice
for a demonstration of the abilities of
HYPQ. It concerns the $q$-Vandermonde
sum (\cite[(1.5.3)]{GaRaAA}; compare with subsections~4.2--4.4).
\MATH
\goodbreakpoint%
In[2]:= Sum[q\MATHhoch ((N-l)*(R-l))*Binomialq[N,l]*Binomialq[M,R-l],%
\MATHlbrace l,0,Infinity%
\MATHrbrace ]
\goodbreakpoint%
          \MATHinfty 
        %
\MATHluEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHruEck                  %
\MATHluEck        %
\MATHruEck   %
\MATHluEck    %
\MATHruEck  
         \MATHbackslash     (N - l) (R - l) %
\MATHvStrich    M   %
\MATHvStrich   %
\MATHvStrich  N %
\MATHvStrich  
Out[2]=   \MATHgroesser   q                %
\MATHvStrich        %
\MATHvStrich   %
\MATHvStrich    %
\MATHvStrich  
         /                    %
\MATHvStrich  R - l %
\MATHvStrich   %
\MATHvStrich  l %
\MATHvStrich  
        %
\MATHloEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHroEck                  %
\MATHloEck        %
\MATHroEck   %
\MATHloEck    %
\MATHroEck  
         l=0                           q      q
\goodbreakpoint%
In[3]:= \%//.SumRegeln
\goodbreakpoint%
                \MATHinfty     l   -N        -R
              %
\MATHluEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHruEck  q  (q  ; q)  (q  ; q)
         N R   \MATHbackslash                l         l     1 + M - R
        q    (  \MATHgroesser   ------------------------) (q         ; q)
               /             1 + M - R                      R
              %
\MATHloEck %
\MATHhStrich %
\MATHhStrich %
\MATHhStrich %
\MATHroEck (q; q)  (q         ; q)
               l=0       l                l
Out[3]= -----------------------------------------------------
                               (q; q)
                                     R
\goodbreakpoint%
In[4]:= \%/.Sumph
\goodbreakpoint%
                %
\MATHluEck    -R   -N        %
\MATHruEck 
         N R    %
\MATHvStrich   q  , q          %
\MATHvStrich    1 + M - R
        q     \MATHphi  %
\MATHvStrich            ; q, q %
\MATHvStrich  (q         ; q)
             2 1%
\MATHvStrich   1 + M - R       %
\MATHvStrich                 R
                %
\MATHloEck  q                %
\MATHroEck 
Out[4]= ---------------------------------------------
                           (q; q)
                                 R
\goodbreakpoint%
In[5]:= \%/.SListe
Is R a nonnegative integer?
[y|n]:  y
Is R a nonnegative integer?
[y|n]:  y
Is N a nonnegative integer?
[y|n]:  y
\goodbreakpoint%
Be sure to apply "phOrdne" before using the following information!
\goodbreakpoint%
               N R   1 + M - R              N R   1 + M - R
          S02 q    (q         ; q)     S61 q    (q         ; q)
                                  R                            R
Out[5]= %
\MATHlbrace %
\MATHlbrace -------------------------%
\MATHrbrace , %
\MATHlbrace -------------------------%
\MATHrbrace %
\MATHrbrace 
                   (q; q)                       (q; q)
                         R                            R
\goodbreakpoint%
In[6]:= \%4/.S02
Is N a nonnegative integer?
[y|n]:  y
\goodbreakpoint%
          1 + M        1 + M - R
        (q     ; q)  (q         ; q)
                   N                R
Out[6]= -----------------------------
                    1 + M - R
          (q; q)  (q         ; q)
                R                N
\goodbreakpoint%
In[7]:= PosListe[\%]
\goodbreakpoint%
             1                1 + M                       1
Out[7]= %
\MATHlbrace %
\MATHlbrace -------, %
\MATHlbrace %
\MATHlbrace 1%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , %
\MATHlbrace (q     ; q) , %
\MATHlbrace %
\MATHlbrace 2%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , %
\MATHlbrace ----------------, %
\MATHlbrace %
\MATHlbrace 3%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , 
          (q; q)                       N             1 + M - R
                R                                  (q         ; q)
                                                                  N
 
        1 + M - R
\MATHgroesser     %
\MATHlbrace (q         ; q) , %
\MATHlbrace %
\MATHlbrace 4%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace %
\MATHrbrace 
                     R
\goodbreakpoint%
In[8]:= Ers[\%\%,erw1,%
\MATHlbrace 4%
\MATHrbrace ]
top-extend by: N
\goodbreakpoint%
            1 + M - R
          (q         ; q)
                         N + R
Out[8]= ------------------------
                  1 + M - R
        (q; q)  (q         ; q)
              R                N
\goodbreakpoint%
In[9]:= PosListe[\%]
\goodbreakpoint%
             1                     1
Out[9]= %
\MATHlbrace %
\MATHlbrace -------, %
\MATHlbrace %
\MATHlbrace 1%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , %
\MATHlbrace ----------------, %
\MATHlbrace %
\MATHlbrace 2%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace , 
          (q; q)              1 + M - R
                R           (q         ; q)
                                           N
 
        1 + M - R
\MATHgroesser     %
\MATHlbrace (q         ; q)     , %
\MATHlbrace %
\MATHlbrace 3%
\MATHrbrace %
\MATHrbrace %
\MATHrbrace %
\MATHrbrace 
                     N + R
\goodbreakpoint%
In[10]:= Ers[\%\%,zerl,%
\MATHlbrace 3%
\MATHrbrace ]
bottom-split by: N
\goodbreakpoint%
           1 + M + N - R
         (q             ; q)
                            R
Out[10]= --------------------
               (q; q)
                     R
\goodbreakpoint%
\endMATH
Clearly this is the $q$-binomial coefficient $\left[{M+N}\atop R\right]_q$,
as it should be.

\begin{thebibliography}{10}

\bibitem{AndrAC} G. E. Andrews,  
\it Applications of basic hypergeometric series,
\rm SIAM Review, \bf 16
\rm(1974), 441--484.

\bibitem{BailAA} W. N. Bailey,  
\it Generalized hypergeometric series,
\rm Cambridge University Press,
 Cambridge, 1935.

\bibitem{GaRaAA} G.    Gasper and M. Rahman,  
\it Basic hypergeometric series,
\rm Encyclopedia of Mathematics And Its Applications~35, Cambridge University
Press, Cambridge, 1990.

\bibitem{GOulAS} H. W. Gould, 
\it Combinatorial identities: A standardized set of tables listing 
500 binomial coefficient identities,
\rm (rev.\ ed.)
 Morgantown, W. Va., 1972.

\bibitem{SlatAC} L. J. Slater, 
\it Generalized hypergeometric functions,
\rm Cambridge University Press,
 Cambridge, 1966.

\bibitem{StreAD} V.    Strehl,
\it Binomial identities --- Combinatorial and algorithmic aspects,
\rm preprint, 1993.

\bibitem{WolfAA} S. Wolfram,   \it {\sl Mathematica} --- A system for 
doing mathematics by computer, \rm second edition, 
Addison--Wesley, New York, 1991.

\end{thebibliography}
\end{document}


