Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede Monte Crlo Methods/Technques: These re mong the most powerful tools for dt nlss nd smulton of eperments. The growth of ther mportnce s closel ted to dvnces n computer memor sze nd speed. We wll defne Monte Crlo technque s one whch mes use of rndom numbers n order to solve problem. The computtonl technques tht re most useful to phscsts re usull smulton nd ntegrton. (There s lttle dstncton between them!) These technques m be ppled to problems of both sttstcl nd determnstc nture. Hstorcll, the frst lrge-scle use of MC smulton ws ssocted wth studes of neutron sctterng nd bsorpton, whch re rndom/stochstc processes. Rndom numbers were used to generte populton,.e. smple of neutron sctterng events, whch ws ntended to mmc rel events. Then phscs prmeters such s bsorpton lengths were estmted from the MC events just s f the hd been collected n rel eperment. Of course, n rel eperment one cnnot see n detl the behvor of ndvdul neutrons n medum, whle n MC eperment, the mcroscopc behvor s wht s beng smulted. The ngredents of such MC method re neutron-nucleus (or nucleon) cross sectons, mcroscopc nd mcroscopc propertes of the medum, etc. (n.b. In prncple, gven these sme nput prmeters, the results could lso hve been obtned nltcll b ver comple mult-dmensonl ntegrls,.e. determnstcll.) The Bss for Monte Crlo Integrton: Consder contnuous, rel, sngle-vlued functon f ( ) defned (t lest) on the ntervl. Let us smple the functon b obtnng the vlues f ( ) f ( ) f ( ),,,,,, where re rndoml drwn from the unform dstrbuton on tht ntervl,.e. (,) = We determne the smple men: f f ( ) U. The Lw of Lrge umbers ss tht under certn condtons : lm f E[ f ( ) ] = fˆ on the ntervl. Ths cn be wrtten s: lm = ( ) ( ) f f d The epresson on the LHS of ths relton s clled the Monte Crlo estmte of the Integrl. It converges to the correct (nltc) vlue s provded tht the certn condtons hold: f ( ) must be ntegrble. f ( ) must be everwhere fnte. f ( ) must be t lest pecewse contnuous. Of course, n rel MC clculton wll remn fnte, ts mmum sze s determned b the vlble computer tme nd CPU speed. P598AEM Lecture otes 6
Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede We often csull cll f the Monte Crlo Integrl. Techncll/formll-speng, t s the MC ntegrl estmte of the ntegrl f ( ) d. The convergence of the Monte Crlo estmte lm f ( ) of the ntegrl ( ) = m be fst or slow, dependng on the nture of the functon f ( ). The convergence s, f d however, sttstcl,.e. for ver lrge (but fnte) we cn occsonll hve lrge fluctutons of f bout ˆf. Ths mens tht f ˆ f < δ onl wth some probblt. Fnll, the Centrl Lmt Theorem tell us tht the smple men f wll be (ppromtel) Gussn/normll-dstrbuted for lrge. Generlzton: Suppose nsted of the ntervl (, ) we re nterested n the ntervl (, ) where the b lm f ( ) f ( ) d b = re rndoml drwn from the unform dstrbuton (, ) U b. b. Then: If we lred hve vlble source of rndom numbers r whch re unforml dstrbuted on the ntervl (, ), we cn smpl me chnge vrbles: = + ( b ) r to obtn rndom numbers whch re unforml dstrbuted on the ntervl ( b, ), s shown n the fgure below: b Clerl, ths s lner -to- mppng of the ntervl (, ) onto the ntervl (, ) More formll, let f ( r ) be the P.D.F. of r (.e. U (,) ). Let ( ) Then: g ( ) d = f ( r) dr nd: g( ) = f ( r) Snce = + ( b ) r, then: g( ) b r r b. g be the P.D.F. of. d dr =. Ths s ( ) b U, b. It s constnt, nd ( ) g d=. P598AEM Lecture otes 6
Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede Propertes of the Monte Crlo Integrl estmte f : If the vrnce f ( ) = of f ( ) s fnte, then the MC ntegrl estmte f f ( ) s consstent,.e. t converges to the true vlue E[ f ( ) ] fˆ = = for ver lrge. The MC ntegrl estmte f f ( ) s unbsed for ll,.e. E[ f ( ) ] fˆ We hve lred seen ths propert of smple mens. The MC ntegrl estmte f f ( ) The stndrd devton f = =. s (smptotcll) Gussn/normll-dstrbuted. = of the MC ntegrl estmte f f ( ) f s: = f Ths s true for ll, but t s useful onl when the smple sze s lrge enough tht the MC ntegrl estmte s Gussn/normll-dstrbuted. An Emple of the MC Integrl Estmte - Buffon s eedle: The erlest (?) documented MC clculton ws reported b Georges-Lous LeClerc, Comte de Buffon n Ess d Arthmetque Morle (777) nd ws used to clculte the vlue of. The prncple of Buffon s method ws: -- Devse n eperment where the sttstcl probblt p of the eperment s outcome nvolved. #of successes -- Do the eperment, nd estmte the verge probblt s p =. totl #of trls -- The conceptul eperment Buffon cme up wth conssted of rndoml (n poston nd ngle) tossng needles of length d onto grd of prllel lnes tht re lso seprted b dstnce d. The verge per-trl probblt of ht needle ntersectng one of the prllel lnes (see fgure below) cn be shown to be p = : ( ) d θ mss ht All needles hve length d: Consder needle wth gven θ (= ngle between the needle nd the norml to grd lne, s shown n the bove fgure). The component of the length d of the needle perpendculr to the grd lne s d cosθ, thus the probblt tht lne wll be crossed (.e. ntersected) b needle s: p( θ ) d cosθ d cosθ of p ( θ ) over mn trls. ote tht there s no dependence on the poston of the needle, just ts ngulr orentton. = =. The verge per-trl probblt p wll be the verge P598AEM Lecture otes 6 3
Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede Snce θ s unforml (.e. rndoml) dstrbuted over the ngulr ntervl (, ), nd snce p ( θ ) = cosθ, t s therefore suffcent to verge over just the reduced ntervl (, ). Then: cosθ dθ cosθdθ θ ( ) p cosθ = = = sn = = ( ) When we estmte probblt b the rto of hts to tres usng MC methods, we cll tht the Ht-Or-Mss Monte Crlo. Ths method s generll the lest effcent mens of estmton,.e t hs lrger vrnce for gven thn n other MC method. It lso s tpcll much more CPU tme ntensve, computtonll. Let us clculte the vrnce of our estmte of s obtned b ths method: For our needle-throwng eperment, the frequenc of success s defned s: p = = #successes (n.b. = mens s estmted b ). totl# trls Snce the verge per-trl probblt of needle httng lne on the grd s p = =.637 (n.b. p s not smll!) then the verge per-trl probblt of needle mssng the prllel lnes on the grd s q p = =.637 =.363. Thus, we relze tht sttstcll, the needle ht-or-mss eperment obes bnoml probblt dstrbuton:!! P( ;, p) = p q = p p!!!! ( ) ( ) wth epectton vlue for successes n trls of: ( ) ˆ! E[ ] = P( ;, p) = p ( p) = p = =! ( )! The vrnce of s: ( ) = E ( E ) = pq= p( p) vr [ ] [ ] Hence the -sgm stndrd devton of s: ( ) pq p( p) = vr = = However, here n ths stuton we re nterested n the frequenc of success whch we clled f. (n.b. do not confuse ths wth the smple men of the MC ntegrton process!!!) It ws shown bove tht f = frequenc of success ( ) ( ) ( ), hence for fed totl # of trls : f = = pq = p p = =.637.363.48 {here} P598AEM Lecture otes 6 4
Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede Of course, f we pretend tht we don t pror now to better thn 3.4, or /7 {or the Indn Stte Legslture s vlue of ( 3) }, or... we get slghtl dfferent vlue for f. However, the conclusons won t chnge. Fnll, snce = f, the vrnce of our MC ntegrl estmte of s: or: 4 f = f = f = 4 f f f ( ) ( ) ( ) p p = = = = = f.37 f f If we clculted v Buffon s method, we d get -stndrd devton uncertntes of,,,.37.37.37 e.g. fter totl of,, needle throws, we d hve determned = 3.46 ±.4. Clerl, ths s not n es/ccurte w to clculte. And even f we could me gzllons of throws, we would need to worr bout phscl bses n the epermentl method e.g. lc of perfect rndomness n the throw of ech needle... We cn estmte usng nother MC technque: the Crude Monte Crlo,.e. the estmton of n ntegrl b sum: Snce: cosθdθ =, then: = cosθdθ cosθ cosθ where the verge of cosθ s ten over the ntervl (, ) We cn estmte cosθ cosθ b the smple men. If we drw rndom vlues of θ from the unform dstrbuton (, ) U nd defne: z cosθ, then: = lm z lm cosθ = (n.b. Ths s ctull rell sll, snce we need to now n order to get the dstrbuton, but... ) Ths s n unbsed estmte, snce: z cosθ = = = = = P598AEM Lecture otes 6 5
Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede et, we clculte the vrnce of z from z z : z z = cosθ cosθ j = cos cos cos θ + θ θ j = j= = j= j= j = z = + = + cos θ cos cos θ θ j = j= j= j = = j= j= j = How mn terms do we hve n ech of these sums? Consder the cse for = 4: j We see tht there re terms wth = j nd = ( ) terms wth j 4 4 4 z = + ( ) = + Thus: 4 4 4 z z = + = + z 4 4 4 = z = = 4.38 z Fnll:.5 = Z compred to:.37 for the Ht-or-Mss MC. Ths s generl result: the Crude MC s lws more effcent thn the Ht-or-Mss MC. P598AEM Lecture otes 6 6
Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede We cn now determne the vrnce on n MC ntegrl estmte: Let: I f ( ). Then: I f ( ) = f ( ) =. = Also: I f f = f + f j = j= ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) f ( ) f f I I ( ) ( ) ( ) I f f f = + = Thus: I = f ( ) or: I = f ( ). We see tht we cn lws decrese ncrese b fctor of n order to decrese the stndrd devton estmte b fctor of. I b ncresng, but t s slow process. must I of the MC ntegrl However, there re some trcs tht enble us to decrese I even more, whch nvolve modfng the functon f ( ). For emple, suppose f ( ) = g( ) + h( ), nd we lso now nltcll tht: ( ) g d (= number). Then f h( ) s smll,.e. hs smller vrnce thn f ( ) cn be comprble to g( ) s) then the estmte of the MC ntegrl wll converge much fster! = G (whose vrnce ote tht there s n entre culture devoted to fndng trcs nd developng technques for mprovng the convergence of the estmtes of MC ntegrls. We wll not pursue them... If we need to crr out -dmensonl ntegrton, there s no problem n dong t b MC methods. However, there re usull (dependng on f ( ) ) more effcent computtonl/ numercl methods thn MC. On the other hnd, for problems nvolvng d-dmensonl ntegrtons, t s not so cler tht the MC pproch s less effcent. For emple, f we tbulte the -sgm uncertnt n the estmte of the MC ntegrl s functon of the number of ponts, (.e. evlutons of the functon tht one must perform), comprng s for -dmensonl vs. d-dmensonl ntegrls: uncertnt of ntegrl for: -dmenson: d-dmensons: MC: Trpezodl rule: Smpson s rule: 4 Guss rule: m d 4 d ( m ) (n.b. n the lst row, m s the order, e.g. 6 ponts, 3 ponts, etc.) d P598AEM Lecture otes 6 7
Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede Sooner or lter, for d lrge, the MC ntegrton method wll converge fster thn the other f s not well-enough behved to numercl methods. In rel lfe, oftentmes the functon ( ) relbl use the other numercl ntegrton technques, whle the MC ntegrton method demnds f {other thn stted on p. of these Lect. otes}. reltvel ver lttle from the functon ( ) How do we crr out obtnng estmtes of MC ntegrls n d-dmensons? In -dmenson, we hve lred seen tht: b b ( ) f d = (s estmted b) f ( ) = where s drwn from U(, b ) In -dmensons, the procedure s ver smple f the regon of ntegrton s rectngulr: d b d c d b (, ) f dd = f (, ) c = c b where nd numbers; re pr of ndependent rndom s drwn from (, ) drwn from U( c, d ). U b nd s It s strghtforwrd to generlze ths method for the cse of rectngulr regon n d-dmensons. In -dmensons, the regon of ntegrton often m be more comple, for emple bounded g, = C, s shown n the fgure below: b contour ( ) m g(, ) = C mn m mn Here, we wll hve to scrfce some effcenc n the MC ntegrton method. We fnd rectngle bounded b mn, m, mn, m tht entrel (but just brel) encloses the contour g(, ) = C. P598AEM Lecture otes 6 8
Fll Anlss of Epermentl Mesurements B. Esensten/rev. S. Errede We then unforml populte the rectngle wth rndom pont prs (, ), wth drwn from (, ) drwn from U(, ). We then test ech rndom pont pr (, ) U mn m nd mn to see f t les wthn the contour C. If t does, we eep t. If not, we go on to the net pr. Clerl the ept pont prs (, ) bounded b the contour g(, ) = C. m wll be rndoml unforml dstrbuted over the re The penlt n effcentl genertng rndom pont prs (, ) choosng the smllest possble rectngle contnng the contour g(, ) Agn, ths method cn be generlzed to d-dmensonl MC ntegrton. A generl comment: wll clerl be mnmzed b = C. In mn-dmensonl MC ntegrl t s etremel es to set up the MC ntegrton procedure. However, there s n dvntge to nltcll dong s much of the ntegrton s possble, snce then the ponts wll go further n the remnng dmensons, thus helpng to reduce the overll computton tme For emple, f we need to use = 6 ponts n 6-dmensonl MC ntegrl, we re effectvel spredng (onl!) ponts long ech of the s es. If, however, we could ntegrte out three of the vrbles, then we would get comprble ccurc wth onl 3 ponts nd the clculton would requre / th of the computer tme! P598AEM Lecture otes 6 9