Você está na página 1de 22

Andri Rahmadhani Department of Physics ITB KAIST Internship Program Summer 2012

Basic Theory Method & Algorithm Results References

What is random walk? Algorithm that represents trajectory of random steps The direction of random walk cannot be predicted from the past actions.

Example : Flipped coin problem

Figure 1. One of possible random walks position after 5 flips

Example : Time-Series Graph (1-D)

Figure 2. Time-Series random walk with N (steps) = 1000 and equal probability 0.5

Example : Square Lattice (2-D)

Figure 3. Two dimensional random walk in square lattice

The mathematics of 1-D Random Walk


Sum/Position after n steps: = Expected Value:
= 1 1 + 2 2 + 3 3 + + = = 0 =1 2 = 2 = =1
=1

; 0 = 0

Expected translation distance after n steps:

The mathematics of 2-D Random Walk


Sum/Position after n steps: = Absolute Value:
+
2

; =1

0 = 0
=

Expected Value:

2

=1 =1 ,=1

=1

=1

= +

,=1

Expected translation distance after n steps:


Simulation using Matlab Algorithm of Random Walk (1-D & 2-D)


1) Set the number of steps, trials, random variable, and probability of random variable 2) Generate random number and moves 3) Repeat step 2 for n times which already set up in step 1 4) Plot sample graph 5) Calculate mean/expectation value 6) Increase number of steps and repeat step 2 until reaching maximum number of steps 7) Plot distance graph and print the results

Random Walk in 1-D


3.5 Distance Curve Fitting N1/2

2
3

0
Distance <|Sn|>
2.5

Value

-2

-4

-6

1.5

-8

1 1 trial
st

2 2

3
nd

4
rd

5 Steps (N) 3 trial

6 8 trial
th

7 9 trial
th

9 10 trial
th

10

trial

5 6 Number of steps (N)

10

Figure 4. Value and distance for 10 steps with 10 trials


15

Random Walk in 1-D


14 Distance Curve Fitting N1/2 12

10

10

Distance <|Sn|>

Value

-5
4

-10
2

-15

10 1st trial

20

30 2nd trial

40

50 Steps (N) 3rd trial

60 8th trial

70

80 9th trial

90 10th trial

100
0 0 10 20 30 40 50 60 Number of steps (N) 70 80 90 100

Figure 5. Value and distance for 100 steps with 10 trials

Random Walk in 1-D


3.5 Distance Curve Fitting N1/2

2
3

0
Distance <|Sn|>
2.5

-1
Value

-2

-3

-4
1.5

-5

-6

0
st

1 1 trial

2 2
nd

3 trial

4 3 trial
rd

5 Steps (N)
th

7
th

8 9999 trial

9
th

10

5 6 Number of steps (N)

10

9998 trial

10000 trial

Figure 6. Value and distance for 10 steps with 10000 trials

Random Walk in 1-D


11 Distance 10 Curve Fitting N1/2

Distance <|Sn|>

-5
Value

-10

-15

-20

10 1 trial
st

20 2
nd

30 trial

40 3 trial
rd

50 Steps (N)

60
th

70
th

80 9999 trial

90
th

100

10

20

30

40 50 60 Number of steps (N)

70

80

90

100

9998 trial

10000 trial

Figure 7. Value and distance for 100 steps with 10000 trials

Random Walk in 1-D


Curve Fitting : = +
Table 1. Curve fitting property for = +

10 steps 10 trials a b R2 1.007 0.1199 0.8451

100 steps 10 trials 0.9786 0.08314 0.7447

10 steps 100 trials 0.8612 0.1896 0.9554

100 steps 100 trials 0.9993 0.08167 0.9651

10 steps 1000 trials 1.006 -0.003658 0.9976

100 steps 1000 trials 0.9943 0.03825 0.9946

10 steps 10000 trials 1.003 -0.003868 0.9997

100 steps 10000 trials 1 0.006539 0.9995

Random Walk in 2-D


4 Distance Curve Fitting N1/2 3.5

0.5

0
Distance <|Sn|>

-0.5

2.5

-1

-1.5

1.5

-2 -4 1 trial
st

-3

-2 End 2

-1
nd

0 x End

1 9 trial
th

2 End

4 10 trial
th

5 End

5 6 Number of steps (N)

10

trial

Figure 8. Value and distance for 10 steps with 10 trials


15

Random Walk in 2-D


14 Distance Curve Fitting N1/2 12

10

10

5
Distance <|Sn|>

-5
4

-10
2

-15 -10 1 trial


st

-5 End 2
nd

0 x trial End

5 9 trial
th

10 End 10 trial
th

15 End

10

20

30

40 50 60 Number of steps (N)

70

80

90

100

Figure 9. Value and distance for 100 steps with 10 trials

Random Walk in 2-D


3.5 Distance Curve Fitting N1/2

3
2

-1

Distance <|Sn|>
-1.5 End -1 -0.5 2nd trial 0 End 0.5 x 1 9999th trial 1.5 End 2 2.5 10000th trial 3 End

2.5

-2

-3

1.5

-4 -2 1st trial

5 6 Number of steps (N)

10

Figure 10. Value and distance for 10 steps with 10000 trials


20

Random Walk in 2-D


12 Distance Curve Fitting N1/2

15

10

10
8
Distance <|Sn|>

0
4

-5
2

-10 -6 1st trial

-4 End

-2 2nd trial End

0 x 9999th trial

2 End

4 10000th trial

6 End
0 0 10 20 30 40 50 60 Number of steps (N) 70 80 90 100

Figure 11. Value and distance for 100 steps with 10000 trials

Random Walk in 2-D


Curve Fitting : = +
Table 2. Curve fitting property for = +

10 steps a b 10 trials 1.168 -0.3342

100 steps 10 trials 1.002 -0.1072 0.7645

10 steps 100 trials 1.01 0.003024 0.9865

100 steps 100 trials 1.019 -0.1196 0.9782

10 steps 1000 trials 1.004 0.007713 0.9975

100 steps 1000 trials 1.002 -0.0141 0.9975

10 steps 10000 trials 0.9961 0.009183 0.9998

100 steps 10000 trials 1 -0.002094 0.9998

R2 0.8919

Root-mean-square of random walk final position or the distance is equal with rootsquare of number of random walk steps. Valid for large number of random walks trials and equal probability.

Pearson, K. (1905). The problem of the Random Walk. Nature. 72, 294. Van Kampen N. G., Stochastic Processes in Physics and Chemistry, revised and enlarged edition (North-Holland, Amsterdam) 1992. McCrea, W. H. and Whipple, F. J. W. "Random Paths in Two and Three Dimensions." Proc. Roy. Soc. Edinburgh 60, 281298, 1940.

End of slide

Você também pode gostar