Question: 1. (20 pts) Does a random walker ever get back home? Use the editor of your choice to create a file HW1_PROBLEM1.py Consider a random

 1. (20 pts) Does a random walker ever get back home?

1. (20 pts) Does a random walker ever get back home? Use the editor of your choice to create a file HW1_PROBLEM1.py Consider a random walker who starts out at square 0 and randomly takes steps that can be described as forward (+1) or backward (-1). An interesting question is what fraction of such random walkers ever get back home (square 0) in some specific number of steps 43 -21 0 1 2 3 4 To analyze this problem, you will write a Python program to do what is called a Monte Carlo simulation of a 1-dimensional random walker taking 10000 steps. We'll do 100 Monte Carlo trials so we can get good statistical averages. Note that since Python 2.7 has integer division. If you want to make sure that division is always float based, you can use the command from future import division (a) Use the help in Python and write down what the following lines do: (i) from random import choice, (ii) point+choice((-1,1) ) break (b) Enter the following code into your file and run it. You will get some errors- make sure the errors are corrected in your file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!