October 18, 2005 --- Class 12 --- More Random Walks, Hist, Biased Estimators Activities: More Random walks We continued the discussion started in the previous class of statistics of random walks. Using Mathematica, it takes some time to create our random walks. We contrasted the time it took to generate these walks with the time to generate the random walks using a C program. The C progam was much faster, but there is more coding required. The C program is ~sg/rwalk_fsr.c The code was explained in detail. It was then modified so it would only print the last point of the walk, not the entire walk. When we printed the whole walk, we used awk to find the final value of each walk and this was slower than only printing the final value from the C program. A simple histogram program hist was introduced. The code is in my src directory and it is called hist.c. You are welcome to copy this code and use it to make histgrams for the rest of your life. We also used my blockerr program to find the mean and error in the mean from a file with numbers. This code is also in src and you are welcome to copy and use it as you like. The options for hist are described in the comments at the top of hist.c: /* Make histogram of a list of data * * option -n specifies number of bins * * option -s specifies size of bin * * option -x specifies lower and upper limits of histogram * * option -g specifies output in form suitable for "graph" * * or "axis" * * if -g 1 we get a full bar for each bin * * if -g 2 the bars don't go down to the origin * * option -m specifies the line type for use with "axis" * hist takes it input from the stardard input. It will also take 10 bins by default. So, if you have file of number called file, hist infinity and e determines the size of the error. Considering samples sizes n and n-1, it is easy to solve for A. A = n S_n - (n-1) S_{n-1}