Something about probablility

This is a discussion on Something about probablility within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Originally Posted by mike_g Make sense? No......

  1. #46
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by mike_g View Post
    Make sense?
    No...

  2. #47
    Registered User
    Join Date
    Jan 2005
    Posts
    7,340
    >> The previous choice will have no consequence on the outcome of this new choice.
    The previous choice does have a consequence on what door the host opens. That is how the outcome is affected by the original choice, and that is the piece that I believe you are missing in your analysis.

    Unlike the gambler's situation that started this thread, in this case the previous events do have an effect on later events. If you pick a door with a donkey, that forces the host to open the other door with a donkey. Therefore, your choice affects what the final options will be, and it is that effect that shows up in the different probability.

  3. #48
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    Yes Daved. But the host always opens a losing door, no matter my choice. So his action has a null value.

    I'm still firmly convinced of my answer, but can't ignore the overwhelming majority. So, I'll give this some hard thought before I post again.

    I just think you guys are trying to mix events and forgetting that the one event that matters is that last instant where the contestant is faced with two doors.

    Meanwhile, sorry robwhit. Didn't read your post correctly the first time.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #49
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,914
    Quote Originally Posted by Mario F. View Post
    Oh, no. You can't do it that way. You proved there is a 1/3 chance of winning if nothing else happens. That is, the available doors is kept at 3.

    But something changed. The host removed a losing door and asked you to start all over again. Choose one of two doors. That is your event, laserlight. The previous choice will have no consequence on the outcome of this new choice.

    CornedBee mentioned this exercise goes against intuition and I've been wracking my brain ever since trying to see where I'm failing. However I can't. This is really that simple. In the end you are just asked to choose from two doors.

    For your odds to become 66% you would have to be able to pick 2 doors out of three and not know what's behind the 3rd door.
    *sigh*
    Read the question: "If you're the contestant, should you switch doors? Should you stay on your door? Does it matter?"

    The question is not "which of the doors has the highest probability of winning?" The question is: "which of the two strategies is better, or are they equally viable?"
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #50
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    1x + 2y - 1y = 1x + 1y no matter how you look at it.

  6. #51
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    1x + 2y - 1y = 1x + 1y no matter how you look at it.
    Thats not how it works. You have to remember the host removes a door with a donkey. Theres only a 1/3 chance that he has 2 donkeys. I dident get it at first either. Good luck figuring it out

  7. #52
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    Quote Originally Posted by laserlight View Post
    *sigh*
    Read the question: "If you're the contestant, should you switch doors? Should you stay on your door? Does it matter?"

    The question is not "which of the doors has the highest probability of winning?" The question is: "which of the two strategies is better, or are they equally viable?"
    Have pity. I answered that question on my very first post.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #53
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by mike_g View Post
    Theres only a 1/3 chance that he has 2 donkeys.
    So what?

  9. #54
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,914
    I answered that question on my very first post.
    Oops, sorry.

    It really doesn't matter. MY chance of hitting the right door is 1:2 whether I switch or not.
    Basically, you are saying: the probability of hitting the right door is 1/2 if the contestant does not switch.

    Do you agree then, that if there are three billion contestants, all of whom choose at random and do not switch, about 1.5 billion contestants will choose the right door?

    Do you also agree that if all of them choose at random, about 1 billion of them will choose the right door at the start, and about 2 billion of them will choose the wrong door at the start?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #55
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    Quote Originally Posted by laserlight View Post
    Basically, you are saying: the probability of hitting the right door is 1/2 if the contestant does not switch.
    Correct.

    Do you agree then, that if there are three billion contestants, all of whom choose at random and do not switch, about 1.5 billion contestants will choose the right door?
    Correct.

    Do you also agree that if all of them choose at random, about 1 billion of them will choose the right door at the start, and about 2 billion of them will choose the wrong door at the start?
    Correct.

    You are now going to ask me if I don't see the "obvious" inconsistency.

    But there isn't any inconsistency. It just so happens that your first and second question pertains to the last part of the game when there are only 2 doors left. And and the 3rd question to the first part of the game when there were 3 doors.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #56
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,914
    But there isn't any inconsistency. It just so happens that your first and second question pertains to the last part of the game when there are only 2 doors left. And and the 3rd question to the first part of the game when there were 3 doors.
    Ah, but the contestants have to go through the first part first. They have to select a door, and we know they will not switch. If they do not switch, how can it be that it appears that half a billion of them have switched?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #57
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    laserlight, which side are you on? It's a little hard to tell.

  13. #58
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    Quote Originally Posted by laserlight View Post
    Ah, but the contestants have to go through the first part first. They have to select a door, and we know they will not switch. If they do not switch, how can it be that it appears that half a billion of them have switched?
    Because the odds became 50% when the host eliminated a bad door! They are no longer 33%. By eliminating a wrong door the host increased the contestant odds to 50%.

    I really have no other way of saying this.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  14. #59
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    
    int selectBadDoor(int iRightDoor, int iGuess);
    int doRound(void);
    
    int selectBadDoor(int iRightDoor, int iGuess)
    {
    	int i;
    	for(i=0;i<3;i++)
    	{
    		if((iRightDoor != i) && (iGuess != i))
    		{
    			return i;
    		}
    	}
    	return -1;
    }
    
    int doRound(void)
    {
    	int iGuess, iRightDoor, iBadDoor;
    	char yn;
    	
    	/* Select right door. */
    	iRightDoor = rand() &#37; 3;	/* [0,3) */
    	printf("\tDEBUG: %d has been selected.\n", iRightDoor+1);
    	/* Ask user for original selection. */
    	printf("Select a door [1-3]: ");
    	fflush(stdout);
    	scanf("%d", &iGuess);
    	iGuess--;
    	/* Select a bad door. */
    	iBadDoor = selectBadDoor(iRightDoor, iGuess);
    	/* Ask user to switch. */
    	printf("Door %d has been eliminated.  Do you wish to switch? [Y/N]: ", iBadDoor+1);
    	fflush(stdout);
    	getchar();
    	scanf("%c", &yn);
    	/* Confuse code reader for fun. */
    	yn = ((iGuess==iRightDoor) && !((yn == 'Y') || (yn == 'y'))) || (!(iGuess==iRightDoor) && ((yn == 'Y') || (yn == 'y')));
    	printf("You %s!\n", yn?"win":"lose");
    	return yn;
    }
    
    int main(void)
    {
    	int iGoodSwitch = 0, iBadSwitch = 0, i, iResult;
    	
    	srand(time(NULL));
    	
    	for(i=0;i<10;i++)
    	{
    		iResult = doRound();
    		if(iResult)
    		{
    			puts("Switch = Good.");
    			iGoodSwitch++;
    		}
    		else
    		{
    			puts("Switch = Bad.");
    			iBadSwitch++;
    		}
    		putchar('\n');
    	}
    	printf("Switching was the right move %d times.\n", iGoodSwitch);
    	printf("Staying   was the right move %d times.\n", iBadSwitch);
    	return 0;
    }
    Hint: Redirect stdin at the command line or pipe it with another program. Also increase from 10 tries to something more substantial. Etc. etc..

    Note: I know rand() isn't truly random, but this is just for fun.

    Also of note: I left in a statement to print the value of the selected door which ruins the guessing aspect, but makes it easy to debug in case there are suspected errors.

  15. #60
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,914
    laserlight, which side are you on? It's a little hard to tell.
    I think that switching is the better strategy. That is, those who switch can be expected to win 2/3s of the time.

    Because the odds became 50&#37; when the host eliminated a bad door! They are no longer 33%. By eliminating a wrong door the host increased the contestant odds to 50%.
    That's ignoring the contradiction.

    By the way, would you accept a computer simulation as evidence?

    EDIT:
    Heh, MacGyver already wrote one, apparently.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 4 of 8 FirstFirst 12345678 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21