Answered step by step
Verified Expert Solution
Question
1 Approved Answer
simulate three coin tosses and tabulate the results. Create this program in Python and run it for 10,000 trials, printing out the fraction of trials
simulate three coin tosses and tabulate the results. Create this program in Python and run it for 10,000 trials, printing out the fraction of trials in which there are 0, 1, 2, and 3 heads. Are these fractions what they should be? it should be similar to the matlab program bellow:
N = 10000; % Number of simulations
U = rand(3,N); % a 3-by-N matrix of random numbers from [0,1]
Y = (U < 0.5); % Y=1 (heads) if U < 0.5, otherwise Y=0 (tails)
X = sum(Y); % Sums across columns. X = number of heads
hist(X); % Histogram of X
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