1\chapter{ZTRANS: $Z$-transform package} 2\label{ZTRANS} 3\typeout{{ZTRANS: $Z$-transform package}} 4 5{\footnotesize 6\begin{center} 7Wolfram Koepf and Lisa Temme \\ 8Konrad--Zuse--Zentrum f\"ur Informationstechnik Berlin \\ 9Takustrass 7 \\ 10D--14195 Berlin--Dahlem, Germany \\[0.05in] 11e--mail: Koepf@zib.de 12\end{center} 13} 14\ttindex{ZTRANS} 15 16The $Z$-Transform of a sequence $\{f_n\}$ is the discrete analogue 17of the Laplace Transform, and 18\[{\cal Z}\{f_n\} = F(z) = \sum^\infty_{n=0} f_nz^{-n}\;.\] \\ 19This series converges in the region outside the circle 20$|z|=|z_0|= \limsup\limits_{n \rightarrow \infty} \sqrt[n]{|f_n|}\;.$ 21In the same way that a Laplace Transform can be used to 22solve differential equations, so $Z$-Transforms can be used 23to solve difference equations. 24 25\begin{tabbing} 26 27{\bf SYNTAX:}\ \ {\tt ztrans($f_n$, n, z)}\ \ \ \ \ \ \ \ 28 \=where $f_n$ is an expression, and $n$,$z$ \\ 29 \> are identifiers.\\ 30\end{tabbing} 31\ttindex{ztrans} 32 33\begin{tabbing} 34This pack\=age can compute the \= $Z$-Transforms of the \=following 35list of $f_n$, and \\ certain combinations thereof.\\ \\ 36 37\>$1$ 38\>$e^{\alpha n}$ 39\>$\frac{1}{(n+k)}$ \\ \\ 40\>$\frac{1}{n!}$ 41\>$\frac{1}{(2n)!}$ 42\>$\frac{1}{(2n+1)!}$ \\ \\ 43\>$\frac{\sin(\beta n)}{n!}$ 44\>$\sin(\alpha n+\phi)$ 45\>$e^{\alpha n} \sin(\beta n)$ \\ \\ 46\>$\frac{\cos(\beta n)}{n!}$ 47\>$\cos(\alpha n+\phi)$ 48\>$e^{\alpha n} \cos(\beta n)$ \\ \\ 49\>$\frac{\sin(\beta (n+1))}{n+1}$ 50\>$\sinh(\alpha n+\phi)$ 51\>$\frac{\cos(\beta (n+1))}{n+1}$ \\ \\ 52\>$\cosh(\alpha n+\phi)$ 53\>${n+k \choose m}$\\ 54\end{tabbing} 55 56\begin{tabbing} 57\underline {{\bf Other Combinations}}\= \\ \\ 58 59\underline {Linearity} 60 \>${\cal Z} \{a f_n+b g_n \} = a{\cal Z} \{f_n\}+b{\cal Z}\{g_n\}$ 61 \\ \\ 62\underline {Multiplication by $n$} 63 \>${\cal Z} \{n^k \cdot f_n\} = -z \frac{d}{dz} \left({\cal Z}\{n^{k-1} \cdot f_n,n,z\} \right)$ 64 \\ \\ 65\underline {Multiplication by $\lambda^n$} 66 \>${\cal Z} \{\lambda^n \cdot f_n\}=F \left(\frac{z}{\lambda}\right)$ 67 \\ \\ 68\underline {Shift Equation} 69 \>${\cal Z} \{f_{n+k}\} = 70 z^k \left(F(z) - \sum\limits^{k-1}_{j=0} f_j z^{-j}\right)$ 71 \\ \\ 72\underline {Symbolic Sums} 73 74 \> ${\cal Z} \left\{ \sum\limits_{k=0}^{n} f_k \right\} = 75 \frac{z}{z-1} \cdot {\cal Z} \{f_n\}$ \\ \\ 76 77 \>${\cal Z} \left\{ \sum\limits_{k=p}^{n+q} f_k \right\}$ 78 \ \ \ combination of the above \\ \\ 79 where $k$,$\lambda \in$ {\bf N}$- \{0\}$; and $a$,$b$ are variables 80 or fractions; and $p$,$q \in$ {\bf Z} or \\ 81 are functions of $n$; and $\alpha$, $\beta$ and $\phi$ are angles 82 in radians. 83\end{tabbing} 84 85 86The calculation of the Laurent coefficients of a regular function 87results in the following inverse formula for the $Z$-Transform: 88 89If $F(z)$ is a regular function in the region $|z|> \rho$ then 90$\exists$ a sequence \{$f_n$\} with ${\cal Z} \{f_n\}=F(z)$ 91given by \[f_n = \frac{1}{2 \pi i}\oint F(z) z^{n-1} dz\] 92 93\begin{tabbing} 94 95{\bf SYNTAX:}\ \ {\tt invztrans($F(z)$, z, n)}\ \ \ \ \ \ \ \ 96 \=where $F(z)$ is an expression, \\ 97 \> and $z$,$n$ are identifiers. 98\end{tabbing} 99\ttindex{invztrans} 100 101\begin{tabbing} 102 This \= package can compute the Inverse \= Z-Transforms of any 103 rational function, \\ whose denominator can be factored over 104 ${\bf Q}$, in addition to the following list \\ of $F(z)$.\\ \\ 105 106\> $\sin \left(\frac{\sin (\beta)}{z} \ \right) 107 e^{\left(\frac{\cos (\beta)}{z} \ \right)}$ 108\> $\cos \left(\frac{\sin (\beta)}{z} \ \right) 109 e^{\left(\frac{\cos (\beta)}{z} \ \right)}$ \\ \\ 110\> $\sqrt{\frac{z}{A}} \sin \left( \sqrt{\frac{z}{A}} \ \right)$ 111\> $\cos \left( \sqrt{\frac{z}{A}} \ \right)$ \\ \\ 112\> $\sqrt{\frac{z}{A}} \sinh \left( \sqrt{\frac{z}{A}} \ \right)$ 113\> $\cosh \left( \sqrt{\frac{z}{A}} \ \right)$ \\ \\ 114\> $z \ \log \left(\frac{z}{\sqrt{z^2-A z+B}} \ \right)$ 115\> $z \ \log \left(\frac{\sqrt{z^2+A z+B}}{z} \ \right)$ \\ \\ 116\> $\arctan \left(\frac{\sin (\beta)}{z+\cos (\beta)} \ \right)$ 117\\ 118\end{tabbing} 119 120here $k$,$\lambda \in$ {\bf N}$ - \{0\}$ and $A$,$B$ are fractions 121or variables ($B>0$) and $\alpha$,$\beta$, \& $\phi$ are angles 122in radians. 123 124Examples: 125\begin{verbatim} 126ztrans(sum(1/factorial(k),k,0,n),n,z); 127 128 1/z 129 e *z 130-------- 131 z - 1 132 133invztrans(z/((z-a)*(z-b)),z,n); 134 135 n n 136 a - b 137--------- 138 a - b 139\end{verbatim} 140 141