
















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
Main topics for this course are Stochastic process, random variables, linear congruent generators, pdfs and cdfs, rejection method, metropolis methods, sampling techniques, random walks and genetic algorithm. This lecture includes: Random, Walk, Transport, Particles, Discrete, System, Bounded, Diffusing, 1-D, Source, State, Interval, Simulation, Equation, Model
Typology: Slides
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















2
docsity.com
3
B
o
B
N
S
1
S
K
0
1
2
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
1
2
3
4
k
S
k-
Bo
N
5
0
1
2
3
N docsity.com
6
The one-D random walk simulation is done in following manner: A particle in
i
goes to
i
in next time interval and then to
i-
or
i+
The direction of motion is decided with the help of random number. The random walk of each particle is followed until the particle reaches
o
or
3
Every time a particle visits
i
, the score of
i
is increased by one.
i
(
)
,
1 2
1
1
i
i
i
i
Q
n
n
n
=
−
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
docsity.com
9
Here
we
consider
a
simple
two-dimensional
discrete
model.
Let
us
employ
an
equally
spaced two-dimensional mesh as shown here For
a
node
(i,
j),
the
nearest
neighbor
contributions (Figure) are used. The
heat
conduction
equation
in
discretized
form is given by the following equation:
j
,
i
1
j
,
i
1
j
,
i j , 1 i j , 1 i j
,
i
Q
4 1
φ + φ + φ + φ = φ
−
−
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.
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
12
Figure shows the cross sectional view of the bar. We have assigned indices (1, 1), (2, 1), (1, 2), (2, 2),(1, 3) and (3, 3) respectively. The first trial’s results are shown below. The gameterminates when the we hit the boundary.
200
o
C
100
o
C
10
o
C
70
o
C
(1, 3) (1, 2) (1, 1)
(3, 3) (2, 2) (2, 1)
RandomNumber
(
r
)
Comparison & Decision
Next
Position
Temperature (
o
C)
0.
Right
(2,
2)
0
0.
Up
(2,
3)
0
0.
Up
Boundary
200
The next game starts again from the point (1,2). RandomNumber
(
r
)
Comparison & Decision
Next
Position
Temperature (
o
C)
0.
Left
Boundary
100
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
15
if i >= imax
break end if i <= 1 break end if j >= jmax break end if j <= 1 break end
axis([0 imax 0 jmax]); if k_trace == 0
plot(i, j, 'r:.'); elseif k_trace == 1 plot(i, j, 'b:.'); elseif k_trace == 2 plot(i, j, 'g:.'); elseif k_trace == 3 plot(i, j, ‘y:.');
end hold on F(k) = getframe;
end end % end of traces
MATLAB Program
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).
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
18
Here r(rms) is the average
(root-mean-squared)
step size.
Notice that that the same result obtains for a three-dimensional walk.According to above equation, even though the total distance walked after
steps is
Nr(rms),
on average, the radial distance from the starting point is
only sqrt(N) x r(rms).
When walk is random, the particle is equally likely toin any direction in each step. On average,
for a large number of random steps, all
the cross terms will vanish and we will be left with
docsity.com
20
Random Walk Methods
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
21
docsity.com