Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Python Code. The program walk.py in Listing 5.1 is a sample random-walk simulation. It's key element is random values for the x and y

Use Python Code.
image text in transcribed
The program walk.py in Listing 5.1 is a sample random-walk simulation. It's key element is random values for the x and y components of each step. Here we omit the scaling factor that normalizes each step to length 1. When using your computer to simulate a random walk, you should expect to obtain (5.17) only as the average displacement after many trials, not necessarily as the answer for each trial. You may get different answers depending on how you take your random steps (Figure 5.4 right). Start at the origin and take a 2-D random walk with your computer. 1. To increase the amount of randomness, independently choose random values for x and y in the range [1,1]. Then normalize them so that each step is of unit length x=L1x,y=L1y,L=x2+y2. 2. Use a plotting program to draw maps of several independent 2-D random walks, each of 1000 steps. Using evidence from your simulations, comment on whether these look like what you would expect of a random walk. 3. If you have your walker taking N steps in a single trial, then conduct a total number KN of trials. Each trial should have N steps and start with a different seed. 4. Calculate the mean square distance R2 for each trial and then take the average of R2 for all your K trials: R2(N)=K1k=1KR(k)2(N). 5. Repeat the preceding and following analysis for a 3-D walk as well. 6. Check the validity of the assumptions made in deriving the theoretical result (5.17) by checking how well R2xixj=iR2xiyj0. Do your checking for both a single (long) run and for the average over trials. 7. Plot the root-mean-square distance Rrms=R2(N) as a function of N. Values of N should start with a small number, where RN is not expected to be accurate, and end at a quite large value, where two or three places of accuracy should be expected on the average

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions