Open Side Menu Go to the Top
Register
Coin Flipping Infinite Involving Paradox Coin Flipping Infinite Involving Paradox

12-10-2015 , 01:48 PM
No fun w/o the ankle drags eh.

Cheers.
Coin Flipping Infinite Involving Paradox Quote
12-12-2015 , 08:37 AM
Quote:
Originally Posted by David Sklansky
But what if there is no limit to your allowable flips? With no limit to your profit if you determine its the good coin, there is no limit to how discouraging the evidence has to be before you give up. So you should never give up. But that means that your EV in this spot would be negative infinity instead of positive infinity.
Say you have N flips. You can work backwards from 1 flip remaining etc. to determine the quitting strategy for if you've seen A heads and B tails so far. You can show, and the point is that there are some situations where you quit for any large N, and your total EV in the game is good. Your EV increases as N increases (its clearly monotone increasing because you can choose to stop.) So the limit is going to be positive.

So what was the paradox? Say you have a new game, the coin is either heads 100%, or heads x%. Say x=0. After N/2 flips you can decide to keep playing or not for another N/2 flips. Your EV in the game is N/4, also a monotone increasing function. The analogy to your argument is you always keep flipping. Note I can modify the game slightly by changing x, so there is a really really tiny chance that the coin could be actually always heads even after seeing N/2 tails. But that chance wouldn't be worth the payoff. For example it could be order x^(N/2) probability for a N/2 payoff, and 1-x^(N/2) for a N/2 loss.
Coin Flipping Infinite Involving Paradox Quote
12-12-2015 , 02:34 PM
Consider all the strategies that stop flipping after N flips (but can stop before N flips). Among all those strategies, there is a strategy with maximal EV. Call this S(N). We know E[S(N)] -> infinity as N->infinity.

Now consider the game where you can flip infinite times. Let's call the expectation of this game V. It's clear the V >= E[S(N)] for all N. Suppose for the sake of contradiction that V = K, for some finite number K. There exists N large enough such that E[S(N)] > K, contradicting the hypothesis. This establishes that the expectation of the game with infinite flips is +infinity.

Note that it is NOT true in general that lim E[S(N)] = E[lim S(N)] (lim short for limit as N->infinity).

The paradox seems to be that it's tricky to think of a strategy S such that E[S] = infinity. Does there even necessarily have to exist such a strategy? We know that S cannot be "flip a coin infinite times" (that seems undefined).

I think there should exist a strategy. As a rough heuristic, we know that E[S(N+1)] - E[S(N)] ~ c for some constant c (say 1 cent) for large enough N.

This is because once you get to a large number of flips, most "good" strategies would have discarded the bad coin by then so the marginal value of one more flip is about the 1/2 * {EV of one more bet with good coin}. Thus E[S(N)] >= B + c*N for some constant B

In particular, E[S(2^N)] >= B + c*(2^N)

Now we describe the following strategy: we pick a random number X from the uniform distribution (0,1]. We then decide to execute the strategy S(floor(2^(1/X)). This (or some modification, like 2^2^2^(1/X)) should be an infinite expectation strategy.
Coin Flipping Infinite Involving Paradox Quote
12-12-2015 , 05:53 PM
Any finite stop loss strategy is infinite +ev.
Coin Flipping Infinite Involving Paradox Quote
12-13-2015 , 03:04 PM
Quote:
Originally Posted by TomCowley
Any finite stop loss strategy is infinite +ev.
And water's wet. That doesn't mean categorizing EV scenarios and possibly finding optimized strategies should desist.

Rather the contrary. They're fun even if the common purpose's meaningless. At least for the gap until Maersk Interplanetary has actual traffic instead of Hohmanns and in-system ore deliveries.

Finding optimal three, four or five planet cruise line routes is fiendishly complicated when you have to sustain the pretense of fiat economics.
Coin Flipping Infinite Involving Paradox Quote
12-13-2015 , 05:46 PM
Quote:
Originally Posted by Kristofero
And water's wet. That doesn't mean categorizing EV scenarios and possibly finding optimized strategies should desist.
I guess you missed all the posts in the thread on the subject that there is no optimized strategy. Or my post where I already showed how to get almost all of the possible EV at any given point in time. Stick to rips and chips.
Coin Flipping Infinite Involving Paradox Quote
12-13-2015 , 08:57 PM
Meanwhile who wants to tell me the minimum number of flips one must be promised to have positive EV?
Coin Flipping Infinite Involving Paradox Quote
12-13-2015 , 09:56 PM
The minimum number of flips to allow you to make a decision to then be able to play indefinitely (sticking with it forever or stopping) or the minimum total number of flips that secures this is a plus EV game (again allowing for stopping at will) ?

Basically are you asking what is the EV of a game of N flips ie EV(N) ie the value of the game as function of N? (see the thread i created last week and didnt get any action yet ). Then find the minimum N that secures EV(N)>0?
Coin Flipping Infinite Involving Paradox Quote
12-13-2015 , 10:32 PM
Quote:
Originally Posted by David Sklansky
Meanwhile who wants to tell me the minimum number of flips one must be promised to have positive EV?
One.

Other than that 48993229 times infinity equals 0.00000000000001 times infinity. It isn't a paradox.
Coin Flipping Infinite Involving Paradox Quote
12-14-2015 , 01:39 AM
Short of actually solving the full problem one can use the first interpretation of the question to bound the answer of the second interpretation.

For example if i asked myself how many flips N1 do i need to have to be able to arrive at the conclusion this is a plus EV game if one is able to plays long enough after that to cover initial cost of testing, that is of course N1*0.02, i could imagine a test phase of N1 that based on the outcome i can find a condition to keep or stop that separates the population to those that pass it and those that dont. If i then play with those that pass only i will get on avg a result that is the avg of the EV of all these choices times the number of flips left it i was restricting myself to not stopping. the correct optimal strategy of course is even better. But this approach would give us a safe upper limit of plus EV situation.


Working with this idea in mind after N1 flips the result is n,N1-n. For the good ones the probability this outcome happens is N1!/n!/(N1-1)!*p^n*(1-p)^(N1-n) with p=0.51) and for the bad ones its N1!/n!/(N1-n)!*q^n*(1-q)^(N1-n) with q=0.48.

So if they started as 50-50 the relative population (what now is the ratio of good to total or the chance to have a good coin) is (Bayesian result) ;

r=1/(1+s(n,N1,p,q))

where s(n,N1,p,q)=(q/p)^n*((1-q)/(1-p))^(N1-n) every time the result is n wins out of N1 flips.

If we have a fraction r of good ones then this means the EV of a future flip is ;

r*(2*p-1)+(1-r)*(2*q-1) and must be >0.

So if this is true for some n1 and higher we will have a game with EV;

Sum( (r(n,N1,p,q)*(2*p-1)+(1-r(n,N1,p,q))*(2*q-1))*1/2*(N1!/n!/(N1-1)!*p^n*(1-p)^(N1-n)+N1!/n!/(N1-n)!*q^n*(1-q)^(N1-n)) from n=n1 to N1) *(N-N1)
+(1/2*(2*p-1)+1/2*(2*q-1))*N1.

So we want to find for each N if some N1 exists for this top be positive.


So far this has given me for example that about 8250 flips allows to have a 111 test phase that anything 61 and higher/111 clears and delivers a plus result by 8250. The test phase costs are what require after the test phase such a long run to recover. So having that long runs available is what will secure this method of filtering works.

So its safe to expect something less than 8250 because i imagine one can improve on that significantly.

Something that uses a stop loss or a running decision condition that is constantly updated will do better. For example many that clear the initialtest phase are still bad ones and many that fail still good ones that could be a lot more clear what they are after a few more test runs. So you may accept something but if say after 1000 more flips it is now 3sd below expected for being a good coin you can reject it and not complete the remaining 7000+ flips. That saves a lot.

So my first guess is much less than 8250.

Initiating a stop of 20 loss will lose only 45% of the good ones and all the bad ones basically. It will take the bad ones on avg 500 flips to get to that stop loss. So easily by 1000 most of them are gone and you have stopped playing with any bad ones say after the first 1500 or so. Therefore above 1500 flips all that survive should be about 0.02N in profit.

If we did a 30 loss it is 30% loss of good ones. If we put the loss at 50 its 13.5%.

Simulations with only 20 stop loss and 1150 flips gave marginally positive game. So this is a big improvement over the initial bound of 8250.

Its interesting that if one did some stupid -1 stop loss only that kills the vast majority of coins then because of the severe bias on what survives it seems even 400-500 flips can be a plus EV result. I need to verify that further though.


One could start with some number like 100 flips and work backwards to find the strategy (ie flip only when plus EV to do so the next one for the last step and the same for the other 2 steps away as the tree opens to more cases etc all the way to the early ones) and see if that gives the positive result here deviating significantly from other more rigid less flexible adaptable strategies.

Last edited by masque de Z; 12-14-2015 at 02:02 AM.
Coin Flipping Infinite Involving Paradox Quote
12-14-2015 , 02:17 AM
Quote:
Originally Posted by David Sklansky
Meanwhile who wants to tell me the minimum number of flips one must be promised to have positive EV?
For a 52/46 situation 99 flips is very barely +EV, and 98 is not enough. (I calculated exact equity of 99 as 56576234208976781694622095954152114816611196310417 21342675341186972906091587407917900046562825401301 31671667852878494239878254727698826138670417072040 90276716849/78886090522101180541172856528278622967320643510902 30047702789306640625000000000000000000000000000000 00000000000000000000000000000000000000000000000000 000000000000000
=
7.17188972537e-05 )

For a 51/48 situation 200 flips is not enough, trying 400 I'll let you know later
Edit: 400 worked with 0.011240 equity, I would imagine its between 390 and 400

Last edited by Alex Wice; 12-14-2015 at 02:40 AM.
Coin Flipping Infinite Involving Paradox Quote
12-14-2015 , 03:01 AM
Alex Wice maybe try 380 and lower as even a stupid -1 stop loss strategy yields about 0.008 at this level so it can be improved obviously with the real thing. Even 370 appears slightly ok. Maybe try 360-370 range.
Coin Flipping Infinite Involving Paradox Quote
12-14-2015 , 01:05 PM
x-posted in a MTTSNG thread (bounty hand)

Good seeing you, Alex.
Coin Flipping Infinite Involving Paradox Quote
12-14-2015 , 02:41 PM
Quote:
Originally Posted by Alex Wice
For a 52/46 situation 99 flips is very barely +EV, and 98 is not enough. (I calculated exact equity of 99 as 56576234208976781694622095954152114816611196310417 21342675341186972906091587407917900046562825401301 31671667852878494239878254727698826138670417072040 90276716849/78886090522101180541172856528278622967320643510902 30047702789306640625000000000000000000000000000000 00000000000000000000000000000000000000000000000000 000000000000000
=
7.17188972537e-05 )

For a 51/48 situation 200 flips is not enough, trying 400 I'll let you know later
Edit: 400 worked with 0.011240 equity, I would imagine its between 390 and 400
What stopping strategy is this based on? How would you know if it's the best stopping strategy? Seems like some stopping strategies could get pretty complex.

PairTheBoard
Coin Flipping Infinite Involving Paradox Quote
12-14-2015 , 06:29 PM
Quote:
Originally Posted by PairTheBoard
What stopping strategy is this based on? How would you know if it's the best stopping strategy? Seems like some stopping strategies could get pretty complex.

PairTheBoard
You need to somehow weight the future potential of every branch. The last flip ie position (n-1,k) where k is the running sum at the completion of n-1 flip if one is alive still there flipping (+ and - for head/tails) is easy to decide based on the updated profile of current run if its plus EV or not to flip. If your chance to have good coin is p then do p*(0.51-0.49)+(1-p)*(0.48-0.52) and see if its positive to flip. If its negative stop,avoid the last flip. Here you need to have p>=2/3 for the one flip level left to flip.

The one before gets more complicated. For example it may be leading to a stop in which case you lose exactly 1 (if you were to flip and arrive there ending the branch) or it may lead to a win (+1) that forces another flip next which is also positive (hence overall 1+ ie more than 1). So the EV of flipping with 2 left is the EV of the total branch future not the EV of the next single flip outcome. The probability of each branch is calculated based on the updated profile so far up to that run but then the outcome gives the 2 branches different profiles again so the ++ future for example is coming with a different probability than say q^2 where q was the chance at the previous flip to have been +1 (based on how often good coin that leads to plus + lucky bad coin leading to plus). It is instead q*q' type thing (q'in general different than q because it derives updated information conditional on the first flip being positive with chance q forcing now a new q' for the next flip). I have to rethink that a bit to see how reasonable this is. (maybe one should stick with a profile for all the future branch and not update it when doing this)

Recursively that way the true equity of a position that a flip happens can be seen vs where one doesnt happen.

For example for some very strong ones flipping 2 in a row is a given (a negative flip wont stop from running another say if the coin is 75% to be good). For something that is borderline negative to flip, one may still flip if its possible that by flipping you arrive on one branch to a position that is more positive than the negative that is the other development. I mean one path ends in one flip but the other takes 2 up flips or 1 upa nd 1 down so its overall better to flip for that path even if the 1 flip level was borderline negative say. For example if it is 66.3% chance to be good and 33.7% to be bad then 1 flip alone is negative EV (need 2/3 to be ok and 66.3%<2/3). But if you have 2 flips left maximum the bad flip stops things and leads to eg -1 with some probability (probability to be bad say 0.337 times 0.52 + probability to be good say 0.663* 0.49)=.50011 at which point the decision to stop happens. The chance to flip heads though ie 0.49989 leads to +1 and another flip after that is now positive say (over 2/3 profile updates probability ) by a little bit say if the new updated probability becomes eg 67% it will be 0.67*(0.02)-0.33*0.04=0.0002.

So the EV of flipping with 2 left from a 66.3% position becomes really 0.49989*(1+0.002)-0.50011*1=+0.00077978. So although the 1 flip left level is negative EV (0.50011*(-1)+0.49989*1) the 2 flips level is positive, so you chose to flip then based on the entire future EV not the EV of the single next flip.

Now of course we need to properly formalize this with equations that start by solving the problem backwards from the end assigning every outcome position some net EV and stopping only when the net future EV is negative.

What is your proposal?

Last edited by masque de Z; 12-14-2015 at 06:42 PM.
Coin Flipping Infinite Involving Paradox Quote
12-14-2015 , 08:11 PM
That's basically what I did when DS asked one of these awhile back. Enumerate the outcomes after all N flips. Then when pondering the nth flip, compare what you have in hand to the weighted average of the two possibilities (based on what you think the odds of the coin are given your trials so far) and take the larger of the two values to decide whether to flip or quit. Rinse, take another step backwards, repeat.

Last edited by TomCowley; 12-14-2015 at 08:31 PM.
Coin Flipping Infinite Involving Paradox Quote
12-15-2015 , 04:32 AM
Given how complex it is to actually solve it ( i mean not a closed form etc) but also how well the -1 stop loss actually does in such tight situations of small number of flips (vs other ideas that allow more room for bad start) a decent heuristic may be necessary to introduce and test trying to improve on the -1 stop loss and get close to the real solution without actually deriving it.

So look when you want to arrive in the end eg in the N=368 going to 369 (one before the end say if 369 flips is what you are testing to find EV) case and ask yourself where do you want to be to justify a flip. You find that it must be at 188 heads at least because only then you have at least 2/3 chance its a good coin which is breakeven.

So you are at 368 level up 8 in head-tails count function call that x(n).

The heuristic now could be to have a running stop loss limit that is s(n) which starts from-1 on the first run and goes linearly to the end result +8 (ie 7 and less wont do)

So by that i mean in order to improve on the -1 stop loss strategy you can have something like a variable stop loss -1+a*n such that -1+a*368=7 or a=8/368

So you use a stop loss that is no longer fixed at -1 but stops at -1+8*n/368, rising as you go further in flips, as naturally should be expected for an improvement on the condition to stop.

If you do that and use integer values for that expression then the EV comes at 369 as +0.009 if you do 1 mil simulations say. Without the correction heuristic variable stopping line keeping it instead at -1 always the EV would have been 0.004 (less) so it is an improvement and possibly closer to the real thing.

If i started from -2 we would have had -2+a*368=7 or a=9/368 and the stop heuristic at integer value of -2+9*n/368 giving -0.015 so this is not a good heuristic.


If i then tried to see what happens at 365 for example for the 366 case the count must be at least 187 to 178 or +9. So now the heuristic starting at -1 must be like -1+a/365=8 or a=9/365 so stop at -1+9*n/365. This gives EV 0.0056. The naive -1 fixed stop loss would have given +0.0031 less as expected.

If i tried 359 for the 360 case i get 184/359 or a count of 184-175=9. The line now is -1+9*n/359. The EV comes 0.0034. The -1 naive stop loss would give EV 0.0012.

So we are getting near the 0 EV level.

Next if we try 339 for the 340 flips case i get 174/339 or count 174-165=+9. The stop loss line heuristic is now at -1+9*n/339. The EV comes as -0.0022 so we know its must be at a range like 340 to 360 level that the real answer lies.

At 345 it gets as close +0.0012 so the real thing must be around 340-345 is my final guess based on that heuristic.

Last edited by masque de Z; 12-15-2015 at 04:41 AM.
Coin Flipping Infinite Involving Paradox Quote
12-15-2015 , 12:50 PM
For N large maybe apply the Law of the Iterated Logarithm.

https://en.wikipedia.org/wiki/Law_of...ated_logarithm


PairTheBoard
Coin Flipping Infinite Involving Paradox Quote
12-15-2015 , 02:05 PM
^ Open-ended if you do sqrt(3) and sqrt(4). Latter is a little weird. Problem with a.s. is it's easy to chart irrational slopes.

Refine Fatou-Lebesgue?

https://en.wikipedia.org/wiki/Domina...rgence_theorem

If you can direct a convergence... The key isn't in Fatou's lemma so that's a time-waster I think. (Actually, I know but bah.)

Might be untapped expressions in Vitali. Not a generalization, but an overall undefined superconvergence.

/gibberish
Coin Flipping Infinite Involving Paradox Quote
12-16-2015 , 09:39 PM
I forgot about this, but my computer program did output 366 has equity ~ .000193 and N=365 has 0 equity. This contradicts what masques said maybe I made an error. Here is the program I wrote:

Code:
#python 2.7 | coinflip game

import sys
sys.setrecursionlimit(5000)
from fractions import Fraction as Fra

def memoize(f):
    class M(dict):
        def __missing__(s, k):
            r = s[k] = f(k)
            return r 
    return M().__getitem__

N = 365

P = Fra(51,100)
Q = Fra(48,100)
PI = Fra(1,1) - P
QI = Fra(1,1) - Q

@memoize
def binom((n,r)):
    ans = 1
    for i in xrange(1,r+1):
        ans *= (n-i+1)/i
    return ans

def chance(a,b):
    w1 = weight(a,b,P)
    w2 = weight(a,b,Q)
    return w1/(w1+w2)

def weight(a,b,p):
    q = 1-p
    return p**a * q**b * binom((a+b,min(a,b)))

@memoize
def solve((a,b,n)):
    #after a heads, b tails, n flips remaining
    #what is your equity?
    if n == 0: return a-b
    z = chance(a,b)
    e1 = solve((a+1,b,n-1))
    e2 = solve((a,b+1,n-1))
    hit_eq = (z*P + (1-z)*Q )*e1 + (z*PI + (1-z)*QI)*e2
    stand_eq = a-b
    return max(hit_eq, stand_eq)

print N
x = solve((0,0,N))
print x
print float(x)
Coin Flipping Infinite Involving Paradox Quote
12-16-2015 , 11:47 PM
Or maybe i did an error too. But the important thing is we kind of agree its near there lol. That cant be accidental. If you are confident its an exact answer in your case then trust yours because it would be hard to disagree on something that an exact approach gets so close to an approximation/simulation (after all these things have EV that is so small anyway to matter for any real life application and the essential thing is really strategy itself that works on everything and the fact it says around 365 (true for both) is all getting very tough to break even.

Can you mathematically describe what you are doing so that all can follow easier myself included (need to learn Python, add one more to the list) ?


I will redo my simulations with higher accuracy too to be more responsible in my answer because near zero it takes a big number to be accurate. The primary scope of my last post was to illustrate a heuristic improvement on -1 stop loss, not to actually find the answer to be honest (it would have never done that because it was a heuristic but hopefully gotten close which it did). I was trying to offer insight into what the solution must look like more or less.

I just did a deeper simulation (3 mil points) at 365 and gave me 0.0013 on the heuristic so you should likely trust your result as this is getting to be so small already given what it was say a few flips higher (10 times larger say). (so i mean maybe the 345 things needed more simulations to converge better, its not a true contradiction). Then i did a 10 mil one (still at 365) and got -0.00050. See? It is already indicative of 0 to fluctuate around it so close. The heuristic in this case is stop when it gets to smaller than the nearest integer to 8*n/364. ie stop at the nearest integer to -1+8n/364. (n from 0 to 364 the number of flips on the way to 365).

Further simulations confirm the volatile nature of 365 ie the fluctuation around 0 persisting (and tendency towards negative values slightly which would easily make the real strategy a bit better and closer to 0). So consider that an agreement in the end. Deeper simulations were needed. I got paradoxically unlucky in the decline towards 345 (the avg equity simulation results) to notice things on first runs (indicating where it was declining towards) that needed more scrutiny. It is at -0.00048 at 10 mil simulations on a different seed also now.

Last edited by masque de Z; 12-16-2015 at 11:54 PM.
Coin Flipping Infinite Involving Paradox Quote
12-19-2015 , 09:39 PM
Quote:
Originally Posted by David Sklansky
I just thought of this while contemplating a gambling problem. Perhaps it has been thought of by others. Or perhaps its an obvious example of routine paradoxes of the infinite and thus doesn't deserve to be named after me. But maybe not.

There are two indistinguishable coins in a hat. One produces heads 51% of the time. The other 48%.

You choose a coin and flip it up to a million times. Every flip you bet one dollar on heads.

If you blindly flipped it all million times your EV would be negative 10K since you will wind up either about 20K winner or 40K loser. But if you are good with statistics you will give up when the evidence that its the bad coin is strong but will very rarely quit when you picked the good coin. So your actual EV will be somewhat less than PLUS 10K as you will win 20K almost half the time and lose far less the other times.

The more flips you are allowed the higher your EV. (Exactly how many flips you need promised to you before your EV is positive is a nice problem for a computer programmer.) If you were allowed a googol flips your EV would be just about 10 to the 98th dollars. And since there is that much waiting for you, you would need awful strong evidence before giving up. 30 tails to start wouldn't be enough.

But what if there is no limit to your allowable flips? With no limit to your profit if you determine its the good coin, there is no limit to how discouraging the evidence has to be before you give up. So you should never give up. But that means that your EV in this spot would be negative infinity instead of positive infinity.
Yes it would. I can't spend an infinite stack even with infinite losing coin flips so no financial problem, maybe a severe gambling addiction problem.
Coin Flipping Infinite Involving Paradox Quote

      
m