文件名称:randomwalk
文件大小:170KB
文件格式:PDF
更新时间:2021-10-14 09:44:34
随机漫步
随机漫步任务 Using the computer language of your choice, write a simulation of random walks in one dimension, on a lattice of spacing delta x=1 and with discrete time steps, delta t=1. Each walker begins at the origin and at each time step it takes a step to the right or left with equal probability, so that p_right=0.5, p_left=0.5. Number of steps in each walk: 20 Number of walks: 10,000 You may structure your code as discussed in class, or come up with your own algorithm. Note, you will need a random number generator. Make the following graphs using your simulation data: A. Mean square displacement vs. time, for time from t=0,1,2,3...20. Fit a straight line to the curve (by eye is okay) and find the diffusion coefficient. Is it the same as predicted by theory? B. Spatial distribution of walks at time = 20, normalized so the area under the curve is 1. [Note: after an even number of steps, all walks end on evennumbered sites.] C. For comparison, calculate the expected average spatial distribution at time T=20 and plot together with your simulation data.