Sciencemadness Discussion Board
Not logged in [Login ]
Go To Bottom

Printable Version  
 Pages:  1  2
Author: Subject: Probability: Take a Coin
gdflp
Super Moderator
*******




Posts: 1320
Registered: 14-2-2014
Location: NY, USA
Member Is Offline

Mood: Staring at code

[*] posted on 1-2-2015 at 05:41


That would be correct if no coins were ever eliminated from the game. However, since coins are being eliminated from the game, a large number of turns have different probabilities. That's why I tried a programmatic approach, some games neared 150,000 turns.
View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 1-2-2015 at 06:08


If the average probability dictates that the take per turn is -0.5, then the number of iterations becomes irrelevant no ?

Edit:

The neatness of the answer also suggests that it's an exam question.

[Edited on 1-2-2015 by aga]




View user's profile View All Posts By User
Eddygp
National Hazard
****




Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline

Mood: Organometallic

[*] posted on 1-2-2015 at 12:51


Quote: Originally posted by aga  
If the average probability dictates that the take per turn is -0.5, then the number of iterations becomes irrelevant no ?

Edit:

The neatness of the answer also suggests that it's an exam question.

[Edited on 1-2-2015 by aga]


Bear in mind that coins are destroyed, leading to a decrease in the total number of coins and either the loss of two genuine ones or a genuine one and a counterfeit one.
It is not an exam question, as far as I know. Due to the abovementioned added difficulty of discarding a genuine coin and another random coin (picked from the barrel), it would be quite complicated unless a more straightforward approach was used. Bayes can get pretty complicated here.




there may be bugs in gfind

[ˌɛdidʒiˈpiː] IPA pronunciation for my Username
View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 1-2-2015 at 13:04


Something tells me gdflp is on the mark. The source-code looks reasonable, I might of approached it slightly differently.

Quote: Originally posted by Eddygp  
To be honest... I do not have the answer... :(


As much as I would love to read up on bayesian statistics and attempt a notation based solution I just don't have time to spend 3-4 days putting pencil on paper. I know there's a less laborious way to approach it though.




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 1-2-2015 at 14:20


Quote:
There are 24000 coins in the barrel.
Knowing that the expected value is -0.5€ (per turn), how many fake coins are there in the barrel?

The answer is in the question.

Average/expected value per turn is -0.5 euros.

A Win is 6 euros, a Lose is -1 euro.

Therefore the average probability is 0.5/8 which equals 1500 Real coins.

The Game mechanics are irrelevant, and put there simply to confuse.

Edit :

Despite knowing little about maths, i think i grasp the concept.

If 'w' is the number of winning coins then :

On the First iteration of the program, the probability of picking a Winning coin (p) is w/24000

At this point the value of p changes, as the probability of discarding another winning coin
is p * ( (w-1)/23999 )

Then the probability changes again before the next 'turn', to account for the fact that two coins have now been removed from the game.

Programatically this is do-able, however the overall Probability is pre-determined in the Question.

This signifies that the question itself contains the parameters required for the calculation.

Likely it is a Stats/Probability question from some past paper.

[Edited on 1-2-2015 by aga]




View user's profile View All Posts By User
Marvin
National Hazard
****




Posts: 995
Registered: 13-10-2002
Member Is Offline

Mood: No Mood

[*] posted on 1-2-2015 at 14:36


I don't understand aga's analysis at all. Maybe write drunk and edit sober does not apply to math ;D Though going through it made me spot a mistake in my own initial analysis, which makes me think that if fake coins were not returned to the pot the concentration would be stable turn to turn, at 1:13 real to fake. ie 1 in 14 coins real. As it is the concentration of real coins must drop as the game is played.

I've written and run a short program based on my sum of games idea but the result does not match gdflp results and it's far enough away (9500ish) to make me think there must be a mistake. Aside from trusting the random number gen, I can't see any potential problems with his code. I suspect the problem lies in rnd.next or me. Weighted with me. I never took stats. Should I have said this before :)

I tried to approach this with calculus, which I think is a viable method, this is a lot like a radioactive decay where the rate of reduction is related to the amount of material. Turns out my calculus is a bit rusty and I'm having difficulty arranging the math so I don't have multiple dependent variables.

I like this problem, but I'm not feeling the love back yet.
View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 1-2-2015 at 14:57


Failure to read and understand the Question is a common reason for students failing in exams.

I've done that a few times.
Read, misunderstood, then answered a question i made up myself on the spot, and preferred.




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 1-2-2015 at 15:33


My reasoning is this :

The Stated 'expected value is -0.5€ (per turn)' is the Clue.

There are 24000 coins in the pot.

The Max payout is 6 euros.
The Min is -1 euro.

That makes a Range of 8 euros (don't forget to count 0 euros)
Thenotion that you get either -1 or +6 is irrelevant.

Therefore the Average Probability of picking a winning Coin is 0.5/8, no matter what the game actually is,
or whether coins are discarded or not.

The Question already states that the outcome is -0.5 euros per turn : the Overall Result is already known.

I do feel aqbit drunk now, so i'll stop posting for today.




View user's profile View All Posts By User
gdflp
Super Moderator
*******




Posts: 1320
Registered: 14-2-2014
Location: NY, USA
Member Is Offline

Mood: Staring at code

[*] posted on 21-1-2017 at 14:02


I came across this thread again recently, so I thought I would revisit this and see if I could narrow down the answer anymore. First of all, I adapted the script to Matlab, hoping that it would run more efficiently. Unfortunately, it seems that it's a bit slower than the C# code if anything, but I ran it anyway. I didn't bother to set up multi-threading as I've only got a quad core right now(though substantially faster than the processor I was running 2 years ago), so it's simpler to just manually run a couple of instances simultaneously. I ran another 1,000,000 game simulation and got the following rather promising results :

8765 - -0.5001441
8766 - -0.4999944
8767 - -0.4998910
8768 - -0.4998794

This seems to again point to 8766, so I decided to run a 10,000,000 game simulation with 8766 and the two adjacent numbers, resulting in the following:

8765 - -0.5001112
8766 - -0.5000162
8767 - -0.4999233

Unfortunately, a bit worse than the million game simulation, but it still seems to point to 8766.

If anyone who is better at statistics than I would like to take a more orthodox approach to this problem and confirm my result, I would be more than happy. As it stands though, I'm fairly confident that 8766 is the correct answer, unless there's another logical error in my code which I'm not seeing.




View user's profile View All Posts By User
JJay
International Hazard
*****




Posts: 3440
Registered: 15-10-2015
Member Is Offline


[*] posted on 21-1-2017 at 18:15


This can be formulated as a maximum likelihoood optimization if you can specify the potential earnings as a probability distribution which is a function of the number of coins.

It's trivial to come up with a recursive formula for the distribution that simply covers all possible outcomes, but it would require infinite time to evaluate. Reducing that formula to closed form... hmm....

[Edited on 22-1-2017 by JJay]




View user's profile View All Posts By User
Marvin
National Hazard
****




Posts: 995
Registered: 13-10-2002
Member Is Offline

Mood: No Mood

[*] posted on 23-1-2017 at 17:05


I've been meaning to return to this for a long time.

I've tried a completely new approach and I was much happier with it than any of my previous efforts until I actually got results. Rather than play the game turn by turn and get non integer numbers of genuine coins in my sum of games probability idea, I hit on computing the value of moving between states in the game. So the average number of turns needed to remove a genuine coin at every state in the game and keep track of the value, summing every transition as it is produced. I even started working it as a grid of states so I wasn't averaging state values as well as probability in case that made the answer wrong.

My closest values are,
8838 = -0.500052
8839 = -0.499957

I don't know why they bear no relation to the Monte Carlo values. Getting the last coin is responsible for almost 10 percent of the total money made by the game, so screwing up there, say by an off by 1 error results in a different answer by hundreds of coins referred to the start of the game.

I think what I need to do is try my method with something simpler and with vastly fewer turns to see if it can produce right answers and then make things more complex until it breaks.
View user's profile View All Posts By User
Maroboduus
Hazard to Others
***




Posts: 257
Registered: 14-9-2016
Location: 26 Ancho Street
Member Is Offline

Mood: vacant

[*] posted on 23-1-2017 at 18:12


Quote: Originally posted by aga  
My reasoning is this :

The Stated 'expected value is -0.5€ (per turn)' is the Clue.

There are 24000 coins in the pot.

The Max payout is 6 euros.
The Min is -1 euro.

That makes a Range of 8 euros (don't forget to count 0 euros)
Thenotion that you get either -1 or +6 is irrelevant.

Therefore the Average Probability of picking a winning Coin is 0.5/8, no matter what the game actually is,
or whether coins are discarded or not.

The Question already states that the outcome is -0.5 euros per turn : the Overall Result is already known.

I do feel aqbit drunk now, so i'll stop posting for today.


My first reaction was to calculate the average probability of picking a winning coin as well. I think that's a natural first thing to try if you're trying to dissect the problem to figure out how its author was thinking.
(Oh my god, I have something in common with aga? The mind boggles, but it does that a lot lately.)

However I get a probability of 3/14 of picking a winning coin.

([3x6]-11)/14=0.5

This also seems to mean the average game would take 5600 tries to complete. (discard 2 coins 3 times for every 14 tries.....so 2400 coins every 5600 tries). (six to fourteen is as 2400 to 5600)

But this hasn't gotten me any farther as of yet.

I am somewhat limited when it comes to solving problems like this in my head, so I am attempting this as a mental exercise.

This is a COOL question for a mathematical novice to bend his brain over, but I do have a nagging feeling that some hotshot mathematician probably examined this class of problems and found a general solution for them decades or centuries ago.

Will think this over a bit more next time I'm in the proper mood.

EDIT: OOPS, that's what I get for not re-checking the question. Those results are for an expected payout of 0.5, not -0.5.

[Edited on 24-1-2017 by Maroboduus]

So then it's 1/14 odds of a winning pull.
(6-13)/14= -0.5
And 16,800 tries for an average game.

Like I said, I'm somewhat limited when it comes to solving problems like this in my head.


[Edited on 24-1-2017 by Maroboduus]

EDIT: Make that 168,000 tries. Damn! (24000 coins, NOT 2400)

[Edited on 24-1-2017 by Maroboduus]

So the odds for EACH given try will be expected to reduce at a some rate from some given value to a dead certainty, and the remaining pulls will all be sure winners.
The average of the odds on all these tries will be 1/14.

Seems like some clever little algebraic equation should solve this for the number of genuine coins, and the number of fakes is trivial from there.

Problem is the rate of change itself will also change as the odds increase.
EDIT:
From an initial rate of the initials odds of success per pull plus one times the initial odds per pull up to 2 per pull when you reach certainty of successful pulls and continuing at that rate till the coins are gone?

Equaling an overall rate of (1+[1/14])/14=15/196 for all pulls?

[Edited on 24-1-2017 by Maroboduus]

[Edited on 24-1-2017 by Maroboduus]
View user's profile View All Posts By User
zed
International Hazard
*****




Posts: 2284
Registered: 6-9-2008
Location: Great State of Jefferson, City of Portland
Member Is Offline

Mood: Semi-repentant Sith Lord

[*] posted on 10-2-2017 at 13:01


Hmmmm.

I'm an aspiring con man myself, but I seem to lack the required potential for un-bridled evil.

Sounds like there is the potential here, to steal lotsa money. But, exactly how?

Universal default, scratch-offs, and mortgaged back securities....have already been done.
View user's profile View All Posts By User
 Pages:  1  2

  Go To Top