vendredi 8 juillet 2016

Can Random Number Generator of Fortran 90 be trusted for Monte Carlo Integration?

I have written a short monte carlo integration algorithm to calculate an integral in Fortran 90. I once compared the result obtained by solving the integral with respect to some parameter using the intrinsic random number generator with the random number generator method ran1 presented in Numerical Recipes for Fortran90 Volume 2.

Running the same algorithm twice, once calling the intrinsic random_seed(), then always call random_number() and once calling the ran1() method provided in the Numerical Recipe book I obtain as result in prinicipal the same shape but the intrinsic result is a continous curve in contrast to the ran1 result. In both cases I call the function with random parameters 10,000 times for a parameter value q, add it and then go on to the next q value and call the function 10,000 times etc.

A comparative image of the result can be found here: http://ift.tt/29yOqae

If I increase the number of calls both curves converge. But I was wondering: why does the intrinsic random number generator generate this smoothness? Is it still generally advised to use it or are there are other more advised RNG? I suppose the continuous result is a result of the "less" randomness of the intrinsic number generator.

(I left out the source code as I don't think that there is a lot of input from it. If somebody cares I can hand it in later.)




Aucun commentaire:

Enregistrer un commentaire