1. Engineering
  2. Computer Science
  3. 2 python programming challenge create a numerical simulation that call...

Question: 2 python programming challenge create a numerical simulation that call...

Question details

2) python programming challenge

Create a numerical simulation that call this method in a loop 10,000 times. Using a loop, compute the empirical distribution for the number of ones contained in integersequence(5,10).

Programming Challenge 1 This Python challenge will use the numpy.random module to generate pseudo random numbers. Remember to import this module whenever needed In [ 1:import numpy as np import pandas as pd import matplotlib.pyplot as plt Write a method to simulate the selection of an element from a collection of consecutive integers. It should return random integers from zero to num outcomes (exclusive) In []: def integersequence (num_outcomes-2,vec_length-1): # Return random integers from 0 to high (exclusive) outcome[1 for index in range (vec_length): outcome . append ( 1 ) # EDIT return outcome integersequence (2,10) Create a numerical simulation that call this method in a loop 10,000 times. Using a loop, compute the empirical distribution for the number of ones contained in integersequence (5,10) In [ 1: trial_num- 10000 num outcomes5 vec length = 10 empirical_dist-np.zeros (vec_length+1) for trial in range (0, trial_num): # Computes empirical distribution of ones outcome[11*vec_length EDIT

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution