Random Numbers part 4

while (rsq = || rsq == ); and if they are not, try again. fac=sqrt(*log(rsq)/rsq); Now make the Box-Muller transformation to get two normal deviates. Return one and save the other for next time. gset=v1*fac; iset=1 | 290 Chapter 7. Random Numbers while rsq rsq and if they are not try again. fac sqrt log rsq rsq Now make the Box-Muller transformation to get two normal deviates. Return one and save the other for next time. gset v1 fac iset 1 return v2 fac else iset 0 return gset Set flag. We have an extra deviate handy so unset the flag and return it. See Devroye 1 and Bratley 2 for many additional algorithms. CITED REFERENCES AND FURTHER READING Devroye L. 1986 Non-Uniform Random Variate Generation New York Springer-Verlag . 1 Bratley P. Fox . and Schrage . 1983 A Guide to Simulation New York SpringerVerlag . 2 Knuth . 1981 SeminumericalAlgorithms 2nd ed. vol. 2 of TheArtofComputerProgramming Reading MA Addison-Wesley pp. 116ff. Rejection Method Gamma Poisson Binomial Deviates The rejection method is a powerful general technique for generating random deviates whose distribution functionp x dx probability of avalue occurring between x and x dx is known and computable. The rejection method does not require that the cumulative distribution function indefinite integral of p x be readily computable much less the inverse of that function which was required for the transformation method in the previous section. The rejection method is based on a simple geometrical argument Draw a graph of the probability distributionp x that you wish to generate so that the area under the curve in any range of x corresponds to the desired probability of generating an x in that range. If we had some way of choosing a random point in two dimensions with uniform probability in the area under your curve then the x value of that random point would have the desired distribution. Now on the same graph draw any other curve f x which has finite not infinite area and lies everywhere above your original probability distribution. This is always possible because your original curve encloses only unit area by definition of probability. We will call this f x the comparison function. .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
11    76    1    24-04-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.