Personel Information

BSc: Physics Department, Middle East Technical University (METU), Ankara, Turkey
MSc: Physics Department, METU
PhD: Qualified, Physics Department, METU


Monday, July 11, 2016

TOTAL DISPLACEMENT OF LOOPLESS RANDOM WALK


## A for good and evil as well as loopless
## total displacement function of random walk
## that takes in the step numbers as an
## argument and returns the displacement
## of the rnd walker.Note that the probabilities
## to turn rigth and left are equal but the left
## step is twice the rigth step.
## Usage : rw_uneven(N)
function rw_uneven(N)
rn=rand(N,1); ## If the element of a random vector
r=-(rn<0.5); ## is smaller than 0.5, then return -1,
li=find(r == 0); ## Else return 2(equal probability).
r(li)=2;
x=sum(r) ## total displacement
endfunction

No comments:

Post a Comment