Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is what I have tried so far for 1.a.: from __future__ import print_function, division import numpy as np import matplotlib.pyplot as plt def coins(n,p):

image text in transcribedThis is what I have tried so far for 1.a.:

from __future__ import print_function, division import numpy as np import matplotlib.pyplot as plt

def coins(n,p): return np.random.choice([True, False], p=[p,1-p], size=n)

#1.a

array1 = []

count2 = 0

for i in range(0, 10): seq1a = coins(3,0.5) print(seq1a) for j in range(0,len(seq1a)): count1 = 0 if seq1a[j] == seq1a[j-1]: # trying to count for each element being the same count1 +=1 else: count1 += 0 if count1 == 2: #trying to count for each time a trial has identical flips array1.append(True) else: array1.append(False)

for k in range(0, len(array1)): if array1[k] == True: count2 +=1 else: count2 = count2

print(count2/10000) #probability

4 [Coding (10 Points)] Use 10,000 trials to estimate the probabilities in all parts of Problem 1 and parts (a) through (d) in Problem 3. To use simulations for estimating the probability of an event, E, we can run n 10,000 trials and count the number of trials in which the event of interest, E, occurs. Let us call this number ne. Then, the ratio will be an estimate for P(E) 4 [Coding (10 Points)] Use 10,000 trials to estimate the probabilities in all parts of Problem 1 and parts (a) through (d) in Problem 3. To use simulations for estimating the probability of an event, E, we can run n 10,000 trials and count the number of trials in which the event of interest, E, occurs. Let us call this number ne. Then, the ratio will be an estimate for P(E)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

Understand the process of arbitration

Answered: 1 week ago

Question

Could you explain each line of the python code?

Answered: 1 week ago