@guoxiaowhu
2016-06-04T01:00:39.000000Z
字数 1853
阅读 1488
Random
The motion of a particle or molecule in solution can be analogous to a random walk.The article will consider serveral different types of random walks.
Being different from general dynamics systems, random walk model has no dynamics equation. Its motion mechanism can be described by following procedure:
Record the location of it as , firstly, generate a random number between 0 and 1, then compare the number with another definite number which can determine the probability that it goes right, if , update to ; otherwise to .
Average is proportional to time or say step number .
Because every step length is unity, we have the conclusion .
Program code
Random.py
The step length is unity
Left: versus step number, for 2 random walks in 1 dimension.
Right: as a function of step number (or t) for a collection of 501 random walks.The equation of the straight line is (or ).
We can find that these points are all around the straight line, which demonstrates they have well proportional relationship .
If , let we see what will happen.
The equation of the curve in right figure is (or ), NOT a straight line.
It is obvious that the walker tends to go down.
Thus
More realistically, if we let become a random number between -1 and 1, or say it has random step lengths.
It seems to approach straight line .
Average dispacement , while average squared step length
So
program code
Ran.py
Random3D.py
This is trajectory of a random walk in 3 dimension.Walker started from the origin (0,0,0).
Let , similarly, we have .
-For 1 dimensional random walk, and step number or time have this relationship
-When , satisfies equation , not straight line;
-For 3 dimensional random walk, similarly, we have .