Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Box–Muller transform
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Polar form== {{Main|Marsaglia polar method}} [[Image:BoxMullerTransformUsingPolarCoordinates.png|thumb|400px|Two uniformly distributed values, ''u'' and ''v'' are used to produce the value {{math|1=''s'' = ''R''<sup>2</sup>}}, which is likewise uniformly distributed. The definitions of the sine and cosine are then applied to the basic form of the Box–Muller transform to avoid using trigonometric functions.]] The polar form was first proposed by J. Bell<ref name=Bell68>{{Cite journal | url=http://portal.acm.org/citation.cfm?doid=363397.363547 | doi=10.1145/363397.363547| title=Algorithm 334: Normal random deviates| journal = Communications of the ACM| volume=11| issue=7| pages=498| year=1968| last1=Bell| first1=James R.| doi-access=free}}</ref> and then modified by R. Knop.<ref>{{Cite journal | url=http://portal.acm.org/citation.cfm?doid=362946.362996 | doi=10.1145/362946.362996| title=Remark on algorithm 334 [G5]: Normal random deviates| journal=Communications of the ACM| volume=12| issue=5| pages=281| year=1969| last1=Knop| first1=R.| doi-access=free}}</ref> While several different versions of the polar method have been described, the version of R. Knop will be described here because it is the most widely used, in part due to its inclusion in ''[[Numerical Recipes]]''. A slightly different form is described as "Algorithm P" by D. Knuth in ''[[The Art of Computer Programming]]''.<ref>{{cite book|first1=Donald |last1=Knuth |author-link=Donald Knuth |title=The Art of Computer Programming: Volume 2: Seminumerical Algorithms |year=1998 |page=122 |publisher=Addison-Wesley |isbn=0-201-89684-2}}</ref> Given {{mvar|u}} and {{mvar|v}}, independent and uniformly distributed in the closed interval {{closed-closed|−1, +1}}, set {{math|1=''s'' = ''R''<sup>2</sup> = ''u''<sup>2</sup> + ''v''<sup>2</sup>}}. If {{math|1=''s'' = 0}} or {{math|''s'' ≥ 1}}, discard ''u'' and ''v'', and try another pair {{math|(''u'', ''v'')}}. Because {{mvar|u}} and {{mvar|v}} are uniformly distributed and because only points within the unit circle have been admitted, the values of ''s'' will be uniformly distributed in the open interval {{open-open|0, 1}}, too. The latter can be seen by calculating the cumulative distribution function for ''s'' in the interval {{open-open|0, 1}}. This is the area of a circle with radius <math display="inline"> \sqrt{s}</math>, divided by <math>\pi</math>. From this we find the probability density function to have the constant value 1 on the interval {{open-open|0, 1}}. Equally so, the angle θ divided by <math> 2 \pi</math> is uniformly distributed in the interval {{closed-open|0, 1}} and independent of {{mvar|s}}. We now identify the value of ''s'' with that of ''U''<sub>1</sub> and <math> \theta/(2 \pi)</math> with that of ''U''<sub>2</sub> in the basic form. As shown in the figure, the values of <math> \cos \theta = \cos 2 \pi U_2</math> and <math> \sin \theta = \sin 2 \pi U_2</math> in the basic form can be replaced with the ratios <math>\cos \theta = u/R = u/\sqrt{s}</math> and <math display="inline">\sin \theta = v/R = v/\sqrt{s}</math>, respectively. The advantage is that calculating the trigonometric functions directly can be avoided. This is helpful when trigonometric functions are more expensive to compute than the single division that replaces each one. Just as the basic form produces two standard normal deviates, so does this alternate calculation. <math display="block">z_0 = \sqrt{-2 \ln U_1} \cos(2 \pi U_2) = \sqrt{-2 \ln s} \left( \frac{u}{\sqrt{s}}\right) = u \cdot \sqrt{\frac{-2 \ln s}{s}}</math> and <math display="block">z_1 = \sqrt{-2 \ln U_1} \sin(2 \pi U_2) = \sqrt{-2 \ln s} \left( \frac{v}{\sqrt{s}}\right) = v \cdot \sqrt{\frac{-2 \ln s}{s}}.</math>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Box–Muller transform
(section)
Add topic