SQRT(RAN#×RAN#) - what is the distribution? - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: Not HP Calculators ( /forum-7.html)+--- Forum: Not remotely HP Calculators ( /forum-9.html)+--- Thread: SQRT(RAN#×RAN#) - what is the distribution? ( /thread-12749.html) |

SQRT(RAN#×RAN#) - what is the distribution? - Csaba Tizedes - 04-06-2019 03:17 PM
I am working on double (2D) integration routines just for fun on various calculators (implemented two versions (trapezoidal and Simpson's method) on CASIO fx-3650P and on a TI-83 plus - see the video below) and this weekend I want to write a Monte Carlo method for integration (first 1D later 2D). Unfortunately on CASIOs we have random number generation from 0.000 to 0.999 increased by 0.001, that is 1000 different random numbers equally spaced. My first idea was that, I can increase the number of different random numbers, if I calculate SQRT(RAN#×RAN#). I am sure this will increase the number of numbers, but what about the distribution? If you have any suggestion about how it can be figure out, please post here. I don't want to make it in EXCEL or write a brute force - thank you! And my video about a 2D integration on a TI-83 with sightseeing in Budapest, Hungary - check it on YT, the description below the video fullfilled with informations and you can download the 83's program directly: Csaba RE: SQRT(RAN#×RAN#) - what is the distribution? - ijabbott - 04-06-2019 03:53 PM
For a linear distribution, how about: (RAN# / 1e3) + RAN# Or: (RAN# / 1e6) + (RAN# / 1e3) + RAN# Or even: (RAN# / 1e9) + (RAN# / 1e6) + (RAN# / 1e3) + RAN# RE: SQRT(RAN#×RAN#) - what is the distribution? - Csaba Tizedes - 04-06-2019 07:40 PM
(04-06-2019 03:53 PM)ijabbott Wrote: For a linear distribution, how about: (RAN# / 1e3) + RAN#Too much steps required, but really good idea! RE: SQRT(RAN#×RAN#) - what is the distribution? - Valentin Albillo - 04-06-2019 09:54 PM
. Hi, (04-06-2019 03:17 PM)Csaba Tizedes Wrote: My first idea was that, I can increase the number of different random numbers, if I calculate SQRT(RAN#×RAN#). I am sure this will increase the number of numbers, but what about the distribution? What you're doing essentially amounts to returning as your random number the geometric mean of two other random numbers and this will certainly never result in a uniform distribution for your returned value if that was the distribution of the two factors. Take logarithms if you doubt it. Also, you're essentially multiplying two 3-digit integer numbers from 000 to 999, (then dividing by 10 ^{6}) so you'll never get one million different values as you should, first because multiplication is commutative so you'd only get half that many, but also because all prime numbers less than one million would never appear even once as a product, while numbers with many low divisors would appear muliple times (think of, say 36 and 37: the latter, being prime, would never appear as a product while the former would appear as the result of 1*36, 2*18, 3*12, 4*9, 6*6, ...) and this would ruin even further the uniformity, there would be some very strong bias for certain numbers.ijabbott ideas are the way to go: simple, fast and effective. Finally, may I suggest that instead of using a pure MonteCarlo scheme, which converges to the correct integral on the order of 1/Sqrt(N), i.e., dismayingly slowly, you migh want to consider a Quasi-MonteCarlo procedure, which converges much faster while still retaining most advantages of MonteCarlo methods in general. Just saying. V. . RE: SQRT(RAN#×RAN#) - what is the distribution? - Albert Chan - 04-21-2019 08:58 PM
Looking for the easiest way to see distribution of data, I use Minitab (30 years old DOS copy!) MTB > random 1000 c1-c2; SUBC> uniform 0 1. MTB > let c3 = sqrt(c1*c2) MTB > hist c3 Histogram of C3 N = 1000, Each * represents 5 obs, X=mid-point, Y=counts Code: `0.0 23 *****` |