Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Line: 6 to 6 | ||||||||
This lab is to be completed mostly on a computer. You can use the python tools you installed on your PC or Mac. In this lab there are four related parts all designed to introduce you to Monte Carlo techniques, essential tools in the analysis of data in all modern scientific endeavors, build familiarity with the three basic statistical distributions important in data analysis, and to further your computing skills. | ||||||||
Changed: | ||||||||
< < |
| |||||||
> > |
| |||||||
| ||||||||
Changed: | ||||||||
< < | Please note that while you will work closely with your lab partner you are expected to write your own code and upload it as your first program assignment on Canvas. | |||||||
> > | Please note that while you will work closely with your lab partner you are expected to write your own code and upload it as your first program assignment on Canvas. | |||||||
Changed: | ||||||||
< < | Suggested Reading for this lab:
| |||||||
> > | Suggested Reading for this lab:
| |||||||
| ||||||||
Line: 35 to 35 | ||||||||
Part B. Calculate the Volume of an N-dimensional spheres | ||||||||
Changed: | ||||||||
< < | Modify your program, or write a new one, to determine the volumes of N-dimensional spheres (N=1,2,3,4,5 but you've already done the 2D one) with radius=1.0. Use 10,000 tries and make sure you quote your uncertainties. You should also compare your results with analytic values that you can compute by some other means. Please include the means used to compute the analytic values. | |||||||
> > | Modify your program, or write a new one, to determine the volumes of N-dimensional spheres (N=1,2,3,4,5 but you've already done the 2D one) with radius=1.0. Use 10,000 tries and make sure you quote your uncertainties. You should also compare your results with analytic values that you can compute by some other means. Please include the means used to compute the analytic values. | |||||||
Part C: Generate Poisson deviates, histogram and plot the distributionIn Part C the assignment is to generate a sample of Poisson deviates using Monte Carlo methods, specifically the transformation method. The method depends on the conservation of probabilities which stipulates that a draw from a uniform random distribution is equivalent to a draw from any other distribution, including the Poisson. Symbolically, | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
where is the uniform distribution defined on the interval and is, in this case, the Poisson distribution function, a discrete distribution, | ||||||||
Changed: | ||||||||
< < | ||||||||
> > | ||||||||
Changed: | ||||||||
< < | with x an integer and mean μ. | |||||||
> > | with x an integer and mean μ. | |||||||
Here is how to do it:
| ||||||||
Line: 60 to 60 | ||||||||
You will need as an input parameter the mean of the distribution. You will then histogram the deviates and plot the histograms, include these in your report. Remember that histogram binning is important. If you don't get this right the plots will look funny, either there will be spaces between bins of some bins will be much larger than their neighbors, indicating overflow. Given that you are plotting Poisson distributions that are discrete the bin width is = 1.Please repeat the generation of Poisson deviates 3 times: one with
Part D. Generate and Fit a Gaussian | ||||||||
Changed: | ||||||||
< < | In this exercise, you employ the Monte Carlo technique to generate data distributed as a normal or Gaussian distribution. Then you will fit the generated data sample to a Gaussian Probability Distribution Function (PDF), determine the fit parameters and their errors, and discuss the goodness of the fit via the reduced chi2. | |||||||
> > | In this exercise, you employ the Monte Carlo technique to generate data distributed as a normal or Gaussian distribution. Then you will fit the generated data sample to a Gaussian Probability Distribution Function (PDF), determine the fit parameters and their errors, and discuss the goodness of the fit via the reduced chi2. | |||||||
Changed: | ||||||||
< < | There are many ways to generate a normally distributed set of data. One way is to start off with a uniform (flat) distribution of data points, generated between 0 to 1, and transform them to a normally distributed set of data via the Box-Muller 2D Gaussian transformation described in Bevington and Robinson or here<a href:http://pdg.lbl.gov/2011/reviews/rpp2011-rev-monte-carlo-techniques.pdf > http://pdg.lbl.gov/2011/reviews/rpp2011-rev-monte-carlo-techniques.pdf </a> This clever algorithm is both efficient and easy to implement. There are many sources you can read about it, there is even a Wikipedia article on it. There is an easier way but one I do not want you to use. It turns out that given the usefulness of having random numbers drawn from a Gaussian are, every programming language has normal or Gaussian deviate generators in standard libraries. For example, numerical Python has a built-in normal random number generator in NumPy and probably all other math libraries. Again please do not use a built-in method or any functions that invoke a normal random number generator. The assignment calls for you "coding up" the Box-Muller procedure yourself. | |||||||
> > | There are many ways to generate a normally distributed set of data. One way is to start off with a uniform (flat) distribution of data points, generated between 0 to 1, and transform them to a normally distributed set of data via the Box-Muller 2D Gaussian transformation described in Bevington and Robinson or here<a href:http://pdg.lbl.gov/2011/reviews/rpp2011-rev-monte-carlo-techniques.pdf > http://pdg.lbl.gov/2011/reviews/rpp2011-rev-monte-carlo-techniques.pdf </a> This clever algorithm is both efficient and easy to implement. There are many sources you can read about it, there is even a Wikipedia article on it. There is an easier way but one I do not want you to use. It turns out that given the usefulness of having random numbers drawn from a Gaussian are, every programming language has normal or Gaussian deviate generators in standard libraries. For example, numerical Python has a built-in normal random number generator in NumPy and probably all other math libraries. Again please do not use a built-in method or any functions that invoke a normal random number generator. The assignment calls for you "coding up" the Box-Muller procedure yourself. | |||||||
Here is how to do it:
| ||||||||
Line: 70 to 70 | ||||||||
| ||||||||
Changed: | ||||||||
< < | GradingRubric | |||||||
> > | GradingRubric |