Liron comments on Drawing Two Aces - Less Wrong

14 Post author: Eliezer_Yudkowsky 03 January 2010 10:33AM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (84)

You are viewing a single comment's thread. Show more comments above.

Comment author: Liron 03 January 2010 08:48:39PM *  2 points [-]

I ran a bunch of trials where I randomly chose floating point values A and B from the interval [1, 1000]. Then I either added A to itself B times or added B to itself A times. Then I took an average of all the sums, weighting each by the "relevance factor" (5/A)(7/B).

Comment author: thomblake 06 January 2010 03:39:53PM 1 point [-]

I know this was trying to be funny, but that algorithm didn't really use simulation to estimate 7 x 5. It just calculates 7 x 5 a bunch of times and takes the average, with the added step of multiplying and dividing by AB.

But then, I'm maybe not creative enough to come up with an algorithm that would actually output an approximation of 7 x 5 using some probabilistic method that doesn't include calculating 7 x 5.

Comment author: Liron 07 January 2010 05:59:16PM 1 point [-]

Yeah, I guess I should have made the effort to understand the principles of the subject I was reading about rather than do a random trivial programming exercise with no general applicability whose dominance by simple mathematics I could have predicted a priori.

Comment author: Nick_Tarleton 06 January 2010 04:01:38PM *  6 points [-]

Throw darts at a unit square, take the fraction that hit a point (x < .7, y < .5) and multiply by 100. (Also works to calculate pi.)

Comment author: Liron 07 January 2010 06:02:53PM 1 point [-]

If I knew how to take fractions, I would have just done 7/(1/5).

Comment author: Zack_M_Davis 06 January 2010 08:36:18PM *  3 points [-]

I get 36.0.

#!/usr/bin/python
from random import random
trials=200
hits=0
for i in range(trials):
x=random()
y=random()
if x<.7:
if y<.5:
hits+=1
print 100*(float(hits)/float(trials))