Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Luis A. Afonso
Posts:
4,275
From:
LIsbon (Portugal)
Registered:
2/16/05
|
|
Checking the calculation system
Posted:
Oct 29, 2012 1:04 PM
|
|
Checking the calculation system
A lot of Monte Carlo experts stay absolutely indifferent in what concerns the batteries of randomness tests for random numbers generators RNG the *theoretic* people are found to present . . . They wisely prefer, once there are any that fulfills all requirements, to check if simulated distribution on study are exactly they intend to work with, taking in account errors it was wise not to exceed. In this purpose we repeat to check (I got a new computer) how the system is able to find the fractiles 0.95, 0.975 and 0.99 of the normal Population, in accordance with the values 1.645, 1.960, 2.326.
Results Attempt 1, 2, 3, 4, 5_____number of normal items by attempt = 1´000´000. __0.9499, 0.9500, 0.9500, 0.9500, 0.9500__ __0.9749, 0.9749, 0.9750, 0.9750, 0.9749__ __0.9899, 0.9900, 0.9900, 0.9901, 0.9900_____
Note that an exact algorithm, Box Muller?s, was used to simulate data.
Luis A. Afonso
REM "RIS" CLS PRINT : PRINT : PRINT PRINT " N(0,1) DATA " INPUT " times "; REPEAT pi = 4 * ATN(1) DIM W(8002) DEF fnu (k) = (2 * k + 1) / ((k + 1) * (2 * k + 3)) FOR J = 1 TO REPEAT: RANDOMIZE TIMER LOCATE 5, 50: PRINT USING "#########"; REPEAT - J REM aa = SQR(-2 * LOG(RND)) X = aa * COS(2 * pi * RND) IF X < 1.645 THEN C50 = C50 + 1 IF X < 1.96 THEN C25 = C25 + 1 IF X < 2.326 THEN C01 = C01 + 1 IF INT(J / 10000) <> J / 10000 THEN GOTO 17 IF J = REPEAT / 2 THEN RANDOMIZE TIMER LOCATE 10, 50 PRINT USING " 5% #.#### "; C50 / J LOCATE 11, 50 PRINT USING " 2.5% #.#### "; C25 / J LOCATE 12, 50 PRINT USING " 1% #.#### "; C01 / J 17 NEXT J END
|
|
|
|