# CS457 - System Performance Evaluation - Winter 2008

### Questions and Comments

- Tutorial: MC4045, Monday March 10, 18.00 to 19.00
- Ass3. Exponential distribution with mean interarrival time 1/k means
distributed by kexp(-kt)
Similar for mean service time.

# Lecture 23 - Useful Distributions for Random Numbers

Text: chapter 28 & 29

## Random Variables

#### 5. Binomial Distribution

Get exactly x correct in n tries.

- f(x) = C(n,x) p^x * (1-p)^(n-x)

There is no way of doing the sum as we did for the geometric
distribution,

- but, this is the way that the sum of n Bernoulli trials is
distributed

So, generate n Bernoulli variables and sum them.

- Not so good if n is large.
- If n is large, then there are two possibilities
- x is small.
- Take the limit n-> infinity, np = \lambda
- C(n,x) = n!/x!(n-x)! -> n^x
- log(f(x)) -> xlog(n) + xlog(p) + nlog(1-p) = xlog(\lambda) +
nlog(1-p)
- f(x) -> \lambda^x (1-p)^n -> \lambda^x
- This is a geometric distribution

- x is the order of n
- f(x) -> exp(-(x-\mu)^2 / 2\sigma)
- See continuous distributions, below.

#### 6. Zipf Distribution

Order a set of N numbers.

The probability that the k'th number occurs is k^-s.

In the limit N-> infinity this is the Rieman zeta-function

## Continuous Random Variables

#### 1. Arbitrary distribution

Use the inverse transformation method.

The easiest way is to interpolate linearly in a table to solve F(x) = u

#### 2. Exponential distribution

Use for infinite populations that produce finite event rates.

- f(x) = \lambda exp(-\lambda*x)
- F(x) = 1 - exp(-\lambda*x)
- u = F(x)
exp(-\lambda*x) = 1 - u

x = -log(1-u) / \lambda = -log(u) / \lambda

But, remember that there is a special case! (u = 0)

#### 3. Continuous uniform

Use when you don't know anything, except possibly theoretically.

Interpolation on the importance of prior distributions

- f(x) = 1/(b-a) for a<x<b
- F(x) = (x-a) / (b-a)
- x = a + u*(b-a)

#### 4. Pareto distribution

Use for heavy-tailed data (also called self-similar)

- f(x) = ax^-(a+1)
- F(x) = 1 - x^-a
- x = (1-u)^-(1/a)

#### 5. Normal distribution

Use when you want to add noise

- f(x) = exp(-(x^2)/2*\sigma^2)
- No easy form for F(x).
- But, f(x,y) = exp(-(x^2 + y^2) / 2*\sigma) has a simple F(x,y), which I
won't work out.
- Thus, you choose two uniform variates, u1 & u2.
- And you get back two independent random numbers
- x1 = \sigma*cos(2\pi*u1)* sqrt(-2log(u2))
- x2 =

Return to: