This laboratory involves using file input to incorporating data into Mathematica and then perform basic statistical acessments and curve fitting. Students will need to extract subsets of the input data for analysis.
TASKS
In the file located at
http://pruffle.mit.edu/3.016/Laboratories/randomwalk.dat
you will find data from 8000 simulations of a random walk, similar to
the random walk problem in the first problem set (i.e., how many
steps does it take to pass a specified boundary
if each step has equal probability of going forward and backward).
However, in these random walk simulations, several different step-sizes,
,
were used (
) and several different limits,
,
were used for the edges (
).
Each line in the file represents a single simulation: the first column is
the step-size
; the second column is the boundary limit
; the third (and final)
column is the number of steps required to pass the boundary for that simulation.
These are the first ten lines of
http://pruffle.mit.edu/3.016/Laboratories/randomwalk.dat
| 0.5 | 25 | 1014 |
| 0.5 | 50 | 3108 |
| 0.5 | 75 | 57012 |
| 0.5 | 100 | 16114 |
| 1. | 25 | 347 |
| 1. | 50 | 532 |
| 1. | 75 | 3321 |
| 1. | 100 | 17266 |
| 1.5 | 25 | 525 |
| 1.5 | 50 | 478 |
displacement[numsteps_] :=
Module[
{position = 0},
For[
istep = 0,
istep < numsteps,
istep++,
position += 2 Random[Integer] - 1
];
Return[position]
]
returns a displacement from the origin after a random walk of We can simulate 10000 random walkers taking 100 steps by creating a table
walks = Table[displacement[100], {10000}];
We can count the number of walkers who landed at each position by counting them with
population[pos_] := population[pos] = Count[walks,pos]
We can create a table of positions and populations with
randata = Table[{i,population[i]} {i,-100,100,2}]
Note: the range of possible positions after 100 random steps is (-100,100) and
the positions must be at even numbers.
Diffusion in one dimension from a point source at the origin is given by
Find the
and
that fit
data from 10000 random walk simulations each taking
steps to Eq. 05-1.
Plot the curve with the data.
Can you predict how the diffusivity,
, depends on step-size and
for a one-dimensional
diffusion?
REPORT
This homework will be graded.
Your report on the work above should be ordered
as it is above.
Your report should include comments that would help one of your
classmates understand what your work demonstrates.
Send your report as a saved Mathematica notebook with name
3016_Lastname_Lab05.nb
to 3.016@pruffle.mit.edu.