English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need to write a short program that uses uniform random numbers between 0 and 1 to estimate ln(10). What's the concept here that I need to be checking against each time? (I know I need to take the random number and check if its part of some set, but what set would give me a probability of ln(10)?)

2007-02-22 07:35:38 · 2 answers · asked by Orclev 2 in Science & Mathematics Mathematics

2 answers

If you picked a number at random from 1 to N, where N is very large, the odds that it is a prime number is 1 / In(N). So, using this idea, let N = 10^m. Then we can derive In(10) in the following way, where B is the number of trials, and A is the number of times a prime number has been picked at random, from 1 to N = 10^m:

A/B = 1 / m In(10)

or

In(10) = B / mA

If you use a random number generator giving decimal values between 0 and 1, then the number of decimal places would be m. Your only problem, however, is deciding whether or not it's prime. Ah, well, maybe there's another way.. hmm...

All right, we can go to Plan B, using Benford's Law (see wiki). It's tricky to implement in a "short" program using a random generator, but it's possible (see 2nd link). The idea behind Benford's Law is that given a random list of numbers of ARBITRARY size, then the 1st digit is much more likely to be 1 than any other number, followed by 2, etc. The odds formula is logarithmic, which is what you want. But you cannot just read off the "1st digit" of any decimal number between 1 and N, since the odds will always be exactly 1 in 10. You have to set this up right. for this to work in a "Monte Carlo" computer simulation of Benford's Law.

2007-02-22 07:54:32 · answer #1 · answered by Scythian1950 7 · 0 0

My spouse and that i used it to make your techniques up which vehicle insurance to purchase. We used a theory observed as the envisioned fee (and information approximately motor vehicle injuries in our city) and found out that the low top rate intense deductible plan replaced right into a extra effectual guess than intense top rate low deductible. additionally my chum (who's getting his PhD in hazard) makes decent funds enjoying poker, yet i'm no longer recommending that :)

2016-10-16 06:31:39 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers