in reply to Average random depth formula required

Don't bother simulating rolls, just multiply the value of each possibility by the odds of reaching it, and hope you've got a converging series.

For the simple case of a chance of stopping at each integer, its pretty simple.

∑ak = 1 / (1 - a)
For reasonable values of a, of course.

Also, ∑k*ak = a / (1 - a)2

As an example, for a 50/50 flip, you'll average two flips before losing.
0.5 / (1-0.5)2 = 0.5 / (0.52) = 0.5 / 0.25 = 2
  • Comment on Re: Average random depth formula required

Replies are listed 'Best First'.
Re^2: Average random depth formula required
by palkia (Monk) on May 01, 2012 at 22:43 UTC
    Thx
    This is pretty much how I figured the "$splt = 1" case
    (although ∑a^k is a / (1 - a) not 1 / (1 - a) as k starts at 1 since $chance=0 causes the return of "zero" value !)
    but how can it be implemented to solve for "$splt = 2" ?
    Yeah I know "sum over value times odds" but it seems like that approach goes requires some very complicated combinatorial problem solving.
    if(you see something I'm missing){please share ^^}

    bry: while checking for "$splt=2", I discovered the value of "1" is returned when "$chance" is about 0.35793
    for which I can't find any special properties
    (maybe that exp(0.35793^0.35793) ~ 2, but not counting on it being the actual exact value ^^)

      A chance of 0 means your average depth is going to be zero. If you are counting the number of coin flips instead of the number of wins, then you need to add one to the result ;)

      That odd number should probably be 1/e = ~0.367879441

        Right you are, I do count the "wins" ^^.

        1/e is a nice guess (theorized it myself in some point),
        but the number I mentioned is very accurate (just doesn't include many digits so..).
        bty, 1/e returns an average of about 1.08 +- 0.0001, while the mentioned number gives an average of about 1 +- 0.0001.

        Any idea how to solve this thing ?