Question
1.(PYTHON) The random walk in two dimensions (20 points) Write a code for the random walk on a square lattice (a grid). The walker randomly
1.(PYTHON) The random walk in two dimensions (20 points) Write a code for the random walk on a square lattice (a grid). The walker randomly moves either one step up, one step down, one step right, or one step left. This can be seen as two independent random walks in x, y directions and is a straightforward generalization of the code for the one-dimensional case discussed in the lecture. (a) (10 pts) Visualize the random walk with N steps by either plotting it in a suitable way or by animating the walk. (b) (5 pts) Obtain the statistical return probability pret(N) to the origin (0, 0) as a function of the number of steps N. Plot the return probability and determine the functional dependence on N. If a drunken sailor makes a random walk through a city with streets which follow a grid: Is he guaranteed to return to the point where he started? (c) (5 pts) Obtain the statistical average distance d = (x^2 +y^2)^1/2 for the random walker from the origin, (x, y) = (0, 0), after N steps. Plot the average distance and determine the functional dependence on N.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started