Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

```
>>> 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

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**PalmerEldritch****Member**- Registered: 2014-01-21
- Posts: 1

ILIA wrote:

Let's say I originally picked door 1 then door 2 was opened showing the goat so we want to calculate probability of car behind door 1 given that door 2 has a goat and probability of car behind door 3 given that door 2 has a goat.

The flaw in your problem definition is the condition *"given that door 2 has a goat"*, it should be *"given Monty opens Door 2"*

.

If we call the 'probability that Monty opens Door 2', p(g2), then:

p(g2) = (1/3*1) + (1/3 * 1/2) + (1/3 * 0) = 1/2 and

p(g2)|(c1) = 1/2 and p(g2)|(c3) = 1

Plug those values into Bayes and you get 1/3 and 2/3

Offline

**Monox D. I-Fly****Member**- Registered: 2015-12-02
- Posts: 616

Nehushtan wrote:

http://i602.photobucket.com/albums/tt105/GeorgeLaw5/TheCuriousIncidentOfTheDogInTheNightTime.jpg

From

The Curious Incident of the Dog in the Night-Timeby Mark Haddon (2003), published by Vintage (2004).

Thank you, finally I understand why switching choices increase the probability. Took me one year to figure it out.

Offline

**thickhead****Member**- Registered: 2016-04-16
- Posts: 880

**{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha{Gods rejoice at those places where ladies are respected.}**

Offline

**thickhead****Member**- Registered: 2016-04-16
- Posts: 880

*Last edited by thickhead (2016-04-29 21:08:34)*

**{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha{Gods rejoice at those places where ladies are respected.}**

Offline

**Relentless****Member**- Registered: 2015-12-15
- Posts: 624

I have heard that one good explanation of the Monty Hall problem is by generalising it to many doors, say 100, with one car. You choose one door, and then Monty opens 98 doors revealing 98 goats. You get the car 1% of the time you don't switch, and 99% of the time you do. It is the same idea with three doors, only more subtle.

Offline

**thickhead****Member**- Registered: 2016-04-16
- Posts: 880

I said nothing new nor I have solved the problem. It is already there over years but I only wanted to give simple reasoning. If the results are listed under open door and closed door the result is visibly apparent rather than explaining through confusing ways.

**{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha{Gods rejoice at those places where ladies are respected.}**

Offline