4 ) If you bet on even number and if you get 10 then you lose. 10 will be counted as an odd number and 11 will be counted as an even number. 3 ) In this game 10 and 11 are special numbers. "" " RULES : 1 ) There are chits containing numbers ranging from 1 - 100 in a bag. #Import required libraries : import random MC_samples, MC_beta_hats = MC_estimation_slope ( M = 10000 ) flatten ( ) return (MC_samples, MC_beta_hats ) normal (mu, sigma, n ) # population distribution using the assumd parameter values alpha / beta Y = (alpha + beta * X + e ) # running OLS regression for getting slope parameters normal (mu, sigma, n ) # generating independent variable by making sure the variance in X is larger than the variance in error terms X = 9 * np. Pi_storage = for i in range ( M ) : # randomly sampling from normal distribution as error termsĮ = np. N = # I define an empty dictionary to store the results of iterations to it Pi = 4 * (circle /n ) #returning the result return Pi random ( ) #Checking to see if the produced number falls into the circle if sqrt (x ** 2 + y ** 2 ) <= 1 :Ĭircle += 1 # I calculate Pi for this iteration year #This function does all the calculations for usĭef PiEstimation (n ) : # I define a variable to store the number of points inside the circleĬircle = 0 #loop to calculate the points we need for our estimation for i in range ( 1 ,n + 1 ) : #First I begin by importing the modules we need import random
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |