Rectifier: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Snaily
Rectifiers are inherently non-linear. This limits the applicability of these expressions, which should be made explicitly clear. I assume the source does, somewhere.
Line 1: Line 1:
The '''Box–Muller transform''' (by [[George E. P. Box|George Edward Pelham Box]] and Mervin Edgar Muller 1958)<ref>[http://projecteuclid.org/DPubS/Repository/1.0/Disseminate?view=body&id=pdf_1&handle=euclid.aoms/1177706645 G. E. P. Box and Mervin E. Muller, ''A Note on the Generation of Random Normal Deviates'', The Annals of Mathematical Statistics (1958), Vol. 29, No. 2 pp. 610&ndash;611]</ref> is a [[pseudo-random number sampling]] method for generating pairs of [[statistical independence|independent]], standard, [[normal distribution|normally distributed]] (zero [[expected value|expectation]], unit [[variance]]) [[random number]]s, given a source of [[Uniform distribution (continuous)|uniformly distributed]] random numbers.
I'm Jestine and was born on 22 January 1984. My hobbies are Air sports and Games Club - Dungeons and Dragons, Monopoly, Etc..<br><br>Also visit my webpage :: [http://www.primaboinca.com/view_profile.php?userid=2928496 How To Get Free Fifa 15 Coins]
 
It is commonly expressed in two forms. The basic form as given by Box and Muller takes two samples from the uniform distribution on the interval <nowiki>(0,&nbsp;1]</nowiki> and maps them to two standard, normally distributed samples.  The polar form takes two samples from a different interval, [&minus;1,&nbsp;+1], and maps them to two normally distributed samples without the use of sine or cosine functions.
 
The Box–Muller transform was developed as a more computationally efficient alternative to the [[inverse transform sampling method]].<ref>Kloeden and Platen, ''Numerical Solutions of Stochastic Differential Equations'', pp.&nbsp;11&ndash;12</ref> The [[Ziggurat algorithm]] gives an even more efficient method{{Citation needed|date=September 2011}}.
 
== Basic form ==
Suppose ''U''<sub>1</sub> and ''U''<sub>2</sub> are independent [[random variable]]s that are [[uniform distribution (continuous)|uniformly distributed]] in the [[Interval (mathematics)|interval]] <nowiki>(0,&nbsp;1]</nowiki>. Let
 
:<math>Z_0 = R \cos(\Theta) =\sqrt{-2 \ln U_1} \cos(2 \pi U_2)\,</math>
 
and  
 
:<math>Z_1 = R \sin(\Theta) = \sqrt{-2 \ln U_1} \sin(2 \pi U_2).\,</math>
 
Then ''Z''<sub>0</sub> and ''Z''<sub>1</sub> are [[statistical independence|independent]] random variables with a [[standard normal distribution]].
 
The derivation<ref>Sheldon Ross, ''A First Course in Probability'', (2002), pp.&nbsp;279&ndash;81</ref> is based on the fact that, in a two-dimensional Cartesian system where X and Y coordinates are described by two independent and normally distributed random variables, the random variables for ''R''<sup>2</sup> and Θ (shown above) in the corresponding polar coordinates are also independent and can be expressed as
 
:<math>R^2 = -2\cdot\ln U_1\,</math>
 
and
 
:<math>\Theta = 2\pi U_2. \,</math>
 
Because ''R''<sup>2</sup> is the square of the norm of the standard [[bivariate normal]] variable (X, Y), it has the [[chi-squared distribution]] with two degrees of freedom. In the special case of two degrees of freedom, the chi-squared distribution coincides with the [[exponential distribution]], and the equation for ''R''<sup>2</sup> above is a simple way of generating the required exponential variate.
 
== Polar form ==
{{main|Marsaglia polar method}}
[[Image:BoxMullerTransformUsingPolarCoordinates.png|thumb|400px|Two uniformly distributed values, ''u'' and ''v'' are used to produce the value ''s''&nbsp;=&nbsp;''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 in order to avoid using trigonometric functions.]] The polar form was first proposed by J. Bell<ref>[http://portal.acm.org/citation.cfm?doid=363397.363547 J. Bell: 'Algorithm 334: Normal random deviates', Communications of the ACM, vol. 11, No. 7. 1968]</ref> and then modified by R. Knop.<ref>[http://portal.acm.org/citation.cfm?doid=362946.362996 R. Knopp: 'Remark on algorithm 334 &#91;G5&#93;: normal random deviates', Communications of the ACM, vol. 12, No. 5. 1969]</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]].
 
Given ''u'' and ''v'', independent and uniformly distributed in the closed interval [&minus;1,&nbsp;+1], set ''s''&nbsp;=&nbsp;''R''<sup>2</sup>&nbsp;=&nbsp;''u''<sup>2</sup>&nbsp;+&nbsp;''v''<sup>2</sup>. (Clearly {{nobr|<math>\scriptstyle R = \sqrt{s}</math>.)}}  If ''s''&nbsp;=&nbsp;0 or ''s''&nbsp;≥&nbsp;1, throw ''u'' and ''v'' away and try another pair (''u'',&nbsp;''v'').  Because ''u'' and ''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 (0,&nbsp;1), too.  The latter can be seen by calculating the cumulative distribution function for ''s'' in the interval (0,&nbsp;1).  This is the area of a circle with radius <math>\scriptstyle \sqrt{s}</math>, divided by <math>\scriptstyle\pi</math>. From this we find the probability density function to have the constant value 1 on the interval (0,&nbsp;1). Equally so, the angle θ divided by <math>\scriptstyle 2 \pi</math> is uniformly distributed in the interval [0,&nbsp;1) and independent of ''s''.
 
We now identify the value of ''s'' with that of ''U''<sub>1</sub> and <math>\scriptstyle \theta/(2 \pi)</math> with that of ''U''<sub>2</sub> in the basic form.  As shown in the figure, the values of <math>\scriptstyle \cos \theta = \cos 2 \pi U_2</math> and <math>\scriptstyle \sin \theta = \sin 2 \pi U_2</math> in the basic form can be replaced with the ratios <math>\scriptstyle\cos \theta = u/R = u/\sqrt{s}</math> and <math>\scriptstyle\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>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>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>
 
==Contrasting the two forms==
 
The polar method differs from the basic method in that it is a type of [[rejection sampling]].  It throws away some generated random numbers, but it is typically faster than the basic method because it is simpler to compute (provided that the random number generator is relatively fast) and is more numerically robust.<ref name="Carter">[ftp://ftp.taygeta.com/pub/publications/randnum.tar.Z Everett F. Carter, Jr., ''The Generation and Application of Random Numbers'', Forth Dimensions (1994), Vol. 16, No. 1 & 2.]</ref>  It avoids the use of trigonometric functions, which are comparatively expensive in many computing environments{{Citation needed|date=September 2011}}.  It throws away 1&nbsp;&minus;&nbsp;π/4&nbsp;≈&nbsp;21.46% of the total input uniformly distributed random number pairs generated, i.e. throws away 4/π&nbsp;&minus;&nbsp;1&nbsp;≈&nbsp;27.32% uniformly distributed random number pairs per [[normal distribution|Gaussian]] random number pair generated, requiring 4/π&nbsp;≈&nbsp;1.2732 input random numbers per output random number.
 
The basic form requires two multiplications, 1/2 logarithm, 1/2 square root, and one trigonometric function for each normal variate.<ref>Note that the evaluation of 2''&pi;U''<sub>1</sub> is counted as a single multiplication because the value of 2''&pi;'' can be computed in advance and used repeatedly.</ref> On some processors, the cosine and sine of the same argument can be calculated in parallel using a single instruction. Notably for Intel-based machines, one can use the fsincos assembler instruction or the expi instruction (usually available from C as an [[intrinsic function]]), to calculate complex
 
: <math>\mathrm{exp}(iz) = e^{i z} = \cos(z) + i \sin(z), \, </math>
 
and just separate the real and imaginary parts.
 
The polar form requires 3/2 multiplications, 1/2 logarithm, 1/2 square root, and 1/2 division for each normal variate.  The effect is to replace one multiplication and one trigonometric function with a single division.
 
==See also==
* [[Inverse transform sampling]]
* [[Marsaglia polar method]], similar transform to Box-Muller, which uses Cartesian coordinates, instead of polar coordinates
 
==References==
<!--do not reduce font sizes, the Wiki style sheets control presentation-->
<references/>
 
==External links==
* [http://mathworld.wolfram.com/Box-MullerTransformation.html Box–Muller Transform on MathWorld]
 
{{DEFAULTSORT:Box-Muller Transform}}
[[Category:Transforms]]
[[Category:Non-uniform random numbers]]

Revision as of 10:56, 5 March 2014

I'm Jestine and was born on 22 January 1984. My hobbies are Air sports and Games Club - Dungeons and Dragons, Monopoly, Etc..

Also visit my webpage :: How To Get Free Fifa 15 Coins