\documentstyle[11pt,reduce]{article}
\title{{\bf RESIDUE Package for {\tt REDUCE}}}
\author{Wolfram Koepf\\ email: {\tt Koepf@zib.de}}
\date{April 1995 : ZIB Berlin}
\begin{document}
\maketitle
\def\Res{\mathop{\rm Res}\limits}
\newcommand{\C}{{\rm {\mbox{C{\llap{{\vrule height1.52ex}\kern.4em}}}}}}

This package supports the calculation of residues. The residue
$\Res_{z=a} f(z)$ of a function $f(z)$ at the point $a\in\C$ is defined
as
\[
\Res_{z=a} f(z)=
\frac{1}{2 \pi i}\oint f(z)\,dz
\;,
\]
with integration along a closed curve around $z=a$ with winding number 1.

If $f(z)$ is given by a Laurent series development at $z=a$
\[
f(z)=\sum_{k=-\infty}^\infty a_k\,(z-a)^k
\;,
\]
then
\begin{equation}
\Res\limits_{z=a} f(z)=a_{-1}
\;.
\label{eq:Laurent}
\end{equation}
If $a=\infty$, one defines on the other hand
\begin{equation}
\Res\limits_{z=\infty} f(z)=-a_{-1}
\label{eq:Laurent2}
\end{equation}
for given Laurent representation
\[
f(z)=\sum_{k=-\infty}^\infty a_k\,\frac{1}{z^k}
\;.
\]

The package is loaded by the statement

\begin{verbatim}
1: load residue;
\end{verbatim}

It contains two REDUCE operators:

\begin{itemize}
\item
{\tt residue(f,z,a)} determines the residue of $f$ at the point $z=a$
if $f$ is meromorphic at $z=a$. The calculation of residues at essential
singularities of $f$ is not supported.
\item
{\tt poleorder(f,z,a)} determines the pole order of $f$ at the point $z=a$
if $f$ is meromorphic at $z=a$.
\end{itemize}
Note that both functions use the {\tt taylor} package in
connection with representations (\ref{eq:Laurent})--(\ref{eq:Laurent2}).

Here are some examples:

\begin{verbatim}
2: residue(x/(x^2-2),x,sqrt(2));

 1
---
 2

3: poleorder(x/(x^2-2),x,sqrt(2));

1

4: residue(sin(x)/(x^2-2),x,sqrt(2));

 sqrt(2)*sin(sqrt(2))
----------------------
          4

5: poleorder(sin(x)/(x^2-2),x,sqrt(2));

1

6: residue(1/(x-1)^m/(x-2)^2,x,2);

 - m

7: poleorder(1/(x-1)/(x-2)^2,x,2);

2

8: residue(sin(x)/x^2,x,0);

1

9: poleorder(sin(x)/x^2,x,0);

1

10: residue((1+x^2)/(1-x^2),x,1);

-1

11: poleorder((1+x^2)/(1-x^2),x,1);

1

12: residue((1+x^2)/(1-x^2),x,-1);

1

13: poleorder((1+x^2)/(1-x^2),x,-1);

1

14: residue(tan(x),x,pi/2);

-1

15: poleorder(tan(x),x,pi/2);

1

16: residue((x^n-y^n)/(x-y),x,y);

0

17: poleorder((x^n-y^n)/(x-y),x,y);

0

18: residue((x^n-y^n)/(x-y)^2,x,y);

  n
 y *n
------
  y

19: poleorder((x^n-y^n)/(x-y)^2,x,y);

1

20: residue(tan(x)/sec(x-pi/2)+1/cos(x),x,pi/2);

-2

21: poleorder(tan(x)/sec(x-pi/2)+1/cos(x),x,pi/2);

1

22: for k:=1:2 sum residue((a+b*x+c*x^2)/(d+e*x+f*x^2),x,
    part(part(solve(d+e*x+f*x^2,x),k),2));

 b*f - c*e
-----------
     2
    f

23: residue(x^3/sin(1/x)^2,x,infinity);

  - 1
------
  15

24: residue(x^3*sin(1/x)^2,x,infinity);

-1
\end{verbatim}
\iffalse
7: for k:=1:3 sum 
7: residue((a+b*x+c*x^2+d*x^3)/(e+f*x+g*x^2+h*x^3),x,
7: part(part(solve(e+f*x+g*x^2+h*x^3,x),k),2));


***** CATASTROPHIC ERROR ***** 
("gcdf failed" (root_of (plus e (times f x_) (times g (expt x_ 2)) (times h (
expt x_ 3))) x_ tag_2) (times (root_of (plus e (times f x_) (times g (expt 
x_ 2)) (times h (expt x_ 3))) x_ tag_2) h))

  

***** Please send output and input listing to A. C. Hearn 
\fi
Note that the residues of factorial and $\Gamma$ function terms are
not yet supported.

\end{document}

