diffusion

# diffusion - Matt Lang MIT Diffusion example simulation of a...

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

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/11/2011 for the course BIO 2.797j taught by Professor Matthewlang during the Fall '06 term at MIT.

### Page1 / 2

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

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

View Full Document
Ask a homework question - tutors are online