Question
A) A random walker starts at the origin (x, y) = (0, 0) and takes N steps. In each step, he moves one meter east
A) A random walker starts at the origin (x, y) = (0, 0) and takes N steps. In each step, he moves one meter east (positive x-direction) or north (positive y-direction) or west or south; all four directions are equally probable. Plot the path taken by the walker for N = 100 steps. Indicate the starting position (the origin) by a circle and the final position by a star. Calculate and print out the distance between the initial and final points.
B) Now assume there are 100 walkers that start at the origin. Each executes 1000 steps as described above. Write a code which calculates the average distance between the initial and final point (calculate the distance for each of the 100 walkers and take the average).
Doing this in Python would be much appreciated!
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