Random Walks-Computational Physics-Lecture Slides, Slides of Computational Physics

Dr. Nasir M Mirza discussed following points in this lecture at Pakistan Institute of Engineering and Applied Sciences, Islamabad (PIEAS): Random, Walk, Dimensional, Results, Discretized, Heat, Conduction, Equation, Boundary, Game

Typology: Slides

2011/2012

Uploaded on 07/05/2012

imran
imran 🇵🇰

5

(1)

16 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Stochastic Methods
Topic:
Random Walk
Dr. Nasir M Mirza
Computational Physics
Computational Physics
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Random Walks-Computational Physics-Lecture Slides and more Slides Computational Physics in PDF only on Docsity!

1

Stochastic Methods

Topic:

Random Walk

Dr. Nasir M Mirza

Computational Physics Computational Physics

Email: [email protected]

Docsity.com

2

Lecture: Random Walk -

I

Monte Carlo Methods

Monte Carlo Methods

Docsity.com

4

Every particle stays in a state for a short fixed interval of time (say onemicro-second) before going into another state.

A particle generated in the source state

(S

i

goes to the ordinary state

G

i

with probability one.

The total number of particles in

G

0

and

G

3

are always kept constant equal

to

n

0

and

n

3

respectively.

One- Dimensional Random Walk

Every Particle at a state has two possibilities to move:

move to Left

or to the Right.

Both sides are equally probable.

S

1

S

2

S

3

S

4

S

k

S

k-

Bo

B

N

S

5

G

0

G

1

G

2

G

3

G

N

Docsity.com

5

A particle that entered

G

1

or

G

2

stays there for a short interval (say one

micro-second) and then moves to the left or right state with probability 0.5to each direction.

A particle originally at

G

o

goes to the

G

1

with a probability 0.5 or terminates

its life without going to

G

1

with probability 0.5. A similar rule applies to

G

N

too.

If a particle reaches

G

o

from

G

1

or

G

N

from

G

N-

, the life of the particle is

terminated.

The number of particles in the source states is always maintained to be

Q

i

One- Dimensional Random Walk

S

1

S

2

S

3

S

4

S

k

S

k-

Bo

B

N

S

5

G

0

G

1

G

2

G

3

G

N

Docsity.com

7

N = 200;

imax = 100; jmax = 2;

nframes = 20; % number of frames for movie rand('state', 0) % initialize i = 50; for kk = 1: 1000

eta = rand;

if((eta >= 0 ) & ( eta < 0.5) ) i = i + 1; elseif((eta >= 0.5 ) & ( eta < 1.0) ) i = i - 1; end

if i >= imax

break end if i <= 1 break end

plot(i, kk, 'r:.');

hold on F(kk) = getframe; kk

end

MATLAB Program:

One- Dimensional

Random Walk

Docsity.com

8

Result: One- Dimensional Random Walk

Here we startedwith ith position =50 for a grid of100 mesh pointsand as a functionof MC steps wesee above therandom walk.

Results:

One- Dimensional

Random Walk

One- Dimensional Random Walk

Docsity.com

10

Here boundary values are given as

A

B

C

, and

D

respectively. Consider

a situation where

i = u

and

j = v

is the point where

is to be estimated.

Then the random walk game can be played as following:

A particle starts its random walk from a point P

(i, j).

It can move up, down, right or left i.e., it can have positions

(i, j+1), (i, j-1),

(i+1, j),

and

(i-1, j)

respectively with equal probability of ¼ for each

direction.

The score of this game is initiated as

C(i, j)

is zero before the start of random

walk.

As particle stays in

(i, j)

position for a second the score is increased by

Q

i, j

If it reaches a boundary stat then the

C(i, j)

is increased by the appropriate

value of f at the boundary and then the life of the particle is terminated.

After a large number of games, the average value of

C(i,, j )

is approximated

to the f(

i,, j

Two – Dimensional Random Walk

Docsity.com

11

For the point (1,2) let us first formulate the conditions to play the walkgame. Its conditions are following: the motion will be towards left side if

≤ ξ ≤

the motion will be towards upward direction if

ξ ≤

the motion will be towards right side if

ξ ≤

the motion will be towards downward direction if

ξ ≤

EXAMPLE: We have a sold bar with surface

temperatures known and fixed.

There are no internal heat sources presentin the system.

ind the temperature at a node (1, 2) usingthe procedure.

The cut-view of the bar in two-dimensionalmodel is shown in figure.

Two – Dimensional Random Walk

200

o

C

100

o

C

10

o

C

70

o

C

(1, 3) (1, 2) (1, 1)

(3, 3) (2, 2) (2, 1)

Docsity.com

13

The random walk is allowed to repeat again with the same start.

RandomNumber

(

r

)

Comparison & Decision

Next

Position

Temperature (

o

C)

Up

(1,

0

Down

(1,

0

Left

Boundary

100

The next game’s results are shown below:

RandomNumber (

r

)

Comparison & Decision

Next Position

Temperature (

o

C )

Down

(1, 1)

0

Down

Boundary

70

This game was allowed to repeat ten times and the average temperature hasbeen estimated as following:

{

}

10

100

100

70

100

10

70

100

100

200

10

1

                  • = T

o

C.

Two – Dimensional Random Walk

Docsity.com

14

% Program name: monte_diffusion.m for k_trace = 0: 3 N = 200;

imax = 100;

jmax = 100;

nframes = 20; % number of frames for movie i = 50;

j = 50;

rand('state', k_trace) % this sets the generator to an initial state for k = 1: 8000 for kk = 1: 10

rr = rand;

%

if((rr >= 0 ) & ( rr < 0.25) & (right == 1))

if((rr >= 0 ) & ( rr < 0.25) ) i = i + 1;

j = j;

elseif((rr >= 0.25 ) & ( rr < 0.50) ) i = i;

j = j + 1;

elseif((rr >= 0.50 ) & ( rr < 0.75)) i = i - 1;

j = j;

elseif((rr >= 0.75 ) & ( rr <= 1.00)) i = i;

j = j - 1;

end

end

MATLAB Program

Docsity.com

16

0

10

20

30

40

50

60

70

80

90

100

0

90 80 70 60 50 40 30 20 10

100

Resulting Diffusion Walks

Here traces for

three particles

starting from

position (50, 50)

are shown in

three different

colors and traces stop

when particle hits any of the

boundaries.

Docsity.com

17

In a random-walk simulation, such as that in Figure, anartificial

walker

takes many steps, usually with the

direction

of each step

independent

from the direction of

the previous one. This is illustrated in Figure. For ourmodel, we start at the origin and take

N

steps in the

x

y

plane of

lengths

(not coordinates).

More About RANDOM WALK

There are many physical processes, such as Brownian motion and electrontransport through metals, in which a particle appears to move randomly.

For example, consider a perfume atom released in the middle of a classroom. It collides randomly with other atoms in the air and eventuallyreaches the instructor's nose.

The problem is to determine how many collisions, on average, the

atom

must make to travel a radial distance of

R.
R
N

Docsity.com

19

Simple Unbiased Random Walk For simple, random walks (RW) the walker maycross the walk an infinite number of times withno cost. In

d

dimensions the end-to-end

distance diverges with the number of steps

N

according to

A simulation of the simple random walk can be carried out by picking a startingpoint and generating a random number to determine the direction of eachsubsequent, additional step. After each step the end-to-end distance is computed. The result is like above figure.

Docsity.com

20

Random Walk Methods

Choose a random angle

in the range [0,

π

]. Set

x

= cos

θ

and

Y =

sin

θ

It is due to

dxdy

= sin

cos

d

not being uniform in

x

and

y.

Choose a random

x

in the range [-

sqrt(2), sqrt(2)] and a separate random

y

in the range [-sqrt(2), sqrt(2)]. In this way positive and negative steps in

each direction are equally likely.

Choose random values for

x

in the range [-1, 1] and

y = sqrt(1 -

x

2

(choose the sign randomly, too).

Choose the directions (N, E, S, W) randomly as the step directions (notrigonometric functions are then needed). Notice that choosing one of fourdirections is equivalent to choosing a random

integer

in [1,4].

Choose the directions (N, NE, E, SE, S, SW, W,NW) randomly as the stepdirections (no trigonometric functions are then needed). This is

equivalent to

choosing a random

integer

in the range [1,8].

We obtained the best results with the second method.

Docsity.com