Professional Documents
Culture Documents
Computational Physics I: (Pseudo) Randomness
Computational Physics I: (Pseudo) Randomness
Computational Physics I: (Pseudo) Randomness
(Pseudo) Randomness
Comp Phys 1 1
Random Numbers
Many uses in Computation Physics Simulating random processes Repetition of experiment for error analysis Study random effects on obser!ed data (resolution smearing" inefficiencies" acceptance" etc) X Calculating statistical expectations iS e Monte Carlo Integration paths #M (#$%) &' $eynman(s sum o!er paths < >= X ))) eiS
paths
Pseudo Randomness
Computers are deterministic machines" so generally spea*ing they don(t do anything randomly (except for hard&are failures+)
Comp Phys 1
Pseudo Randomness
Pseudo,random numbers are se-uences that appear random based on common statistical tests) %hey are fully deterministic" since the se-uence is &ell defined" e)g) ri.f(ri,/) 0y choosing different starting points in the series (seeds)" a good se-uence &ill generate (to a good approximation) uncorrelated se-uences of numbers)
Comp Phys 1
Randomness
1 typical test of randomness" for se-uence r/" r2" r3" ))) e)g) $or uniform random numbers in 45"/) r = 0:5 $or ri and r6 uncorrelated" i+.6
N X 1 lim ri N !1 N i=1
Randomness
e)g) 2 test of randomness" for se-uence r/" r2" r3" ))) $or uniform random numbers in 45"/)" moments satisfy7
/55 e!ents'trial
/555 e!ents'trial
/5"555 e!ents'trial
Comp Phys 1
H (x)
Comp Phys 1
ri (ari1 + c) mod M
Rhere M"c are chosen to be relatively primeJ" optimal choice of a to maximiLe period depends on M) %o get uniform numbers in 45"/)" di!ide result by M) %he seed is the first r !alue used to start the se-uence) Se-uence is deterministic" so same seed may be used to reproduce a particular run to debug code) %ypically use cloc*,time or seed list to ensure independent runs) JNo common di!isors" except /
Comp Phys 1 11
Comp Phys 1
13
R1N8TM)TRM offers true random numbers to anyone on the Internet) %he randomness comes from atmospheric noise, &hich for many purposes is better than the pseudo,random number algorithms typically used in computer programs)
Comp Phys 1
14
Radioacti!e decay
Shot Noise
https7''my&ebspace)&isc)edu'lnmaurer'&eb'minirng'minirng)html
Comp Phys 1
15
Note7 it(s non,tri!ial tri!ial to implement true randomness" noise may &ell be pin* instead of &hite+ <ard&are de!ices ha!e speed limitations) <o& many random numbers do you need per second= Might be difficult to *eep up &' computations))) Mood pseudo random se-uences are sufficient for many problems)
Comp Phys 1
16