Random Walk |
||
A natural
interpretation of a linear polymer chain is the random walk. Each visited site is counted
as a monomer (sometimes there is double counting). Two are two possible realizations for
random walks
It is very easy to simulate a random walk on the computer. The following program segment generates such random walks. Program Random Walk: It is assumed that in the array random are stored numbers which are uniformly distributed in the interval (0,1). A random number from the array is then multiplied by 4 and converted to an integer value. This integer value can either be 0,1,2 or 3 labeling the four possible directions or nearest neighbors on the square lattice. The numbers 0,1,2 and 3 are uniformly distributed as long as the numbers in the array random are so distributed. Depending on the direction the random number points to, the walker occupies the appropriate position on the lattice by increasing or decreasing the x or yvariable. The variables xn and yn hold the new position of the random walker. This program generates random walks on a square lattice. |
||
|
||