Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Homework 5

MAS 442 Spring 2022

Problem  1:  (Ehrenfest model) Gas molecules move about randomly in a box which is divided into two halves symmetrically by a partition.   A hole is made in the partition. Suppose there are 20 molecules in the box. Think of the partitions as two urns (urn 0 and 1) containing balls labeled 1 through 20.  Molecular motion can be modeled by choosing a number between 1 and 20 at random and moving the corresponding ball from the urn it is presently into the other.  This is a historically important physical model introduced by Ehrenfest in the early days of statistical mechanics to study thermodynamic equilibrium. The Ehrenfest model has also been applied to study the dynamics of social network formations. Let Xn   denote the number of molecules at the left partition of the box  (urn 0) after n transitions.

 

In HW4, you modeled {Xn  : n ≥ 0} as a DTMC with S = {0, 1, 2, . . . , 20} and

 

|

|    l  0

|    '(')  

    '(')  0

P =       '

   '(')   

'    |á   '  0

'

|

1

0

 

|

 

0

0

0

|á

|

0

 

0

0

       ... 0    . . . 0    . . .

|     . . .

     . . .

0    . . . 0    . . .

|冷 0 0 0

 

|á |

0

|á

0

0

0

 

0

1

|

0  _

0   ' '

0   '(')

'.

    '(')

|     '

0(扌|) '


You also calculated the steady state distribution:

 

 

Simulate the first 10000 transitions of the chain.  The initial state of the system X|  is unknown.  Assume that X|  could be any one of the values 0, 1, 2, ..., 20 with equal proba- bilities.  Copy your MATLAB code.  Use the default random generator in your simulation (rng(’default’);). Attach the histogram of the simulated path. Attach the histogram of the frequency distribution. It should match with the theoretical steady-state distribution shown above.  (40 Points)

 


Problem 2: Consider the following simple model for the random evolution of a stock price for a certain stock  (lets call it stock A). Each day, the stock price increases by 』1 with probability r = 0.17, moves down 』1 with probability p = 0.15, or remains the same with probability q = 1 − p − r. Today (day zero), the stock price is 』13.  Stock price of 』0 is an absorbing state; once the stock price hits zero, it remains there forever (out of business etc.). Consider the following trading strategy: we hold on to the stock until its price becomes 』35, at which point we sell.

In HW4 you modeled the random evolution of the stock price {Xn  : n ≥ 0} as a DTMC with State Space

S = {0, 1, 2, ..., 35},

initial probability distribution

 


α = Pr(X|  = i) =  1

『 0

and (one-step) transition probability matrix

 

|     |     扌     扌      ...

|    l 1   0   0   0   . . . |    '(') p   q   r   0   . . .     '(') 0   p   q   r   . . .

P =       '

   '(')                  . . .

'

扌」   ' 0   0   0   0   . . .

扌扌   ' 0   0   0   0   . . .


if i = 13

otherwise,

 

 

扌扌

0

0

0

 

p

0

扌」 0 0 0

 

q

0

扌扌

0  _

0  ' '

0  '(')

'.

   '(')

'

1  '

 

 

 

Let T be the time until first transition into one of the absorbing states, i.e., T = min{n ≥ 0, Xn  = {0, 35}}. Let mi  be the average time to enter one of the absorbing states, if we start in state i, i.e., mi  = E[T |X|  = i]. Write a system of equations whose solution provides the expected time it will take to hit either one of the two absorbing states. You can only write the first three and the last three equations and leave .. between them.  Solve the system in. MATLAB. Copy your MATLAB code, and attach the figure describing the average hitting


time from each state to the absorbing states.  (20 Points)

 


Problem 3: A small post office has two servers who can process customers’ requests. Due to COVID restrictions, the office only allows one customer in the waiting room inside the building when both servers are busy.  Thus, the building capacity is 3 customers at any time  (2 in service,  one in waiting room).   Customers arrive to the post-office according to an exponential distribution with rate λ (i.e., the time between two customer arrivals is exponentially distributed with mean ).  A customer who arrives to a full office is asked to go to another branch (no waiting outside). The servers’ processing time is exponentially distributed with rate µ. Let X (t) be the number of customers in the office at time t.

(a) Define the state space S, draw the transition diagram, and describe the transition rates out of each state vi s, and transition rates between states qi,j s.  (15 Points)

(b) Write down the balance equations and calculate the steady-state distribution of the

system in terms of λ and µ .  (20 Points)

 

(c)  Suppose customers arrive with an average arrival rate of 4 customers per hour, and the average service times of the servers is 20 minutes. What is the long-run fraction of times that a customer who arrives to the post office is asked to go to a different branch due to full capacity?  (5 Points)