Random Numbers part 3

In the previous section, we learned how to generate random deviates with a uniform probability distribution, so that the probability of generating a number between x and x + dx, denoted p(x)dx, is given by p(x)dx = dx 0 | Transformation Method Exponential and Normal Deviates 287 Transformation Method Exponential and Normal Deviates In the previous section we learned how to generate random deviates with a uniform probability distribution so that the probability of generating a number between x and x dx denoted p x dx is given by dx 0 x 1 p x dx 10 otherwise The probability distributionp x is of course normalized so that y p x dx 1 Now suppose that we generate a uniform deviate x and then take some prescribed function of it y x . The probability distribution of y denoted p y dy is determined by the fundamental transformation law of probabilities which is simply p y dy p x dx or p y p x dx dy Exponential Deviates As an example suppose that y x - ln x and that p x is as given by equation for a uniform deviate. Then p y dy dx dy dy e y dy which is distributed exponentially. This exponential distribution occurs frequently in real problems usually as the distribution of waiting times between independent Poisson-random events for example the radioactive decay of nuclei. You can also easily see from that the quantity y X has the probability distribution Xe-Xy. So we have include float expdev long idum Returns an exponentially distributed positive random deviate of unit mean using ranl idum as the source of uniform deviates. float ran1 long idum float dum Sample page from NUMERICAL RECIPES IN C THE ART OF SCIENTIFIC COMPUTING ISBN 0-521-43108-5 do dum ran1 idum while dum return -log dum 288 Chapter 7. Random Numbers Figure . Transformation method for generating a random deviate y from a known probability distribution p y . The indefinite integral of p y must be known and invertible. A uniform deviate x is chosen between 0 and 1. Its corresponding y on the definite-integral curve is the desired deviate. Let s see what is involved in using the above transformation method to generate some arbitrary desired distribution of ys say .

Bấm vào đây để xem trước nội dung
TÀI LIỆU MỚI ĐĂNG
Đã 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.