Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

P2. Monte Carlo. You have one fair die (each number 1-6 is equally probable). How many throws would you expect to roll two sixes in

image text in transcribed P2. Monte Carlo. You have one fair die (each number 1-6 is equally probable). How many throws would you expect to roll two sixes in a row? Provide a python code to solve this. Hint: The answer is 42 . This problem can be solved mathematically or with code. Mathematically, this problem is solved using a Markov Chain. A Markov Chain is when past and future states are equally independent. Below is the transition graph for this scenario: " S " denotes the starting state, " 6 " denotes when a 6 is rolled and " 66 " represents when two 6's are rolled in a row. If we start on the left, we can see that there 5/6 probability of rolling something other than 6 , so you would just start at the beginning. To get to the " 6 " state, you have a 1/6 probability. From there, you have a 5/6 probability to not roll a 6 and go back to the beginning, or you have a 1/6 probability to roll a 6 again and end the streak. The number of rolls, X, can be represented by the following formula: X=(1p)(1+X)+p(1p)(2+X)+p2(2) This formula has all of the above states accounted for and will give you a final answer of 42. A Monte Carlo python code will give you close to this number given a large enough sample size. Please provide this information in a .py or jupyter-notebook file. (It can be the same jupyter-notebook file as problem 1.)

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

Optimization And Data Science Trends And Applications 5th Airoyoung Workshop And Airo Phd School 2021 Joint Event

Authors: Adriano Masone ,Veronica Dal Sasso ,Valentina Morandi

1st Edition

3030862887, 978-3030862886

More Books

Students also viewed these Databases questions