How does the Monte Carlo method work? Oleg Yavoruk Abstract The paper describes the practical work for students visually clarifying the mechanism of the Monte Carlo method applying to approximating the value of Pi. Considering a traditional quadrant (circular sector) inscribed in a square, here we demonstrate the original algorithm for generating random points on the paper: you should arbitrarily tear up a paper blank to small pieces (the first experiment). By the similar way the second experiment (with a preliminary staining procedure by bright colors) can be used to prove the quadratic dependence of the area of a circle on its radius. Manipulations with tearing up a paper as a random sampling algorithm can be applied for solving other teaching problems in physics. Keywords: Monte Carlo method, practical work in physics, teaching physics, Pi, numerical methods 1 Introduction Monte Carlo is one of Europe's leading tourist resorts, an administrative area of the Principality of Monaco where the famous Monte Carlo Casino is located. A group of numerical methods using random processes has the same name. This term was suggested by Nicholas Metropolis directly bearing in mind his relative who was very passionate about gambling: the most reliable random number generator is roulette exactly, a kind of gambling. The first description of this method appeared in 1949 [1]. Later computers significantly expanded the range of problems that this method solved effectively. Remarkably, it was used to create a thermonuclear weapon in the 1950s. And such a famous and verified numerical method is astoundingly not mentioned in the traditional school and university physics courses. Its fields of application are a technique for numerical integration, solving of algebraic linear and nonlinear equations, differential and integral equations, modeling of natural processes. It is used in mechanics, aerodynamics, molecular physics, quantum physics, solid state physics, plasma physics, and astrophysics. Monte Carlo algorithms are a classical tool to demonstrate the time evolution of some processes occurring in nature, to analyze physical systems [2], to calculate moments of inertia [3], to simulate a rainbow [4], to show statistical fluctuations of the radioactive decay [5]. A Monte Carlo method is used to illustrate some of the principles of statistical mechanics: the concepts of ensembles, statistical averages, fluctuations [6], diffusion [7]. This method has shown reliability beyond physics: in mathematical finance, the calculation of risks in business, engineering problems, computational biology, computer graphics, applied statistics, artificial intelligence and even modern weather forecasting. Sometimes it is the unique method for solving a problem in a reasonable time [8, 9, 10, 11]. Versions of this method have long been used in sociology, political science, logic, linguistics, psychology and pedagogy [12, 13, 14]. In our lab we should figure out the mechanism of this method on a very simple example. The first experiment is devoted to calculating the number π with random tests. In the second experiment we are going to prove the formula A=π∙R2 (quadratic dependence of the area of a circle on the radius). Experiments can be carried out in any order, as well as independently from each other. 2 What is Pi? The number π (Pi) is a mathematical constant, the ratio of the circumference of a circle to its diameter. Pi is infinite decimal. The number π is important not only to mathematicians; it plays a big role in various branches of physics (the body rotation, oscillations and waves, physics of light, atomic and nuclear physics, quantum mechanics, elementary particle physics, etc.) [15, 16]. In practice, we only need to know a few first decimal digits, but sometimes we need more accuracy [17]. However, for most cosmological calculations, 39-40 digits are enough, because it is the accuracy needed to calculate the circumference of the Observable Universe with an accuracy of an atom. Value π = 3.141592653589793, rounded to 15 characters, NASA uses for the planetary navigation problems [18]. There are various ways to calculate the number π: geometrical, numerical, analytical, experimental, computer [19]. And there are algorithms based on the Monte Carlo method, related to: throwing a needle on a lined paper, so called the Buffon Method [20, 21], shooting with a rifle shot [22], throwing darts [23, 24], etc. But we are going to perform a version based on a comparison of the areas of a circle and a square, exploiting another practical algorithm for obtaining the results of random tests: manipulations with tearing up a paper. Experiment 1. Calculation of Pi The general technique of Monte Carlo simulations described in several papers [25, 26, 27, 28]. Suppose we have a flat figure (it is a circle in our case) with the area A0 which we need to find. Restrict it to another figure with the area A1 (in our case it's a square). Thus we draw a circle inscribed in a square (Figure 1a). 2 The area of the square A1 = d , d is a side of the square. Diameter of our circle 2 equals to the side of a square. The area A0 of a circle is π∙R . Diameter d = 2∙R. And 2 then A0 = π ∙ d /4. The ratio of the areas of a circle and a square is: The essence of the Monte Carlo method is very simple. If we allocate points randomly within a square (Figure 1b), the ratio of the areas of a circle and a square is equal to the ratio of the number of points N0 (that fall into a circle) and the total number of points N1: The larger the area, the more points it gets. 3 1a 1b 1c Figure 1 (a, b, c) In addition, the ratio of the areas will not change if the object is cut into four equal parts (Figure 1c). We can divide our drawing into four parts (quadrants) as shown in the figure. And now we have the opportunity to conduct four tests using only one blank. 2a 2b Figure 2 (a, b) This is a wonderful gift: we can conduct four tests (Figures 2a and 2b) with one drawing. Of course, we can do more tests. The Appendix 1 (at the end of the paper) presents the blank with five tests. Based on the above reasoning about the number of randomly distributed points inside the figures, we see that with a large number of tests the number π is equal π= ∙ , N0 - the number of points inside the circle, N1 - the number of points inside the square (including the circle). The next question is: how to randomly arrange the points inside a square containing an inscribed circle? Of course modern computers can help us to generate random coordinates. But here are opportunities for fans of natural experiments: scattering rice grains on the drawn square; random distributions of small coins or buttons; 4 raindrops on a paper sheet; dart throwing; and even shooting at a target (a square with an inscribed circle) with a shotgun. However, in this lab we are going to use a distinctly visual and pretty simple method. Not a lot of people know about this way. The experimenter paints two areas with radically different colors (the simplest examples are white and black), and then randomly breaks (tears) it up into small pieces. Figure 3a presents the results of this experiment. Now we have two groups of pieces: almost white (from the inside of our circle) and almost black (from the outside of the circle). The total number of pieces: N1, white: N0, black: (N1–N0). Here we are going to carry out four tests. Therefore, we repeat it three times more (Figures 3b, 3c, 3d). The numerous small pieces of paper are assembled as a puzzle only for illustrative purposes and exclusively for this paper (Figure 3). Picking up puzzles is an exciting activity, but it is not mandatory here: it is enough just to count the pieces of paper. If the black and white areas on one piece are approximately equal, it does not matter, should we consider this piece white or black: our experimenter selects one of them. If there are a few such pieces, some of them can be attributed to white, some to black (equal parts), and the last (odd) one to any group. If you are unsure about a last piece, you can just break it in half: it does not matter for a large number of pieces after all. a b c d Figure 3 (a, b, c, d) 5 Then we fill in the table with the results of all four tests; calculate the arithmetic average value <π>, standard interval s and absolute error Δπ. Table 1. The results of the first experiment 2 k N1 N0 |<π> - πk| (<π> - πk) 1 24+7 = 31 24 3.10 0.02 0.0004 2 32+10 = 42 32 3.04 0.08 0.0064 3 31+8 = 39 31 3.18 0.06 0.0036 4 23+6 = 29 23 3.17 0.05 0.0025 k = 4 <π> = 3.12 max ∑(〈 〉 ) 0.0129 There are various ways to estimate measurement uncertainties. For example, this can be done on the basis of a given statistical confidence and the number of tests [29, 30]. We are going to evaluate the measurement error Δπ as follows: t p,N S, Student’s t-factor tp,N (for kmax = 4 and p = 90%) equals 2.35 [31]. The experimental standard deviation S in our case [29]: 2 k S k 0.03 N(N 1) And finally the absolute uncertainty Δπ ≈ 0.08 (the relative uncertainty ε is a little more 2%). The calculated confidence interval: π = 3.12 ± 0.08 (with probability p = 90%).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages17 Page
-
File Size-