# 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:

• The general results form triangular structure
• For even N the highest number of random walks is for zero position
• For odd N the highest number of random walks is for +/-1 position

### 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. 