Question: . (30 points) (With Python) In this Python exercise, you will be estimating the probability each port is attacked after 100 weeks. Be sure to

. (30 points) (With Python) In this Python exercise, you will be estimating the probability each port is attacked after 100 weeks. Be sure to annotate your code with short explanations of what you are doing (worth 10 points). Suppose (as above) that each week the port most often attacked is recorded. The transition matrix for weekly attacks is P with initial distribution (as above). (a) Simulate 100 weeks of attacks, and repeat the simulation 5,000 times. Compute the probability that each port is attacked after 100 weeks. Use the print function to print your answers. Be sure to label your results. For example, print(The probability that Port %s is attacked after 100 weeks is %f. % (nameOfPort, probOfPort)) (b) Create a bar graph to show the probability of attacks at each port after 100 weeks. Be sure to title your graph and label the axes. Save your graph and include it in your pdf file. (c) Take a screenshot showing your code and your results together (e.g. side by side).
2. (30 points) (With Python) In this Python exercise, you will be estimating the probability each port is attacked after 100 weeks. Be sure to annotate your code with short explanations of what you are doing (worth 10 points). Suppose (as above) that each week the port most often attacked is recorded. The transition matrix for weekly attacks is P with initial distribution v (as above). (a) Simulate 100 weeks of attacks, and repeat the simulation 5,000 times. Compute the probability that each port is attacked after 100 weeks. Use the print function to print your answers. Be sure to label your results. For example, print ("The probability that Port %s is attacked after 100 weeks is ., % (nameOfPort, prob0fPort)) (b) Create a bar graph to show the probability of attacks at each port after 100 weeks. Be sure to title your graph and label the axes. Save your graph and include it in your pdf file (c) Take a screenshot showing your code and your results together (e.g. side by side). 2. (30 points) (With Python) In this Python exercise, you will be estimating the probability each port is attacked after 100 weeks. Be sure to annotate your code with short explanations of what you are doing (worth 10 points). Suppose (as above) that each week the port most often attacked is recorded. The transition matrix for weekly attacks is P with initial distribution v (as above). (a) Simulate 100 weeks of attacks, and repeat the simulation 5,000 times. Compute the probability that each port is attacked after 100 weeks. Use the print function to print your answers. Be sure to label your results. For example, print ("The probability that Port %s is attacked after 100 weeks is ., % (nameOfPort, prob0fPort)) (b) Create a bar graph to show the probability of attacks at each port after 100 weeks. Be sure to title your graph and label the axes. Save your graph and include it in your pdf file (c) Take a screenshot showing your code and your results together (e.g. side by side)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
