Homework 2Homework 3Homework 4Homework 5

Homework 2

Question 1:

The program was written using Matlab whose output file is Homework2.csv. It enumerates the total number of random walks of N steps that reach the point x, for all x and N. It can be easy shown that we can get to an even position only with even number of steps, and to an odd position only with odd number of steps.

Conclusions that can be made from the output file:

Source code:

Please note, the source files have to be in the same folder.

HomeWork2_1.m - the main function
getNW.m - utility used in the main function

Question 2:

The programs rwalk1.f and cplot.f were used to draw graph of P(x), the probability that after n steps a walker has net displacement x. It was checked for N = 8, 16, 32 and 64 with many seeds numbers. Unfortunately, it was hard to determine how changing of seed number influence on mean displacement. But it can be seen that with increasing the step number, the mean displacement approaches zero and curve was smoother.
The example of PGPLOT graph for N=16 and seed = 96543 is presented in the following image.

graph for N=16 and seed = 9654