Sie sind auf Seite 1von 6

IENG362

Homework Assignment #4

IENG461

Homework Assignment No. 4

Due Date:

Solve the following exercises from chapter 8 of your Textbook 3rd edition:

1) Solve Exercise 1 on page 316.


2) Solve Exercise 2 on page 316.
3) Solve Exercise 4 on page 316.
4) Solve Exercise 5 on page 317.
5) Solve Exercise 9 on page 317.
6) Solve Exercise 11 on page 317.
Exercise-1: Develop a random-variate generator for a random variable X with the pdf

f(x) ={

Solution:

Step 1: make the integration for and , therefore;

F(x)= = , -<x<0

And

F(x)= + = { - { = - +

Therefore; F(x) = {

Step 2: Set F(x) = R on -<x<,

Step 3: Solve for x=?

= R , this implies x= (ln (2R)), for all R such that 0<R

= R, this implies x = -(1/2)(ln(2-2R)), for all R such that 1/2<R< 1

Exercise-2: Develop a generation scheme for the triangular distribution with pdf:

(x-2), 2x3

f(x) = (2- x/3), 3<x6

0, otherwise.

Generate 10 values of the random variate, compute the sample mean, and compare it to the true mean
of the distribution.

Solution:

Step 1.
cdf = F (x)= 1 - x + x2 /4, 2 = x<3
x - x2 /12 - 2, 3 <x= 6

Step 2. Set F (X)=R on 2 = X = 6


Step 3. Solve for X:

X= {
( )

The true mean is(a + b + c)/3=(2+3+6)/3=11/3= 3.67.

I generated 10 random numbers by excel and Ill use them to generate values for the random Variate X:

R1=0.94737, implies X1= 5.21, R6=0.69607, implies X6= 4.09,

R2=0.87259, implies X2= 4.76, R7=0.37792, implies X7= 3.27,

R3=0.63856, implies X3= 3.92, R8=0.01488, implies X8= 2.24,

R4=0.66612, implies X4= 4.00, R9=0.66248, implies X9= 3.99,

R5=0.30712, implies X5= 3.12, R10=0.51453, implies X10= 3.59.

The sample average for the random Variate X is 3.819.

Exercise-4.

Develop a generator for a triangular distribution with range (1, 10) and a mean of 4.

Solution: a=1, c=10, and the mean= 4= (a+b+c)/3,

Therefore: b=1

Since the cdf of Triangular distribution is:

0, xa
( )
F(x) = ( )(
, a<xb
)

( )
1 ( )(
, b<xc
)

1, x>c

Step-1:

Therefore:

| 0, x1

( )
F(x)= | 1- , 1<x10
|1, 10<x

Step-2:

Set F(x)=R such that 1 10.

Step-3: Solve for x=?

X= 10 81(1-R), 0 R1

Exercise-5.

Given the following cdf for a continuous variable with range -3 to 4, develop a generator for the
variable.

0, x -3.

+ x/6, -3<x 0.

F(x) = + x2/32, 0<x 4.

1, 4<x.

Solution:

1- F(x) = R, for any x such that -3 x 4.

2- Solve for x=? This gives the followings:

6(R-1/2), 0<R

X= ( ) <R1

Exercise-9.

The cdf of a discrete random variable X is given by:

( )( )
F(x) = ( )( )
x = 1, 2, ......, n

When n = 4, generate three values of X using R1 = 0.83, R2 = 0.24, and R3 = 0.57.

Solution:

Use the inequality 8.14 in chapter 8 from the textbook

F(x-1)= ((x-1)x(2x-1))/180 < R (x(x+1)(2x+1))/180 = F(x)


n=4

Then by direct computation:

F(1)=6/180= 0.033, F(2)= 30/180= 0.167, F(3)= 84/180= 0.467, and F(4)=1.

Ceate the table look-up:

X 1 2 3 5
F(x) 0.033 0.167 0.467 1

Therefore;

Using R1=0.83, it impies X1= 4.

Using R2=0.24, it impies X2= 3.

Using R3=0.57 it implies X3=4.

Exercise-11.

Data have been collected on service times at a drive-in bank window at the Shady Lane National Bank.
This data are summarized into intervals as follows:

Interval (Seconds) Frequency


15-30 10
30-45 20
45-60 25
60-90 35
90-120 30
120-180 20
180-300 10

Set up a table for generating service times by the table-lookup method and generate five values of
service time using four-digit random numbers.

Solution:

Interval Probability Cumulative Slope (ai)


x(i-1)<xxi 1/n Probability (i/n) ai=(xi-x(i-1)/(1/n)
1 15<x30 1/7= 0.1429 0.1429 105
2 30<x45 0.1429 0.2857 105
3 45<x60 0.1429 0.4206 105
4 60<x90 0.1429 0.5714 210
5 90<x120 0.1429 0.7143 210
6 120<x180 0.1429 0.8571 420
7 180<x300 0.1429 1.00 840

X = x(i-1)+ ai(R- (i-1)/n), for any R such that (i-1)/n < R i/n, n = 7, and i= 1,2,..,7.