The following graph is the x component of position as a function of time
for a particle undergoing simulated Brownian motion. The program that generated
the random walk was written in C and was named
bsumsci2.c. The code assumes a particle with radius 0.312x10^{6}
meters, immersed in water with absolute viscosity, 0.0010019 kg/m s, at 293K.
The graph depicts five hundred points at which the position of the particle is
recorded out of the 80,000 points generated by the bsumsci2.c simulation. Each
time step is one thirtieth of a second, chosen because many experiments are done
with digital video microscopy, which has a frame rate of 30fps.
After recording the positions of the particle in
data1.dat and simulation parameters in
params1.txt, the program then stores the difference between each position or
between positions separated by any fixed time interval (say every third interval).
These displacements are written to a file,
delt1.dat. data1.dat, params1.txt, and delt1.dat
are given a serial number when created. The template file names are, dataXXXX.dat,
paramsXXXX.txt, and deltXXXX.dat, where XXXX is an identifying serial number.
These displacements should be normally distributed as described in the
Theory section. To check this we use Origin 6.0,
a data analysis and graphing program. LabTalk is Origin's builtin
programming language, which enabled us to automate some of the analysis. The
following code is part of a LabTalk program we wrote called,
slopes.ogs. It was written to create histograms
of the displacements output by bsumsci2.c.
Though this feature is not used immediately, the slopes.ogs program is capable
of handling multiple displacement files.
win t wks ORIGIN Wk$(ii); //Creates a new worksheet template for each ASCII
delt file. Assumes delt files have a number on the end of their name.
FDLog.Get(A, ii); //Get the filename to open into %A
open w %A; //Import the data into the worksheet
#!type "File: %A"; //Report name of imported file
//%H is set to the current active window title.
%B=%H_A; //Adding column A to %H.
win t wks ORIGIN histdata$(ii); //Creates a workseet for the
histogram of the delt files. ii increments histdata wks
ll=1; mm=0.0000009688;
for(mm=0.0000009688;mm<=0.0000009688;mm+=0.0000000625){
histdata1_A[ll]=mm; //For loop fills column A of
ll++;}; //histdata(ii) with midpoint bin values for plotting
the histogram.
histdata$(ii)_A=histdata1_A; //Fills column A of multiple delt files.
histdata$(ii)_B=histogram(%B,6.25e8,9.688e7,9.688E7);
//Histograms Delt file and puts result in column B of histdata
histdata$(ii)_B=histdata$(ii)_B / 80000; //Converts counts into a frequency.
worksheet a 1;
window t graph ORIGIN hist$(ii); //Creates graph histii to plot histogram on
layer i201 histdata$(ii)_B;
layer a;
The graph below is the output of the above LabTalk code, applied to a deltXXXX.dat
file. Plotted on the vertical axis of the histogram is the number of displacements
within a specific bin divided by the total number of steps. The xaxis is
divided into 32 bins with width 6.25x10^{8} meters, starting at
1x10^{6} meters and ending at 1x10^{6} meters. The yaxis is
thus the probability of a displacement occurring within each bin.
The fit to the data points is a nonlinear fit to the equation
(see the Normal Distribution section). First we
observe that the histogram data is well fit by the Gaussian function. To make a
more quantitative comparison we need to note the difference between the histogram
and the theoretical probability density. The histogram records the probability,
P(x), of a displacement occurring in a range of x from x  Δx/2 to x + Δx/2,
where Δx is the bin width. Expressed in terms of the probability density function,
If we have sufficiently
narrow bins and a reasonably smooth f(x), this may be approximated as
P(x) = f(x) Δx. Origin reports a best fit value
of w to be: w = (3.0366 +/ 0.0105) x 10^{7}m and a best fit value of A
to be A = (6.2535 +/ 0.01804) x 10^{8}. From the
Theory page, we expect .
Using the values of radius, viscosity, and temperature given above, we expect
w = 3.025 x 10^{7}m. Thus, we see agreement between our simulated Brownian motion and the theoretical
expectations, within our uncertainties. The parameter A should just be the bin
width and we see that it also agrees with our uncertainties.
