diffusion

diffusion - Matt Lang, MIT Diffusion example, simulation of...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Matt Lang, MIT Diffusion example, simulation of a random walk Try changing these variables, number of particles, step size, number of steps Number_of_particles := 2200 Step_size := 5 Number_of_steps := 1000 j := 0 .. Number_of_particles part j := 0 drift := 0 add some drift Let the computer roll the dice delta Step_size This is a simple program, we have for j 0 .. Number_of_particles an array of numbers that we Simulate part ( ) := randomly increase or decrese by a for i 1 .. Number_of_steps Step_size increment for each step. sign 1 if ( ) We perform this operation until we rnd 1 > 0.5 reach the number of steps value. sign ← − 1 otherwise It is two loops, one to do the part j part j + stepping for each particle and, an sign Step_size + drift overall loop to march through an v j part j "ensemble" of particles. return v m ( tt := Simulate part) := Number_of_particles 50 tt is the array of numbers calculate the standard deviation tt = calculate the mean m m 1 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

diffusion - Matt Lang, MIT Diffusion example, simulation of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online