2.6 Exercises
Exercise 2.1 Consider the following discrete distribution of the random variable \(X\) whose probability mass function is \(p(x)\).
\(x\) | 0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|---|
\(p(x)\) | 0.3 | 0.2 | 0.2 | 0.1 | 0.2 |
Write a KSL program to generate 4 random variates from this distribution using stream 1.
Exercise 2.2 Suppose that customers arrive at an ATM via a Poisson process with mean 7 per hour. Write a KSL program that outputs the arrival time of the first 6 customers using stream 1.
Exercise 2.3 The service times for a automated storage and retrieval system has a shifted exponential distribution. It is known that it takes a minimum of 15 seconds for any retrieval. The rate parameter of the exponential distribution is \(\lambda = 45\). Write a KSL program to generate 10 observations from this distribution using stream 1.
Exercise 2.4 The time to failure for a computer printer fan has a Weibull distribution with shape parameter \(\alpha = 2\) and scale parameter \(\beta = 3\). Testing has indicated that the distribution is limited to the range from 1.5 to 4.5. Write a KSL program to generate 10 observations from this distribution using stream 1.
Exercise 2.5 The interest rate for a capital project is unknown. An accountant has estimated that the minimum interest rate will between 2% and 5% within the next year. The accountant believes that any interest rate in this range is equally likely. You are tasked with generating interest rates for a cash flow analysis of the project. Write a KSL program to generate 10 observations from this distribution using stream 1.
Exercise 2.6 Consider the following probability density function:
\[f(x) = \begin{cases} \dfrac{3x^2}{2} & -1 \leq x \leq 1\\ 0 & \text{otherwise} \\ \end{cases}\]
Write a KSL program to generate 10 observations from this distribution using stream 1 using the inverse transform technique.
Exercise 2.7 Consider the following probability density function:
\[f(x) = \begin{cases} 0.5x - 1 & 2 \leq x \leq 4\\ 0 & \text{otherwise} \\ \end{cases}\]
Write a KSL program to generate 10 observations from this distribution using stream 1 using the inverse transform technique.
Exercise 2.8 Consider the following probability density function:
\[f(x) = \begin{cases} \dfrac{2x}{25} & 0 \leq x \leq 5\\ 0 & \text{otherwise} \\ \end{cases}\]
Write a KSL program to generate 10 observations from this distribution using stream 1 using the inverse transform technique.
Exercise 2.9 Consider the following probability density function:
\[f(x) = \begin{cases} \dfrac{2}{x^3} & x > 1\\ 0 & x \leq 1\\ \end{cases}\]
Write a KSL program to generate 10 observations from this distribution using stream 1 using the inverse transform technique.
Exercise 2.10 The times to failure for an automated production process have been found to be randomly distributed according to a Rayleigh distribution:
\[\ f(x) = \begin{cases} 2 \beta^{-2} x e^{(-(x/\beta)^2)} & x > 0\\ 0 & \text{otherwise} \end{cases}\]
Write a KSL program to generate 10 observations from this distribution using stream 1 using the inverse transform technique.
Exercise 2.11 Suppose that the processing time for a job consists of two distributions. There is a 30% chance that the processing time is lognormally distributed with a mean of 20 minutes and a standard deviation of 2 minutes, and a 70% chance that the time is uniformly distributed between 10 and 20 minutes.
Write a KSL program to generate 10 observations from this distribution using stream 1.
Exercise 2.12 Suppose that the service time for a patient consists of two distributions. There is a 25% chance that the service time is uniformly distributed with minimum of 20 minutes and a maximum of 25 minutes, and a 75% chance that the time is distributed according to a Weibull distribution with shape of 2 and a scale of 4.5.
Write a KSL program to generate 10 observations from this distribution using stream 1.
Exercise 2.13 Consider the following probability density function:
\[f(x) = \begin{cases} \dfrac{3x^2}{2} & -1 \leq x \leq 1\\ 0 & \text{otherwise} \\ \end{cases}\]
Write a KSL program to generate 10 observations from this distribution using the acceptance-rejection technique. Use stream 1 in your implementation.
Exercise 2.14 Consider the following function:
\[f(x) = \begin{cases} cx^{2} & a \leq x \leq b\\ 0 & \text{otherwise} \\ \end{cases} \]
- Determine the value of \(c\) that will turn \(g(x)\) into a probability density function. The resulting probability density function is called a parabolic distribution.
- Denote the probability density function found in part (a), \(f(x)\). Let \(X\) be a random variable from \(f(x)\). Derive the inverse cumulative distribution function for \(f(x)\).
- Write a KSL program to generate 10 observations from this distribution over the range of \(a=4\) and \(b=12\) using your work from part (a) and (b). Use stream 1 in your implementation.
Exercise 2.15 Consider the following probability density function:
\[f(x) = \begin{cases} \frac{3(c - x)^{2}}{c^{3}} & 0 \leq x \leq c\\ 0 & \text{otherwise} \\ \end{cases} \]
Derive an inverse cumulative distribution algorithm for generating from \(f(x)\). Write a KSL program to generate 10 observations from this distribution for \(c=5\). Use stream 1 in your implementation.