Difference: MonteCarloLab (18 vs. 19)

Revision 192021-01-06 - JorgeRodriguez

Line: 1 to 1
 
META TOPICPARENT name="PHY4821L"
-- JorgeRodriguez - 2012-01-09
Line: 35 to 36
 

Part B. Calculate the Volume of an N-dimensional spheres

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.

Added:
>
>

Part C: Generate Poisson deviates, histogram and plot the distribution

In 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,

LaTeX: \int_{0}^r{u(r)dr} =\int_0^x{P(x)dx}

where LaTeX: u(r) is the uniform distribution defined on the interval LaTeX: [0,1]and LaTeX: P(x)is, in this case, the Poisson distribution function, a discrete distribution,

LaTeX: P(x) =\sum\limits_{x=0}^x\frac{\mu^x}{x!}e^{-\mu},

with x an integer and mean LaTeX: \muμ.

Here is how to do it:

  1. draw a random number LaTeX: rr from a uniform distribution by calling the random() function
  2. now compute the Poisson probability, the argument of the summation above, for integers LaTeX: xx starting at 0 and continuing on to some n. Each time add terms to form the summation as required by the equality above.
  3. Compare the summation as the integers increase and compare to the random number LaTeX: rr drawn from the uniform distribution above.
  4. Once you have a summation that is greater than the LaTeX: rr, which corresponds to the LHS, write the integer in the previous iteration LaTeX: xx into a table and that will be your Poisson deviate that corresponds to LaTeX: rr,
The prescription above is a computational evaluation of the above equation to determine the variable LaTeX: xx which is the Poisson deviate.

Repeat this process N = 10,000 times to obtain 10,000 Poisson deviates.

You will need as an input parameter the mean LaTeX: \mu 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 LaTeX: \mu = 1.0, \mu = 10.3 \text{   and   } \mu = 102.1.

 

Part D. Generate and Fit a Gaussian

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.

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback