Goat door Problem
1. I thinkYesIncrease the chance of selecting a car
The reason is as follows:
There are a total of N doors, and there is a car behind one of them.
In the first case, I select a door. After the host prompts me, I will not change the selection.
So what I decided to win was event A, "I selected A door with A car at A time", which had nothing to do with the subsequent events.
Event probability/winning probability:
Case 2: I select a door and change the selection after the host prompts.
So, I decided to win two events:
Event B "I chose a car-less door for the first time ";
Event C "in case of Event B, I chose a car door for the remaining optional doors ." (At this time, except for the first selection of the door and the host opened the door, the remaining optional door only N-2 fan)
Event Probability :;;
Winning probability:
Compared with the above situations, we can see that:
When N = 3, the probability of selection is 0.333. If N = 3, the probability of selection is 0.667.
That is, the change option will increase the chance of selection.
2. The program source code is as follows:
From random import * a = ('chely', 'yang', 'yang') # construct the post-door condition sequence B = ('change', 'change ') # construct two selection sequence T = 1 # initial number of experiments: 1 uncWIN = 0 # event A does not change the number of selected vehicles chaWIN = 0 # event C changes the number of selected vehicles unchange = 0 # 'do not change' occurrence times change = 0 # 'change 'occurrence times while T <100000: # assume that the number of tests is 100000 if choice (B) = 'do not change': # select do not change = unchange + 1 if choice (a) = 'chely ': uncWIN = uncWIN + 1 else: # select change = change + 1 if choice (a) = 'yang ': chaWIN = chaWIN + 1 T = T + 1 Punwin = uncWIN/unchangePchwin = chaWIN/changeprint ("tested {} Times ". format (T) print ("the probability of not selecting a car is :{}". format (Punwin) print ("the probability of selecting a car after changing is :{}". format (Pchwin) if Punwin> Pchwin: print ("the probability of not switching to a car is high") else: print ("the probability of selecting a car after switching is high ")
3. The verification result is as follows: