You are on page 1of 37
- . — \icotonte I. M. Sobol’ ne = Monte Carlo Method | ‘The University of Chicago Press, Chicago 60637 ‘The University of Chicago Press, Ltd, London f Chicago 1974 ‘of America dard Book Number: 0-226-76749-3 Contents Preface 1, Intros Part 1, Simul 2, Random Variables 3. Generating Random Numbers on a Computer 4. Transformations of Random Variables Part 2, Examples of the Application of the Monte Carlo Method Simulating a Mass-Supply System Cal Simulating the Penetration of Neutrons thro! Evaluating a Definite Integral . Proofs of Certain Propositions ty of Products ‘a Block Appendix Bibliography 18 4 3 39 45 32 8 65 a VI, Preface Some years ago I accepted an n from the Department of Computer Technology at the Public University to deliver two lectures ‘on the Monte Carlo method. These lectures have since been repeated ts have gradually before the first lecture, 1 ience was unfai ity theory, inserted in the lecture a section acquainting my basic concepts of probability. Chapter 2 of this booklet is an outgrowth of that section, id frequency more or Jess correspond to t man's notion of a rand different from the mathematica concept of probability complex concept of @ section cannot replace a course in probal areas that they will encounter problems which can be solved by the Monte Carlo method. The problems considered in the lectures are fairly'simple and have been drawn from diverse fields, Naturally, they cannot encompass vill Preface the areas in which the method can be applied. For example, there is not a word about medicine ies Seeker 7 do enable one to eal has a program for cate he methods of chapter ation dosages in X-ray therapy. If one 1g the absorption of by the various body tissues, itis possible to select the dosage and direction of irradia tion which most effectively ensures that no harm is done to healthy tissues, ‘The present book includes the material read in the lectures. A mote detailed exposition is given of certain examples, and chapter cet and chapter 9 has been 1. Sobol Moscow, 1967 1 Introduction to the Method ‘The Monte Carlo method is a method of approximately solving mathematical and physical problems by the simulation of random quantities. |. The Origin of the Monte Carlo Method accepted birth date of the Monte Carlo method is 1949, led “The Monte Carlo Method" appeared. The icians J. Neyman and S. Ulam are considered its nators. In the Soviet Union, the first articles on the Monte Carlo known, In the nineteenth and early twentieth centuries, statistical problems were some- times solved with the help of random selec Monte Carlo method. Prior to the appearan this method was not widely applicable since the quantities by hand is a very laborious process, the Monte Carlo method as a highly universal numerical techni became possible only with the appearance of computers. Carlo” comes from the city of Monte Carlo in the aco, famous for 1g house. One of the 2 Introduction to the Method Monte Carlo method help one win at roulette?” The answer is that it does not; it is not even an attempt to do so. v Example. In order to make more ] clear to the reader what we are talking about, let us examine a very simple example, Suppose that ed to compute the area of a plane figure S. This may be a com- pletely arbitrary figure with a ar boundary, given graph- ically or analytically, connected or the region be as represented figure 1.1, and let us assume that it ined completely within square, designate the number Fig. 11 Choose at random N poi (of points lying inside 5 by 1 obvious thatthe area of 5 is approximately equal to the ratio N’]N. The preater the N, the ereater the accuracy of this estimate, In the example represented in figure I.1, we selected = 40 points. Of these, W’ = 12 points appeared inside S, The ratio N’/N = 12/40 = 0.30, while the true area of $ is 0.35. 1.2. Two Features of the Monte Carlo Method In our example it would not have been too difficult to calculate direotly the true area of S. In Part II of this book we shall consider some less trivial examples. Our simple method, however, does point out fone feature of the Monte Carlo method, that is, the simple structure of the computational algorithm. T , in general, of a Process for producing a random event. The process is repeated W times, cach trial being independent of the rest, and the results of all the t are averaged together. Because of its ty to the process of per- forming « scientific experiment, the Monte Carlo method is sometimes 3. In practice, the Monte Carlo method isnot used for calculating the area of plane figure. There are other methods for this, whit much greater accuracy. 1e Monte Carlo method shown volume” of s body in many-dimensional Carlo method often proves to be the only te problem, ntroduction to the Method 3 ie le, the random event called the method of statistical srials In our example, t consisted of taking a random point in the square and checking to deter- mine whether it belonged to 5, Is were averaged together by taking the ratio N"/N. ‘A second feature of the method . ‘expect from the calculation is y(DJN), where D is some constant a N the number of trials. In our example, it tums out from proba theory (for proof, see section 2.6) that D=A(l = A) = (0.35}(1 — 0.35) = 0.23, where 4 is the true area of the region S, so y(D/N) = -v(0.23/40) = 0.076. We see that the actual error of the cal mn, 0.05, was not, afer all, unreasonably large. om oul ( ‘D core (2 need be accurate only to 5-107. However, any particular proble be solved by different variations of the Monte Carlo method’ assign different values to D. In many problems, a computational pro- icantly smaller value will considerably accuracy of the result. 1.3. Problems That Can Be Solved by the Monte Carlo Met ‘The Monte Carlo method makes possible the simulation of any process fluenced by random factors. This, however, is not its only use. ‘chance, we can artificially many mathematical problems involving no chance, devise a probabilistic model (frequently several) for solving these prob lems. In fat, his was done inthe example in section I. For these reasons the Monte Carlo method can be considered a universal meth for solving mathematical problems. esha Ns Cink mith 7 the same problem can be solved by used, in view ofthe fact xm Q.3) inwhich science. For example, in mech: 11m, are distributed on the x-axis at the points xy, abscissa of the center of gravity of this tystem is given by 1h Of course, in this ease the sum of al the masses does not necessarily equal unity i ' i i Random Variables ° Let us mention the basic properties of mathematical expectation. If cis any constant, then E(X +) = BX) + ey (24) E(eX) = cE(X). (2.5) If Xand Y are any two random variables, then E(X ++ Y) = E+ EY) 2.6) ‘The number Var (X) = B(X = EY?) an is called the varfance of the random variable X. That is, Var (2) is the mathematical expectation of the squared deviation of the random variable X from its average value E(X). Obviously, Var (X) = 0 always. ‘The mat 2 are the most im- imbers characterizing the random variable X. What is their practical value’? If we observe the variable X/m es and obtain the values 1%q (each of which is equal to one of the numbers 1x), then the arithmetic mean of these numbers will be close HOG Xa cbe tk Xe BOD: 8) nce Var (X) characterizes the spread of these values around the average EX) Formula (27) can be transformed ing formulas (24)-(2.6): Var (X) = B(? — 26(0)-X + (EGO) = B(X8) = 2E(0)- E00) + (ECO? whence Var (X) = E(X%) = (EQ)? It is usually easier in hand computations to fi formula (2.9) than by formula (2.7), 0 Simulating Random Variables Let us menti ance: oe : Ie is any Var (X + 6) = Var(X), (2.10) Var (eX) = e# Var (X). 1 he concept of independence of random variables plays a rol XX, we also watch a random variable ¥. If the di A does not change when we know the value which the variable Yassumes, and vice versa, then itis natural to believe that Xand Ydo not depend on each other. We then say that the random variables X and Y are inde pendent. ‘The following celations hold for independent random variables and ¥: E(XY) = EQ)E(Y), 2.12) Var (X + ¥) = Var(X) + Var (¥). 2.13) Example, Let us consider a random variable X wit 123456 xe : ( beans ) probable, the ie is thrown can be used to real EX) = M+ 243444549235 By formula (2.9), Var (X) = E(x?) — (E(x)? = MP4 24 4 ae SE 6%) — (3.5)? = 2.917. Example. Let us consider the random variable Y with distribution rt) 44 E(Y) = 05-3405-4=35; Var (1) = 0.5(3% + 4°) ~ (2.5) = 025 Random Variables We see that E(Y) = £(X), but Var (¥) < Var (X). This could easily pated, since the values of ¥ ean differ from 3.5 only by ‘£0.5, while for the values of X the spread can reach £2.5. 2.2. Continuous Random Variables Let us assume that some radium is placed at the origin of a coordinate plane, As each atom of radium decays, an «-partice is emitted, We shall describe its direction by the angle (fig. 3) ince both in theory and practice any direction of flight is possible, this random variable can assume any value from 0 to 2, , We shall say that a random variable ¥'is continuous if it ean assume any value in some interval a, b]- ‘A continuous random variable X is the assignment of a function " p(x) to the interval [a,b] containing the ° = possible values of this variable, p(x) is he probability density or density of the random variable X. we prob- integral pe’ 0 are numerical parameters. V1 “4 ‘Simulating Random Variables ‘The parameter a does not affect the shape of the curve p(x): a change ina results only lacement of the curve along the x-axis, How- ever, the shape of the curve does change with a change in ¢, Indeed, itis easy to see that 1 Wi’ max (p()) = pla) = If @ decreases, the max (p(x)) will increase. However, according to ‘area under the curve p(x) is equal to 1. There- upward near x = a, but will decrease for n, one with a= 0, «= 1, and another with a= 0, o= 05. ther normal density is drawn in figure 6.5 below.) It is possible to show that E(Z) =a, Var(Z) = 0, Normal random variables are encountered in the investigation of very diverse problems. For example, an error 8 in measurement is generally a normal random variable. The reason for this will be dis- cussed shortly, If the error in measurement is not systematic, then a= E(8) = 0. And the quantity «= V/Var(8), called the standard deviation of 8, describes the error in the method of measurement, The rule of“ three sigmas.” It is not difficult to determine that for a normal density p, : [ore de~ 09m, 9-08 Se Are a he i 24 Random Variables 1s whatever @ and @ are in (2.19). From (2.14) it follows that Pla 30 0.58 to the value T= 4. ‘Thus, we obtain the values T = 4; 3; 43 3; 4; 4; 3; 3; 433 Note that + %, im the distribution X is arbitrary, he construction. 4.2, The Construction of Continuous Random Variables t we nced fo get values of a random variable X buted over the interval [a, 6] with density p(x). Since in this example the p, are given to two is of G10 the va Transformations of Random Variables a We shall prove that values of X are given by the equation ff p00 a = 6 2) that is, taking each value of G in turn, we must solve equation (4.2) and find the corresponding value of X. For the proof let us examine From the general properties of density (2.15) and (2.16), it follows that H@)=0, yf) =1, and, taking the derivative, ¥'@) = pe) = 0. his means that the function y(x) increases monotonically from Oto 1. Furthermore, almost any curve y = y(x) in one and only one point, the abscissa of which we take a8 X_If we agree to take for values of G lying on “flat spots” on the ‘curve, the value of X corresponding to one of the endpoit spot, then equation (4,2) will always have one and only Fig. 4.4 Fig. 4.5 Now we take an arbitrary interval (c', 6), co points of this interval ined in [a,b]. The gexec! satisfy the va) <¥ < x) oF to possible “flat spots” with ordinates y(a’) and y(). Since the der is zero everywhere on these “flat spots,” they contribute nothing to the probability P(a’ < X < 6’), and therefore (fig. 45), Pa < X There 36 Wn of the Monte Carlo Method Daa put add 1 tho ‘veri counter hash + Se | Toew = og #1 Fig. 52 jing a Mass-Supply Syst 37 In figure 5,2 a flow chart of the program wh he values of my and nt for single the square marked “end of ti It is easy to see that we can use this me results for more complex systems. For exam wr than being fixed, can be different for the v is would correspond to different eq service stall), or a random variable nes. The change is formula for ‘One can also. do not overflow immedi that time, Systems ean also be: by the line which will fi is possible to allow for he density of the demand flow over time, for a 38 Examples of the Application of the Monte Carlo Method OF course, such simulations are not done effortlessly. In order to bain results of any practical value, one must choose a sound model, nd this requires extremely careful study of the actual demand flows, ne-study observations of the work at the various distribution points, and so on In order to study any system of this type, one must know the prob- abilstic principles of the functioning of the various parts ofthe system. n the Monte Carlo method permits the computation of the prob- ing enter le) real experiment, ‘we can conduct experiments on a computer, trying out different methods of job organization and of equipment usage. 6 Calculating the Quality and Reliability of Products 6.1, The Simplest Plan for Quality Calculation Let us examine a product S, made up of (perhaps many) elem For example, S may be a piece of electrical equipment, made of resistors (Re), capacitors (Co), tubes, and the like. We define the quality of the product as the value ofa single output parameter U, which can be com- uted from the parameters of all the elemen U = fReyy Rew +5 Cay Cay eed od .) If, for example, U is the voltage in an operating section of an electric cirouit, then by Ohm's law it is possible to construct eq circuit and, solving them, to find In reality th sa mechanism are never exactly equal to VaR 2 KieRe || indicated values. For example, the resistor eee illustrated in figure 6.1 can test out anywhere Fig. 61 between 20.0 and 23.1 kilohms. ‘What effect do devia- value of U? The question arises tions of the parameters of all these elem« estimated, forit is unlikely that all the parameters will be simultaneously al their worst. ‘Therefore, itis more reas elements and the value of try to estimate its: mathemati to calculate the parameters of al self by the Monte Carlo method and to I expectation E(U) and variance 39 40 Examples of of the Monte Carlo Method Var (U). E(U) mean value of U for all the parts of the show how much deviation of U from E(U) Ibe encountered in practice, Recall (see section 2.2) that, in general, EU) # f(E(Re))s ERs «5 EC), EC), ) le to compute analytically the distribution of complex. Sometimes this can be done The probability distribution of the parameters of each single clement, can be obtained experiment 1B a large lot of suc to be normal. Therefore, according to (2.20), its rare to get a value of @ devia- ting from E(Q) by more than 39 on any one trial). The plan for the calculation is quite simple. For each element a value of its parameter is constructed; then the value of U is computed according to formula (6.1). Repeating the trial times and obtaining values Ui, Us. Uyy we can compute that, approximately, BW) x rd U, 11S aie Var Uy = 4G [5 WH a(S u)" |: For large Vin the ater formula one ean replace the factor 1W — by 1/N, is simple consequence of formulas (2.8) and (2.9). In statistics it has been shown (hat for small NV itis better to keep the factor 1/(W ~ 1). 6.2. Examples of the Calculation of Reliability Suppose we want to estimate how long, on the average, a product will function properly, assu jow the relevant characte tics of each of its componen , the product are difficult to perform, hhave broken down. since one must wait until (6.3) continue to work 1ce of the variable that interests us, Suppose that we have obtained a large number of values Us, Us,» Uy of the random variable U. From these values we can construct the approximate density distribution of U. In the most general cases, this is statistical question. Let us limit ourselves, then, to a concrete example. yose that we have, all together, 120 values Us, Us, .-. Usao of the random variable U, all of them contained in the interval 1 he IF it has, the calculation of the neutron’s trajectory stops, and a 1 is for penetrated particles. Otherwise, we test the If this condition is met, th and a 1 is added to the counter for reflected particles. If this condition also fails, th we neutron has under- gone its (k + the block, and it is necessary to construct the effect of he neutron, Tn acea of G and test the condition for absorp! G< dS. he caleulati trajec- tory stops, and a 1 is added to the counter for absorbed particles. If not, 48 Examples of the Application of the Monte wwe consider that the neutron has undergone a deflection at the point cea Then we generate a new direction of movement Mey. = 26-1 and repeat the cycle once more (using different values of G, of course). All the G are written without subscripts, since each value of G is used once. Up to three values of @ are needed to calculate each jog of values for every trajectory are: xe=0, Mal ave been computed, itis found that N* neutrons rough the block, N'~ have been reflected from it, and N° have been absorbed, Obviously, the desired probabilities are approxi- mately equal to the ratios shown, “The subscript jis the number of the trajectory, and the subscript kis the collision number along the trajectory This computation procedure, although itis very natural, is not perfect. In particular, itis ies p* and p~ by this method when they are very smal precisely the case one encounters in calculating protection against radiation. xd, even these computations are possible. We wi plest variants of calcul 1¢ help of so-called Calculation Using Weights to ial Absorption average number of neutrons in the package which would be absorbed is we3,/, and the number of neutrons undergoing deflection would be, on the average, woS/E- Simulating the Penetration of Neutrons through a Block Input Data Nizw= Naat Weoe= Wa 1 t tou +1 T 0 an eee "eu 1b outpal. end af programe Fig. 73 30 Examples of the Api ication of the Monte Carlo Method Simulating the Penetration of Neutrons duough a Block St for same, For each of simply reduced: since that part of the package absorbed. Now the trajectory can ly called ight of the neutron a packaj isting of wz neutrons, one speaks of a neutron with weight ». wis usual does not conflict wi large package obtained while computing a trajectory contain wy as a common factor. ‘A flow possible to prove,* however, that calculating p* by always more efficient than using the method of section 7.2. weights, but we cannot st that the Monte Carlo cone to solve many cor problems about elementary particles. The medium used can consist of any substance and can have any geometrical structure; the energy of the ion, It is sr miclear processes. of an atom 2, Proof is given in section 9.5, 8 Evaluating a Definite Integral ‘The problems examined in chapters 5, 6, and 7 were probat nature, and to use the Monte Carlo method to solve them s natural. Here a purely mathematical problem is considered: the approxi- ion of a definite integral. equivalent to finding an area, we could use the method of section 1.2. In this chapter, however, we shall present a more effective method, which allows us to construct several probabilistic models for solving the problem by the Monte Carlo method. We shall finally indicate how to choose the best from among all these models, 8.1, The Method of Computation Let us examine a function g(x), defined on the interval as x 0.6750), that is, deviations from the expected value larger and smaller than the probable error 0.675e are equally probable. Let us return to the example in section 8.3. From the values given in tables 8.1 and 8,2, one can approximate the variance Var (#) for both ‘The approximate values of the variance Var (17), the probable errors. the true absolute errors obt 8.3 for both m We sce that 8, really is on the same order as 3, 2. For mel 00: vari = 52% [8 cin or 4 (8 sn | = Fiat - se10 = 025 For mato Var (i) = -0 (55) Aoms- rm = 0016 mals OF 9 Proofs of Certain Propositions h the preceding chapters. We have gathered them together because they seemed to us somewhat cumber- some for a popular presentation or presupposed knowledge of probability theory. My yeots) 9.1, The Justification of ‘Neyman’s Method of Constructing Random Variable (Section 4.3) ‘The random point (H1', H") is uniformly distributed over the rectangle abed (fig. 9.1), the area to Melb — a). (en) is under the curve y = p(x) and ot be discarded is equal to the ratio of the areas Pedy Melb — a) Mab — a) Bl interval a’ wan ~ (9*. all the wy $1 and that 32.0 wage = E(N') = p*, we gel the inequality Var (N') < p* — (p*)* = Var (N). This fact, that the variance of 1" is always less variance of N, nethod of section 7.3 is always better for calculating p* and, if the absorption is not too great, fo the calculation of p® also. 9.6. The Best Choice for V (Section 8.2) section 8.2 we obtained an expression for the variance Var (I). In order to find the minimum of this expression for all possible choices of py(x), we make use of an in well-known in analysis: [ f/ waeeat al sf verde’ veo ar. Proofs of Certain Propositions a We set u = g(x)/v/(po(x)) and v = V/pp(x); wwe obtain ir Let] asf? <[e9 de ff nce ee 28 ie, from this inequality Thus, var) = | { [eG] a] aon 0.) hat the lower bound is reached when p(s) is 0.8) [Tra] [fuera and the variance Var (11) is rel Let us observe that (0 take the is, in practice, impossible. To get necessary to the integral f& | g(2)] dx. But the evaluation oft problem just as difficult as the one we are trying to solve: the eval tion of the integral f% g(x)dx. Therefore, we restricted ourselves to the recommen ed in section 8.2. APPENDIX - Tables Table A. 400 Random Digits B6SIS 9079566155 66434 56558 1233294377 STHOD GO186 03393 42502-99224 BANS —5375B_ NGL RRGT 416864216) 8318134967 3318172658 53807 00607 8652247171 88039 89342 724800082 23IL_—90D16 72587 9300089688 —TRALG «27589 99528 144805961 52452 4249933646 «8393579130 9OKID 45420. TTTS7 7673 97526-27256. GEHAT. «2573137525. 16287 BL 0482522134 GOST 75120 4590475601 7049210274 S7113 84778 45863-24520 «19976 1025. 07824 T6044 E4754 $7616 38132-64294 15218 49286 8957142803 Table B, 88 Normal Values? 02008 1.1922 —00077 00MS 1.0423 1.8149 1.1802 0.0033 1.1609 ~0.6690 —1.5893 0.5816 1.8818 0.7390 015864 0.9245 010904 1.3068 —1.1147 0.2776 01425 0.2863 1.2809 OMDB 0.6379 0.4428 . 7108 28854 0.486 14664 1.6852 0586308374 —0.5337 0.8113 0.2675 1.2496 L152 0.9990 —0.1032 0.4022 0.0083 =0.4428 0.5564 —0.5098 00572 0.5061 =03924 17981 0.6141 08319 04270 —o.8888 09780 0.7679 0.8960 14943. 0.4406 08513 1.1084 07165 018563 1.1630 1.8800 1. Random di (cee section 3. 2. Normal valves i parameters @ = 0, © fate values of « random variable le values ofa normal (gaussian) random variable Z with “ISI * WW patiddy sprepuers Jo neaang yeuoneN “sf, (winjsodiuAs ¥ Jo sduipazooud ay) porayy opin auoxy ut puno} 2q Kew » puv ¢ s1ayduyp uy possnosip sian eu aujnoyised yates Buyjeap jepayeIu autos “6961 “0D TuNySH, ang Aesoy\-uosippy esseyy “Fuspeay -suaygouy odsursy uoynayy pup sapdioing 040 amony “WW. Ata ‘puLgieD pus ‘oworss “ioJuvds, “y961 “09 pute wanynayy :wopuoT “spoyayy oye amoyy 3 “q “quiomspueyy pue “yy “f“fopsowurEH, “(h961 “0D, Funysugng ssisoneg HOA aN) Ses onsen Jo pow aU Sosy sem 40m ares 24,9961 800g WoUNEBI0g HOA MON “a3 "10 49 poresuesy. pOYaAY oLYD MOHY SHE “Y "NK “EpIRNIS pue “9 °A pmoBeag “WT Jogos “1 "a “OxNI|0N “dN “oWUIING “sey ony sy 24 ty punoy 0g 01 ate sony “syooq Hutmolfoy agy of paus9jar st z9pee2 ap Apmis 2 Aydvrsonqrg

You might also like