Question: Random Walk. In lab, we saw how to model the behavior of a random walker on a 2 D grid using a Monte Carlo simulation.
Random Walk.
In lab, we saw how to model the behavior of a random walker on a D grid using a Monte Carlo simulation. In this problem, we will investigate collisions between two of these random walkers. Specifically, we will use our simulation to answer whether a collision is more likely if both walkers are moving or if only one walker is moving.
Part a
Start by writing a program to simulate a single random walker on an times grid. Similar to what we discussed in lecture, let this random walker have a chance of moving to each orthogonally adjacent cell up down, left, and right and a probability of staying still. In order to limit the size of the problem, we will restrict the motion to the confines of our times grid. If the particle tries to move past" one of the boundaries on its turn, its position does not change you can think about this as a particle forfeiting its turn or simply bumping into the wall and staying still
Part b
Add another particle to your simulation that moves according to its own randomly generated values. Start particle A at position and particle B at position as shown in above figure. At each iteration, both particles move simultaneously to an adjacent space using the rules outlined in Parta Keep in mind that these random walkers are not following any search strategy, and may blindly swap spaces right past each other. Continue updating the position of both particles until a collision occurs; that is when both particles occupy the same x y cell. We will only check for a collision once per iteration, after both particles have completed their move. Repeat this procedure for trails and report the median number of moves required to produce a collision you are free to use the builtin median function. Report your result using the exact formatting shown below:
Median
where will be replaced with your answer rounded up to the nearest integer.
Note: In order to reduce computation time, we will enforce a maximum number of possible moves for each trial. If you have simulated moves for particles A and B and they have not collided, record moves for that trial and proceed to the next one. Even with this safety net, it is possible the full simulation with trials will take up to seconds to run. Start with small tests when debugging!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
