

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 25
This page cannot be seen from the preview
Don't miss anything!


















1
Dr. Nasir M Mirza
Computational Physics Computational Physics
Email: [email protected]
Docsity.com
2
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
i
goes to the ordinary state
i
with probability one.
The total number of particles in
0
and
3
are always kept constant equal
to
n
0
and
n
3
respectively.
One- Dimensional Random Walk
1
2
3
4
k
S
k-
Bo
N
5
0
1
2
3
N
Docsity.com
5
A particle that entered
1
or
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
o
goes to the
1
with a probability 0.5 or terminates
its life without going to
1
with probability 0.5. A similar rule applies to
N
too.
If a particle reaches
o
from
1
or
N
from
N-
, the life of the particle is
terminated.
The number of particles in the source states is always maintained to be
i
One- Dimensional Random Walk
1
2
3
4
k
S
k-
Bo
N
5
0
1
2
3
N
Docsity.com
7
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
A
B
C
D
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
o
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
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
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
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
Choose a random angle
in the range [0,
π
]. Set
x
= cos
θ
and
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