<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Symbulate Lab 4 - Poisson Processes
This Jupyter notebook provides a template for you to fill in.  Read the notebook from start to finish, completing the parts as indicated.  To run a cell, make sure the cell is highlighted by clicking on it, then press SHIFT + ENTER on your keyboard.  (Alternatively, you can click the "play" button in the toolbar above.)
In this lab you will use the Symbulate package.  You should have completed Section 2 of the "Getting Started Tutorial" and read Sections 1-4 and parts of Section 5 of the documentation.  A few specific links to the documentation are provided below, but it will probably make more sense if you read the documentation from start to finish.  Aside from part e) of Part I, you should Symbulate commands whenever possible.  If you find yourself writing long blocks of Python code, you are probably doing something wrong.  For example, you should not need to write any for loops.
Warning
Step1:  Overview
Suppose that (harmless) micrometeors strike the International Space Station (ISS) at rate 1.5 per hour on average.  You will consider three models of how the strikes occur over time.
Model 1
Step2:  b)
Approximate the probability that there are at least 8 strikes in the next 3 hours.
Step3:  Model 2
Suppose that over any period of time, the number of strikes which occur has a Poisson distribution, and the numbers of strikes which occur in non-overlapping time periods are independent.
a)
Use simulation to approximate the distribution of the number of strikes that occur in the next 3 hours.  Make a plot of the distribution, and approximate the mean and the standard deviation. (Hint
Step4:  b)
Approximate the probability that there are at least 8 strikes in the next 3 hours.
Step5:  Model 3
Now suppose that the time elapsed between any two strikes has an Exponential distribution with mean 40 minutes, and the times between strikes are independent. (Why is 40 minutes a reasonable value for the mean?)
a)
Use simulation to approximate the distribution of the number of strikes that occur in the next 3 hours. Make a plot of the distribution, and approximate the mean and the standard deviation.  
(Hint
Step6:  b)
Approximate the probability that there are at least 8 strikes in the next 3 hours.  
(Hint
<ASSISTANT_TASK:>
Python Code:
from symbulate import *
%matplotlib inline
Explanation: Symbulate Lab 4 - Poisson Processes
This Jupyter notebook provides a template for you to fill in.  Read the notebook from start to finish, completing the parts as indicated.  To run a cell, make sure the cell is highlighted by clicking on it, then press SHIFT + ENTER on your keyboard.  (Alternatively, you can click the "play" button in the toolbar above.)
In this lab you will use the Symbulate package.  You should have completed Section 2 of the "Getting Started Tutorial" and read Sections 1-4 and parts of Section 5 of the documentation.  A few specific links to the documentation are provided below, but it will probably make more sense if you read the documentation from start to finish.  Aside from part e) of Part I, you should Symbulate commands whenever possible.  If you find yourself writing long blocks of Python code, you are probably doing something wrong.  For example, you should not need to write any for loops.
Warning: You may notice that many of the cells in this notebook are not editable. This is intentional and for your own safety. We have made these cells read-only so that you don't accidentally modify or delete them. However, you should still be able to execute the code in these cells.
End of explanation
# Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.
Explanation: Overview
Suppose that (harmless) micrometeors strike the International Space Station (ISS) at rate 1.5 per hour on average.  You will consider three models of how the strikes occur over time.
Model 1: Strikes occur independently of each other, in each minute of time there is at most one strike, and the probability that a strike occurs in any minute is 1.5/60.  
Model 2: Over any period of time, the number of strikes which occur has a Poisson distribution, and the numbers of strikes which occur in non-overlapping time periods are independent.
Model 3: The time elapsed between any two strikes has an Exponential distribution with mean 40 minutes, and the times between strikes are independent.  
Model 1
Suppose that strikes occur independently of each other, in each minute of time there is at most one strike, and the probability that a strike occurs in any minute is 1.5/60.  (Why is 1.5/60 a reasonable value for the probability?)
a)
Use simulation to approximate the distribution of the number of strikes that occur in the next 3 hours.  Make a plot of the distribution, and approximate the mean and the standard deviation.
End of explanation
# Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.
Explanation: b)
Approximate the probability that there are at least 8 strikes in the next 3 hours.
End of explanation
# Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.
Explanation: Model 2
Suppose that over any period of time, the number of strikes which occur has a Poisson distribution, and the numbers of strikes which occur in non-overlapping time periods are independent.
a)
Use simulation to approximate the distribution of the number of strikes that occur in the next 3 hours.  Make a plot of the distribution, and approximate the mean and the standard deviation. (Hint: Based on the rate at which meteors strike the ISS, what must the mean of the Poisson distribution be?)
End of explanation
# Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.
Explanation: b)
Approximate the probability that there are at least 8 strikes in the next 3 hours.
End of explanation
# Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.
def count_strikes_in_3_hours(interarrival_times):
    for time in interarrival_times:
        # Be sure to return something inside this for loop;
        # otherwise this for loop will run forever, since it
        # is iterating over an infinite list!
        raise NotImplementedError()
Explanation: Model 3
Now suppose that the time elapsed between any two strikes has an Exponential distribution with mean 40 minutes, and the times between strikes are independent. (Why is 40 minutes a reasonable value for the mean?)
a)
Use simulation to approximate the distribution of the number of strikes that occur in the next 3 hours. Make a plot of the distribution, and approximate the mean and the standard deviation.  
(Hint: The exponential RVs represent the time between strikes, or interarrival times. Simulate infinitely many interarrival times using 
P = Exponential(...) ** inf
Then, define a Python function count_strikes_in_3_hours(...) that takes each infinite sequence of interarrivals and counts up how many strikes there were in the first 3 hours. Finally, define a random variable on the probability space P using your function.)
End of explanation
# Type all of your code for this problem in this cell.
# Feel free to add additional cells for scratch work, but they will not be graded.
Explanation: b)
Approximate the probability that there are at least 8 strikes in the next 3 hours.  
(Hint: The exponential RVs represent the time between events.  Define another RV for the time at which the 8th strike occurs, and use that RV to approximate the probability in question.)
End of explanation
<END_TASK>