Bond order potential: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Dewritech
clean up, typos fixed: so called → so-called using AWB
en>Knordlun
mNo edit summary
 
Line 1: Line 1:
{{Refimprove|date=December 2011}}
I'm Yoshiko Oquendo. Interviewing is how I make a living and it's some thing I really appreciate. Her family lives in Delaware but she  extended auto warranty needs to [http://www.consumer.ftc.gov/articles/0054-auto-service-contracts-and-warranties transfer] because of her family members. What she enjoys performing is bottle tops collecting  [http://appin.co.kr/board_Zqtv22/687187 extended auto warranty] and she is [http://www.carsdirect.com/car-buying/the-best-car-warranty-coverage-plans-top-used-or-new-auto-service-plans attempting] [http://i4p.info/article.php?id=114728 extended car warranty] to make it a profession.<br><br>Stop by my blog :: extended car warranty, [http://Indianapolisfaith.org/UserProfile/tabid/320/userId/242895/Default.aspx just click the up coming article],
 
The '''polar method''' (attributed to [[George Marsaglia]], 1964<ref>[http://www.jstor.org/stable/2027592 A convenient method for generating normal variables, G. Marsaglia and T. A. Bray, SIAM Rev. 6, 260–264, 1964]</ref>) is a [[pseudo-random number sampling]] method for generating a pair of independent [[standard normal random variable]]s. While it is superior to the [[Box–Muller transform]]{{Citation needed|date=September 2011}}, the [[Ziggurat algorithm]] is even more efficient.<ref>http://doi.acm.org/10.1145/1287620.1287622 Gaussian Random Number Generators, D. Thomas and W. Luk and P. Leong and J. Villasenor, ACM Computing Surveys, Vol. 39(4), Article 11, 2007, {{doi|10.1145/1287620.1287622}}</ref>
 
Standard normal random variables are frequently used in [[computer science]], [[computational statistics]], and in particular, in applications of the [[Monte Carlo method]].
 
The polar method works by choosing random points (''x'',&nbsp;''y'') in the square &minus;1&nbsp;<&nbsp;''x''&nbsp;<&nbsp;1, &minus;1&nbsp;<&nbsp;''y''&nbsp;<&nbsp;1 until
 
:<math> s=x^2+y^2 < 1, \,</math>
 
and then returning the required pair of normal [[random variable]]s as
 
:<math> x\sqrt{\frac{-2\ln(s)}{s}}\,,\ \ y\sqrt{\frac{-2\ln(s)}{s}}.</math>
 
==Theoretical basis==
The underlying theory may be summarized as follows:
 
If  ''u'' is uniformly distributed in the interval
0&nbsp;≤&nbsp;''u''&nbsp;<&nbsp;1, then the point
(cos(2π''u''),&nbsp;sin(2π''u''))
is uniformly distributed on the unit circumference
''x''<sup>2</sup>&nbsp;+&nbsp;''y''<sup>2</sup>&nbsp;=&nbsp;1, and multiplying that point by an independent
random variable ρ whose distribution is
 
:<math>\Pr(\rho<a)=\int_0^a re^{-r^2/2}\,dr </math>
 
will produce a point
 
:<math> \left(\rho\cos(2\pi u),\rho\sin(2\pi u)\right) </math>
 
whose coordinates are jointly distributed as two independent standard
normal random variables.
 
==History==
This idea dates back to [[Pierre-Simon Laplace|Laplace]], whom [[Carl Friedrich Gauss|Gauss]] credits with finding the above
 
:<math>I=\int_{-\infty}^\infty e^{-x^2/2}\,dx </math>
 
by taking the square root of
 
:<math>I^2 = \int_{-\infty}^\infty\int_{-\infty}^\infty e^{-(x^2+y^2)/2}\,dx\,dy
    =\int_0^{2\pi}\int_0^\infty re^{-r^2/2} \, dr \, d\theta.</math>
 
The transformation to polar coordinates makes evident that θ is
uniformly distributed (constant density) from 0 to 2π, and that the
radial distance ''r'' has density
 
:<math>re^{-r^2/2}. \, </math>
 
(''r''<sup>2</sup> has the appropriate [[chi square]] distribution.)
 
This method of producing a pair of independent standard normal variates by radially projecting a random point on the unit circumference to a distance given by the square root of a chi-square-2 variate is called the polar method for generating a pair of normal random variables,
 
==Practical considerations==
A direct application of this idea,
 
:<math>x=\sqrt{-2\ln(u_1)}\cos(2\pi u_2),\quad y=\sqrt{-2\ln(u_1)}\sin(2\pi u_2)</math>
 
is called the [[Box Muller transform]], in which the chi variate is usually
generated as
 
:<math>\sqrt{-2\ln(u_1)};</math>
 
but that transform requires logarithm, square root, sine and cosine functions. On some processors, the cosine and sine of the same argument can be calculated in parallel using a single instruction.<ref>{{cite web|last=Kanter|first=David|title=Intel’s Ivy Bridge Graphics Architecture|url=http://www.realworldtech.com/ivy-bridge-gpu/5/|work=Real World Tech|accessdate=8 April 2013}}</ref> Notably for Intel based machines, one can use fsincos assembler instruction or the expi instruction (available e.g. in D), to calculate  complex
 
: <math>\text{expi}(z) = e^{i z} = \cos(z) + i \sin(z), \, </math>
 
and just separate the real and imaginary parts.
 
The polar method, in which
a random point (''x'',&nbsp;''y'') inside the unit circle
is projected onto the unit circumference by setting ''s''&nbsp;=&nbsp;''x''<sup>2</sup>&nbsp;+&nbsp;''y''<sup>2</sup>  and forming the point
 
:<math>\left( \frac{x}{\sqrt{s}}, \frac{y}{\sqrt{s}} \right), \, </math>
 
is a faster procedure. Some researchers argue that the conditional if instruction (for rejecting a point outside of the unit circle), can make programs slower on modern processors equipped with pipelining and branch prediction.{{Citation needed|date=January 2011}} Also this procedure requires about 21% more evaluations of the underlying random number generator (only <math>\pi/4 \approx 79%</math> of generated points lie inside of unit circle).
 
That random point on the circumference is then radially projected the required random distance by means of
 
:<math>\sqrt{-2\ln(s)}, \, </math>
 
using the same ''s'' because that ''s'' is independent of the random point on the circumference and is itself uniformly distributed from 0 to&nbsp;1.
 
== Implementation ==
Simple implementation in [[Java (programming language)|Java]]:
<source lang="java">
private static double spare;
private static boolean isSpareReady = false;
 
public static synchronized double getGaussian(double mean, double stdDev) {
    if (isSpareReady) {
        isSpareReady = false;
        return spare * stdDev + mean;
    } else {
        double u, v, s;
        do {
            u = Math.random() * 2 - 1;
            v = Math.random() * 2 - 1;
            s = u * u + v * v;
        } while (s >= 1 || s == 0);
        double mul = Math.sqrt(-2.0 * Math.log(s) / s);
        spare = v * mul;
        isSpareReady = true;
        return mean + stdDev * u * mul;
    }
}
</source>
 
== References ==
{{Reflist}}
 
[[Category:Monte Carlo methods]]
[[Category:Pseudorandom number generators]]
[[Category:Non-uniform random numbers]]

Latest revision as of 17:52, 26 December 2014

I'm Yoshiko Oquendo. Interviewing is how I make a living and it's some thing I really appreciate. Her family lives in Delaware but she extended auto warranty needs to transfer because of her family members. What she enjoys performing is bottle tops collecting extended auto warranty and she is attempting extended car warranty to make it a profession.

Stop by my blog :: extended car warranty, just click the up coming article,