Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python Q3. Suppose that an event repeatedly occurs over time at a constant rate but at random (Poisson process). For example, let's observe the arrival
python
Q3. Suppose that an event repeatedly occurs over time at a constant rate but at random (Poisson process). For example, let's observe the arrival of buses at a bus stop. On average we see a bus every 10 minutes. However, the time interval between the arrivals of two buses is exactly 10 minutes. We may see the buses, for example, at O min, 13.1 min, 19.7 min, 33.3 min, 40.2 min, ... We divide a time period of concern into n pieces. In each piece of time interval, the probability for occurrence of an event is pe [0, 1]. Then, the probability that this event occurs k times in the whole time period is n! Prk, n,p) ( k! (n k); pt (1 p)rk. This is called binomial distribution. Do the following operations by Sympy. 1. Define the symbols n and k standing for two nonnegative integers. Define the symbol p standing for a nonnegative real number 2. Define the expression for Prk, n, p) and print out this expression by pprint() 3. Substitute n = 20 and p=0.5 into the expression of Prk, n, p). Then, the new expression is only a function of k, i.e., Prak) 4. Convert the SymPy expression Pr(k) to a python function called binomial_prob_k_func() by sympy. lambdify . Note that the expression Pr(k) may contain the operation sympy. factorial () which is not supported by NumPy but is supported by Scipy. So, we cannot use sympy.lambdify( ..., "numpy); instead, we must use sympy.lambdify ... , "scipy) 5. Try three sets of parameters: n = 20 and p = 0.4, n = 20 and p = 0.7, n = 40 and p=0.5. Similar to Question 3, for each set of parameters, substitute n and p to the expression of Prk, n, p). Then, similar to Question 4, for each set of parameters, define the python function binomial_prob_k_func(). Finally, for each set of parameters, plot this python function, i.e., Pr(k). Q3. Suppose that an event repeatedly occurs over time at a constant rate but at random (Poisson process). For example, let's observe the arrival of buses at a bus stop. On average we see a bus every 10 minutes. However, the time interval between the arrivals of two buses is exactly 10 minutes. We may see the buses, for example, at O min, 13.1 min, 19.7 min, 33.3 min, 40.2 min, ... We divide a time period of concern into n pieces. In each piece of time interval, the probability for occurrence of an event is pe [0, 1]. Then, the probability that this event occurs k times in the whole time period is n! Prk, n,p) ( k! (n k); pt (1 p)rk. This is called binomial distribution. Do the following operations by Sympy. 1. Define the symbols n and k standing for two nonnegative integers. Define the symbol p standing for a nonnegative real number 2. Define the expression for Prk, n, p) and print out this expression by pprint() 3. Substitute n = 20 and p=0.5 into the expression of Prk, n, p). Then, the new expression is only a function of k, i.e., Prak) 4. Convert the SymPy expression Pr(k) to a python function called binomial_prob_k_func() by sympy. lambdify . Note that the expression Pr(k) may contain the operation sympy. factorial () which is not supported by NumPy but is supported by Scipy. So, we cannot use sympy.lambdify( ..., "numpy); instead, we must use sympy.lambdify ... , "scipy) 5. Try three sets of parameters: n = 20 and p = 0.4, n = 20 and p = 0.7, n = 40 and p=0.5. Similar to Question 3, for each set of parameters, substitute n and p to the expression of Prk, n, p). Then, similar to Question 4, for each set of parameters, define the python function binomial_prob_k_func(). Finally, for each set of parameters, plot this python function, i.e., Pr(k)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started