Question

In: Computer Science

Use Python to plot poisson process for time interval [0,50] that generate 50 random numbers.

Use Python to plot poisson process for time interval [0,50] that generate 50 random numbers.

Solutions

Expert Solution

CODE :

One can obtain different graphs by simply changing the lamda variable in the above code. To display the coordinates on the graph, please remove the commenting hastags in line 16 and 17 (the graph may look messed up).

Code you can directly copy and paste :

import matplotlib.pyplot as plt

import math

import numpy as np

x = np.arange(1,51,1) # time interval in format of start+1 to end+1 to get the range as [start,end]

p = [] # list to contain the poisson process calculated value

lamda = 10 # lamda is the mean of events per interval

for y in x:

f = pow(lamda,y)*math.exp(-1*lamda)/math.factorial(y) # formula of poisson's distribution

p.append(f)

plt.plot(x,p,marker='o', markerfacecolor='red', markersize=5)

#for i_x, i_y in zip(x, p): # marking co-ordinates on the graph

# plt.text(i_x, i_y, '({}, {})'.format(i_x, round(i_y,3)))

plt.xlabel('time') # naming the x axis

plt.ylabel('number') # naming the y axis

plot_title = 'Poisson Process Graph for lambda = ' + str(lamda) # giving a title to the graph

plt.title(plot_title)

plt.xlim(0,51)

plt.show()

NOTE : Indent this code by referring to the above code snapshot.

OUTPUT GRAPH:


Related Solutions

Using Python, generate 100 random numbers ranging from 1 to 5, then plot them using matplotlib...
Using Python, generate 100 random numbers ranging from 1 to 5, then plot them using matplotlib or Seaborn as a histogram
Generate 200 random numbers using each of the following continuous distributions and plot the histograms (a)...
Generate 200 random numbers using each of the following continuous distributions and plot the histograms (a) Uniform (use A = 3 and B = 7) (b) Exponential (use population mean = 0.2) (c) Gamma (use parameters 3 and 2) (d) Normal (use µ = 2 and σ = 5) Attach the histogram plots and reflect on what you observe. Hint: Use RAND() to generate uniform random numbers and use inverse CDF to generate random numbers for each distribution.
Write an Arduino code that does the following. Generate 50 random numbers between the numbers 100...
Write an Arduino code that does the following. Generate 50 random numbers between the numbers 100 and 300. Pick a number at random out of these 50 random variables. a. Determine the probability of the chosen number being greater than 200. This may be achieved by counting the numbers that are greater than 200 and dividing the count by 50. Make sure you, i.Formulate the appropriate if-conditions to check for a number being greater than 200 ii. Use a for-loop...
Assume that Z  (6). Generate 1000 random numbers from Z and plot the corresponding histogram.
Assume that Z  (6). Generate 1000 random numbers from Z and plot the corresponding histogram.
Generate a sample of 1000 random floating numbers (from 0 to 1) using numpy. Then plot...
Generate a sample of 1000 random floating numbers (from 0 to 1) using numpy. Then plot it and compare with a normal distribution plot close to that region (from 0 to 1) as well. Hint: Using Seaborn module
Write the R code to generate five independent uniform random numbers and use that to generate...
Write the R code to generate five independent uniform random numbers and use that to generate 5 independent Bernoulli random variables with probability of success p = 0.4. please use RStudio. please do not use lab nor rbern for calculations.
The number of database queries made during any interval of time is a Poisson random variable....
The number of database queries made during any interval of time is a Poisson random variable. On average, six queries are made every minute. Determine the probability that three or more queries will be made during an interval of 15 seconds.
Python Practice Sample: Generate lists containing the numbers between 1 and 50 as follows:  same...
Python Practice Sample: Generate lists containing the numbers between 1 and 50 as follows:  same is a list of all the two-digit numbers whose digits are the same (11, 22, etc.)  addsto6 is a list of all numbers the sum of whose digits is 6  rest contains the rest of the numbers. A number can appear only in one of the lists; with same having higher priority. (So for example, 33 would appear in the same, but...
Given a dataset of random numbers, use Python to calculate: (a) Estimates for the sample mean...
Given a dataset of random numbers, use Python to calculate: (a) Estimates for the sample mean and sample variance without using inbuilt functions. (b) Suppose now that the standard deviation is known to be 0.25. Compute a 90% confidence interval for the population mean. (python libraries can be used to calculate the confidence interval) Data: 8.91E+00 1.53E+01 5.98E+00 6.39E+00 1.54E+00 1.05E+01 1.87E+00 2.14E+00 6.50E+00 3.20E+00 3.10E+00 5.16E+00 6.04E-01 1.75E+00 1.27E+00 3.15E+00 5.09E+00 5.19E-01 5.23E+00 4.17E+00 2.34E+01 4.94E+00 8.85E+00 1.66E-01 6.38E+00...
Generate 1000 random numbers from ??3? starting with standard normal random numbers in R.
Generate 1000 random numbers from ??3? starting with standard normal random numbers in R.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT