Professional Documents
Culture Documents
Practice Midterm 1
Problem
4:
Provide
the
inverse
transform
algorithm
for
generating
a
binomial
(n,p)
random
variable.
Recall
that
!! = = !! !!! ! ! 1 !!! = 0, 1, ,
and
make
use
of
the
recursive
identity
1 = + 1 = = .
+ 1 1
Problem
5:
Use
the
inverse
transform
method
to
generate
a
random
variable
having
distribution
function
=
! ! !! !
, 0 1.
Problem
6:
We
are
interested
in
simulating
a
single-server
queuing
system
to
determine
such
quantities
as
the
average
time
a
customer
spends
in
the
system
and
the
average
time
past
T
that
the
last
customer
departs.
We
use
the
following
variables:
Time
Variable
t
Counter
Variables
NA:
the
number
of
arrivals
(by
time
t)
ND:
the
number
of
departures
(by
time
t)
System
State
Variable
n:
the
number
of
customers
in
the
system
(at
time
t)
The
simulation
will
begin
by
the
initialization
of
the
variables
and
the
event
times
tA
and
tB.
Initialize
Set
t=NA=ND=0.
Set
SS=0.
Generate
T0,
and
set
tA=T0,
tD=.
Fill
in
the
missing
lines
for
cases
1-4!
Case
1:
tAtD,
tAT
Reset:
t=______
Reset:
NA=____
Reset:
n=_____
Generate
Tt,
and
reset
tA=_______
If
n=1,
generate
Y
and
reset
tD=_______
Collect
output
at
A(NA)=_____
Case
2:
______
,
tDT
Reset:
t=_____
Reset:
n=_____
Reset:
ND=_____
If
n=0,
reset
tD=______
;
otherwise,
generate
Y
and
reset
tD=_____
Collect
output
data
D(ND)=_____
Case 3: min(tD,tA)>T, n___ Reset: t=tD Reset: n=______ Reset: ND=______ If n>0, generate Y and reset tD=______ Collect output data D(ND)=_____ Case 4: min(tD,tA)>T, n______ Collect output data Tp=max(t-T,0).