Random Walk 1-D and 2-D

22
Random Walk in 1-D and 2-D Andri Rahmadhani Department of Physics ITB – KAIST Internship Program Summer 2012

description

Week 1...Presentation about random Walk in 1-D and 2-D as basic theory of echonphysics

Transcript of Random Walk 1-D and 2-D

Page 1: Random Walk 1-D and 2-D

Random Walk in 1-D and 2-D

Andri RahmadhaniDepartment of Physics ITB – KAIST Internship Program

Summer 2012

Page 2: Random Walk 1-D and 2-D

Basic Theory Method & Algorithm Results References

Outline

Page 3: Random Walk 1-D and 2-D

What is random walk? Algorithm that represents trajectory of

random steps The direction of random walk cannot be

predicted from the past actions.

Basic Theory

Page 4: Random Walk 1-D and 2-D

Example : Flipped coin problem

Basic Theory

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

Page 5: Random Walk 1-D and 2-D

Example : Time-Series Graph (1-D)

Basic Theory

Figure 2. Time-Series random walk with N (steps) = 1000

and equal probability 0.5

Page 6: Random Walk 1-D and 2-D

Example : Square Lattice (2-D)

Basic Theory

Figure 3. Two dimensional random walk in square

lattice

Page 7: Random Walk 1-D and 2-D

The mathematics of 1-D Random Walk◦ Sum/Position after n steps: ; ◦ Expected Value:

◦ Expected translation distance after n steps:

Basic Theory

Page 8: Random Walk 1-D and 2-D

Basic Theory The mathematics of 2-D Random Walk

◦ Sum/Position after n steps: ; ◦ Absolute Value:

◦ Expected Value:

◦ Expected translation distance after n steps:

Page 9: Random Walk 1-D and 2-D

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 moves3) Repeat step 2 for n times which already set up in step 14) Plot sample graph5) Calculate mean/expectation value6) Increase number of steps and repeat step 2 until

reaching maximum number of steps7) Plot distance graph and print the results

Method & Algorithm

Page 10: Random Walk 1-D and 2-D

Random Walk in 1-D

Results

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

0 1 2 3 4 5 6 7 8 9 10-8

-6

-4

-2

0

2

4

Steps (N)

Val

ue

1st trial 2nd trial 3rd trial 8th trial 9th trial 10th trial

1 2 3 4 5 6 7 8 9 101

1.5

2

2.5

3

3.5

Number of steps (N)

Dis

tanc

e <

|Sn|

>

Distance Curve Fitting N1/2

Page 11: Random Walk 1-D and 2-D

Random Walk in 1-D

Results

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

0 10 20 30 40 50 60 70 80 90 100-15

-10

-5

0

5

10

15

Steps (N)

Val

ue

1st trial 2nd trial 3rd trial 8th trial 9th trial 10th trial0 10 20 30 40 50 60 70 80 90 100

0

2

4

6

8

10

12

14

Number of steps (N)

Dis

tanc

e <

|Sn|

>

Distance Curve Fitting N1/2

Page 12: Random Walk 1-D and 2-D

Random Walk in 1-D

Results

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

0 1 2 3 4 5 6 7 8 9 10-6

-5

-4

-3

-2

-1

0

1

2

3

Steps (N)

Val

ue

1st trial 2nd trial 3rd trial 9998th trial 9999th trial 10000th trial

1 2 3 4 5 6 7 8 9 101

1.5

2

2.5

3

3.5

Number of steps (N)

Dis

tanc

e <

|Sn|

>

Distance Curve Fitting N1/2

Page 13: Random Walk 1-D and 2-D

Random Walk in 1-D

Results

0 10 20 30 40 50 60 70 80 90 100-20

-15

-10

-5

0

5

Steps (N)

Val

ue

1st trial 2nd trial 3rd trial 9998th trial 9999th trial 10000th trial

0 10 20 30 40 50 60 70 80 90 1001

2

3

4

5

6

7

8

9

10

11

Number of steps (N)

Dis

tanc

e <

|Sn|

>

Distance Curve Fitting N1/2

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

Page 14: Random Walk 1-D and 2-D

Random Walk in 1-D◦ Curve Fitting :

Results

10 steps

10 trials

100 steps

10 trials

10 steps

100 trials

100 steps

100 trials

10 steps

1000 trials

100 steps

1000 trials

10 steps

10000 trials

100 steps

10000 trials

a 1.007 0.9786 0.8612 0.9993 1.006 0.9943 1.003 1

b 0.1199 0.08314 0.1896 0.08167 -0.003658 0.03825 -0.003868 0.006539

R2 0.8451 0.7447 0.9554 0.9651 0.9976 0.9946 0.9997 0.9995

Table 1. Curve fitting property for

Page 15: Random Walk 1-D and 2-D

Random Walk in 2-D

Results

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

-4 -3 -2 -1 0 1 2 3 4 5-2

-1.5

-1

-0.5

0

0.5

1

x

y

1st trial End 2nd trial End 9th trial End 10th trial End

1 2 3 4 5 6 7 8 9 101

1.5

2

2.5

3

3.5

4

Number of steps (N)

Dis

tanc

e <

|Sn|

>

Distance Curve Fitting N1/2

Page 16: Random Walk 1-D and 2-D

Random Walk in 2-D

Results

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

-10 -5 0 5 10 15-15

-10

-5

0

5

10

15

x

y

1st trial End 2nd trial End 9th trial End 10th trial End

0 10 20 30 40 50 60 70 80 90 1000

2

4

6

8

10

12

14

Number of steps (N)

Dis

tanc

e <

|Sn|

>

Distance Curve Fitting N1/2

Page 17: Random Walk 1-D and 2-D

Random Walk in 2-D

Results

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

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3-4

-3

-2

-1

0

1

2

3

4

x

y

1st trial End 2nd trial End 9999th trial End 10000th trial End1 2 3 4 5 6 7 8 9 10

1

1.5

2

2.5

3

3.5

Number of steps (N)

Dis

tanc

e <

|Sn|

>

Distance Curve Fitting N1/2

Page 18: Random Walk 1-D and 2-D

Random Walk in 2-D

Results

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

0 10 20 30 40 50 60 70 80 90 1000

2

4

6

8

10

12

Number of steps (N)

Dis

tanc

e <

|Sn|

>

Distance Curve Fitting N1/2

-6 -4 -2 0 2 4 6-10

-5

0

5

10

15

20

x

y

1st trial End 2nd trial End 9999th trial End 10000th trial End

Page 19: Random Walk 1-D and 2-D

Random Walk in 2-D◦ Curve Fitting :

Results

10 steps

10 trials

100 steps

10 trials

10 steps

100 trials

100 steps

100 trials

10 steps

1000 trials

100 steps

1000 trials

10 steps

10000 trials

100 steps

10000 trialsa 1.168 1.002 1.01 1.019 1.004 1.002 0.9961 1

b -0.3342 -0.1072 0.003024 -0.1196 0.007713 -0.0141 0.009183 -0.002094

R2 0.8919 0.7645 0.9865 0.9782 0.9975 0.9975 0.9998 0.9998

Table 2. Curve fitting property for

Page 20: Random Walk 1-D and 2-D

Root-mean-square of random walk final position or the distance is equal with root-square of number of random walk steps.

Valid for large number of random walks trials and equal probability.

Conclusion

Page 21: Random Walk 1-D and 2-D

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, 281-298, 1940.

References

Page 22: Random Walk 1-D and 2-D

Thank youEnd of slide