Question
Write a program RandomWalkers.java that takes two integer command-line arguments N and T. In each of T independent experiments, simulate a random walk of N
Write a program RandomWalkers.java that takes two integer command-line arguments N and T. In each of T independent experiments, simulate a random walk of N steps and compute the squared distance. Output the mean squared distance (the average of the T squared distances).
% java RandomWalkers 100 10000 - mean squared distance = 101.446
% java RandomWalkers 400 2000 - mean squared distance = 383.12
% java RandomWalkers 100 10000 - mean squared distance = 99.1674
% java RandomWalkers 800 5000 mean squared distance = 811.8264
% java RandomWalkers 200 1000 - mean squared distance = 195.75
% java RandomWalkers 1600 100000 - mean squared distance = 1600.13064
As N increases, we expect the random walker to end up farther and farther away from the origin. But how much farther? Use RandomWalkers to formulate a hypothesis as to how the mean squared distance grows as a function of N. Use T = 100,000 trials to get a sufficiently accurate estimate.
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