Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
You are not logged in.
Post a reply
Topic review (newest first)
The flaw in your problem definition is the condition "given that door 2 has a goat", it should be "given Monty opens Door 2"
>>> import random >>> def pickbag(): bag = random.randrange(1,4) if bag == 1: return ['W','B'] #return a bag with a white and a black marble elif bag == 2: return ['W', 'W'] else: return ['B', 'B'] >>> def pickmarble(bag): return random.choice(bag) #pick a random marble from the given bag >>> def seeiftheothermarbleiswhite(): bag = pickbag() marble = pickmarble(bag) if marble == 'W': if bag == ['W','W']: return True # First Marble AND second marble white else: return False # Only First Marble White else: return None #First marble is not white, aborting
Now, lets do the experiment 1 00 000 times and Mark the cases as Yes when the other marble are white, No when only the First marble is white, Other when the first is not white.
>>> Yes = 0 >>> No = 0 >>> Other = 0 >>> for i in xrange(100000): a = seeiftheothermarbleiswhite() if a: Yes += 1 elif a == False: No += 1 else: Other += 1
Now, since we are dealing only with cases when the first marble is white:
>>> Yes 33351 >>> No 16533 >>> Other 50116
>>> Yes/float(Yes + No) 0.6685710849170075
Now, that is very close to 2/3 and the rest is experimental error
I got it wrong too, proving that bobbym = Paul Erdos. That was all I needed to convince myself that I belonged in math. After all, if I could get the same wrong answer as him I must be great too? I began to search for other probability problems that I could get wrong and lo, I found them.
I cannot blame him. It is very counter-intuitive!
Correction: I do see that I made the assumption about host's random choice when I argued that if he revealed a car ...
The problem is that door 2 might have a car behind it and not a goat.
Actually scratch that I think I do see the flaw in the official answer.