November 16, 2006---Class 22---Metropolis Method, Autocorrelations Activities: Metropolis Method ----------------- Another interesting method was developed by Metropolis, Rosenbluth, Rosenbluth, Teller and Teller. It can be used to generate a random walk that has the desired probability distibution. The key idea is that we take the current value of x, take a random trial step, and then test the new point's probability. If it is more probable, we accept the new point. If it less probable, we accept it with probability p(x_trial)/p(x). In the next class a C code will be shown to the class that accomplishes this. The method is discussed in CSM section 11.7, starting on page 435. The Metropolis method is regarded as one of the 10 greatest numerical methods developed in the 20th century. It's use is quite widespread. It is not a particularly good method for generating gaussian random numbers, but we can learn a lot about the method, its efficiency and data analysis by studing the method in this very simple context. I displayed the code to implement the metropolis method and showed how detailed balance is achieved by the algorithm. Because this is such an important method, it is important for me that you implement it yourself on the next homework assignment. Let's explore the efficiency of this method which often goes by the name Monte Carlo because of the prominence of random numbers. Metropolis Optimization ----------------------- Time history, histogram Create some numbers with the command metropolis 1 5000 0.2 >data This should create a run with 5000 numbers of a Gaussian with width 1. A maximum step size of +- 0.2 is used. Create the time history with the command axis a >! autocorr.dat end The shell will give you continuation prompts for the second and third lines since you have started a foreach loop. The >>! will make sure the shell does not complain about appending to a file that does not yet exist, if (like me) you like to set the noclobber variable. Your file autocorr.dat will now have 210 lines in it from each of the ten runs of the autocorr program. If you type axis y l x 0 19