# Transform Methods¶

(c) Tobias Hossfeld (Aug 2021)

This script and the figures are part of the following book. The book is to be cited whenever the script is used (copyright CC BY-SA 4.0):
Tran-Gia, P. & Hossfeld, T. (2021). Performance Modeling and Analysis of Communication Networks - A Lecture Note. Würzburg University Press. https://doi.org/10.25972/WUP-978-3-95826-153-2

Transform methods are often employed in analytical treatment of performance models. For discrete random variables, we consider the Generating Function. For continuous random variables, we consider the Laplace Transform.

## Generating Function¶

Given a discrete random variable $X$ with the distribution $x(i) = P (X = i)$, for $i=0, 1, \ldots$. The probability generating function (or, for short, generating function GF) for the random variable $X$ is defined as

$X_{GF}(z) = GF\{x(i)\} = \sum_{i=0}^\infty x(i) z^i = E[z^X]$

where $z$ is a complex(-valued) Variable.

In our example, we consider a Binomial distribution $X \sim \mathrm{BINOM}(N,p)$ which has the generating function $X_{GF}(z) = (1-p+pz)^N$ and a geometric distribution $Y \sim \mathrm{GEOM}(p)$ which has the generating function $Y_{GF}(z) = \frac{p}{1-z+pz}$.

### Inverse Transform of the Generating Function¶

As the name 'probability generating function' already suggests, the distribution $x(i)$ can be obtained from the generating function.

$x(i) = GF^{-1}\{X_{GF}(z)\} = \frac{1}{i!} \cdot \frac{d^i X_{GF}(z)}{dz^i} |_{z=0}$

The derivative is calculated using scipy.misc.derivative with parameters orderand dx which are quite sensitive and have to be carefully selected to avoid numerical issues.

Play with the parameter dx. What happens?

## Laplace Transform¶

The Laplace transform (LT) or respectively the Laplace-Stieltjes transform (LST) play a central role in analysis methods of continuous-time systems.

Let $A (t)$ be the cumulative distribution function and $a (t)$ the density function of a non-negative continuous random variable $A$. The Laplace-Stieltjes transform of $A (t)$ and the Laplace transform of $a (t)$ are defined as follows:

$\Phi_A(s) = LT\{a(t)\} = \int\limits_{0}^\infty e^{-st} a(t) \;dt = {E[e^{-sA}]} \;, \quad \mbox{Re}(s) \geq 0 \;,$

Let us consider an exponential distribution with $A \sim \mathrm{EXP}(\lambda)$ and $\Phi_A(s)=\frac{\lambda}{\lambda+s}$ and an Erlang-$k$ distribution $B$ with $\Phi_B(s)=(\frac{\lambda}{\lambda+s})^k$.

### Inverse Laplace Transform¶

We are using the Python package mpmath to compute numerically the inverse Laplace transform.