# Exercises: Modeling Input Processes

### From Sigma

## Contents |

## Chaos

A simple example of a “chaotic system” is the recursive equation: X = R*X*(1-X).

If you start off with a particular value of X, if R is set high enough, it becomes impossible to predict the value of X very far into the future. Starting the system with X = 0.2, try values of R = 0.5, 1, 2, and 4. Does the system behave differently for different values of R? Does "chaos" describe the behavior? (Do you think chaotic systems might make good pseudo-random number generators!)

## Generating Discrete Random Variates

- 1. Consider the probability distribution function: P(X=i)=i/6 where i =1,2,3
- i. Create an event graph using RND to generate 25 random variates from this distribution.
- ii. Create an event graph using DISK{} and a data file to generate 25 random variates of this distribution.

- 2. What is the probability distribution function of X?

U =RND and X=(U>0.2) + (U>0.5)

## Generating Continuous Random Variates

- 1. Let A and B be two random variables uniformly distributed between 0 and 1. Let X be the larger of A and B. Create an event graph which generates 20 values of X (try to be clever).

- 2. Consider the following probability distribution function: f(x) = x/8 0<=x<=4. Create an event graph using RND to generate 25 random variates of this distribution.

- 3. What is the delay time corresponding to an exponential rate with parameter 5?

- 4. What does the probability distribution function of X look like if X is given by the following?

U=RND and X=(2*RND)*(U <0.5) + (4+RND)*(U>=0.5)

- 5. If U is a random variable with a uniform distribution between zero and one, what is the distribution of V=1/2-U/2?

- 6. What will the following state changes do in SIGMA to the value of X? That is, give the value(s) of X and tell how the(se) values might occur. [Assume that all variables are REAL valued (i.e., floating point)].

R=RND X=(RND<0.2) + (RND<0.5)*2 + (RND<0.7)*4

- 7. What does the following SIGMA state change do?

X=(RND>0.5)*1 + (RND<=0.5)*2

## Generation of Minimum Statistics

There are 100 identical components operating independently in a system. Each component has a lifetime, X, that has an exponential distribution with a mean of 6 days. Generate the time until the first component fails from a single uniform random number, RND? (Hint: The minimum of N uniform random variables is given in Methods of Generating Random Variates, and X=-M*LN{RND} is an exponential random variable with mean, M.)

## Testing Variate Generators

SIGMA has build-in generators for uniform (RND), gamma (GAM), and normal (NOR) random variates. Using the methods in texts referenced in this website (Bratley, Fox, and Schrage and Law and Kelton), perform at least three tests of these functions (at least two of the tests should be quantitative). Program and test generators for lambda variates.

## A Variance Reduction Technique

Two runs are made of a simulated queue. The random number stream that was used to generate interarrival times in the first run is used to generate the service times for the second run. The random number stream that was used to generate service times in the first run is used to generate the interarrival times for the second run. Will the average customer waiting times from these two runs tend to have zero, positive, or negative correlation? Explain why.

## Dependent Processes

Run CARWASH.MOD where the interarrival times and service times are exponentially distributed with the same means as before but now follow EAR models with lag-one correlation of p = 0.7. Compare this system with CARWASH.MOD having deterministic service and CARWASH.MOD having independently distributed exponential service.

## A Simple Recursion for Queue Times

Generate 90% confidence intervals for the average waiting time, E[W], in an M/M/1 queue with traffic intensity of 0.9. Use the recursion, W=MAX{W+S-A;0} starting with W=0, where S is the service time of the ith customer (exponential with mean =1) and A is the ith customer interarrival time (exponential with mean 1/0.9).

## Dependent Input Data

You are building a model for a chain of automatic carwashes. These carwashes have deterministic service rates. A sample of car arrivals indicates that the times between car arrivals has an exponential distribution. Unfortunately, the people collecting the demand data simply tabulated a histogram of the interarrival times rather than recording the actual sequence of arrival times.

- What problem(s) do you anticipate this might cause in getting a valid model for the customer arrival process? Specifically, what information are you missing that you wish you had? Why?
- What if you are also told that the lag-1 serial correlation between successive interarrival times is 0.7? Given that an arrival event just occurred and the simulated time is CLK, how can you generate the time of the next car arrival (call this time T) using all of the information you have?
- Why might your approach not be acceptable to the people who own this chain of carwashes?

## Generating Points in a Plane

Generate a sample of N independent points uniformly scattered over the area in the two-dimensional region in the plane bounded by the horizontal axis and an arbitrary function.