Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this problem, we will simulate a random walk on the d-dimensional integer lattice Z d . (A point in Z d can be regarded

In this problem, we will simulate a random walk on the d-dimensional integer lattice Z d . (A point in Z d can be regarded as a vector with d components, all of which are integers.) A particle will walk along the lattice in the following way:

(a) The particle starts at the origin.

(b) For each step, one of the d possible coordinate directions is selected uniformly at random.

(c) The particle then moves one step forward or backward in that coordinate direction with equal probability.

Here is an example of what a walk of 5 total steps in Z 3 might look like: Start at (0, 0, 0). For the first step, the randomly chosen coordinate direction was the first coordinate, and we randomly selected to move forward one step to arrive at (1, 0, 0). For the second step, the randomly chosen coordinate direction was the third coordinate, and we randomly selected to move backward one step to arrive at (1, 0, 1). For the third step, the randomly chosen coordinate direction was the first coordinate, and we randomly selected to move forward one step to arrive at (2, 0, 1). For the fourth step, the randomly chosen coordinate direction was the second coordinate, and we randomly selected to move forward one step to arrive at (2, 1, 1). For the fifth step, the randomly chosen coordinate direction was the second coordinate, and we randomly selected to move backward one step to arrive at (2, 0, 1).

Using a Monte Carlo simulation, report to the user both the average (Euclidean) distance of the location of the particle to the origin after N steps of this random walk. Your program should take three command line arguments: an integer d representing the number of dimensions in which to perform the walk, an integer K representing the number of steps to take on each walk, and an integer N representing the number of trials for your Monte Carlo simulation.

As an example, for 3 dimensional random walk, the average distance to the origin after 100 steps is approximately 9.22. In one dimension, the average distance to the origin after K steps is roughly square root (2K/pi).

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