Thread Rating:

Poll

16 votes (51.61%)
12 votes (38.7%)
5 votes (16.12%)
2 votes (6.45%)
9 votes (29.03%)
3 votes (9.67%)
5 votes (16.12%)
5 votes (16.12%)
10 votes (32.25%)
7 votes (22.58%)

31 members have voted

unJon
unJon
Joined: Jul 1, 2018
  • Threads: 14
  • Posts: 2665
February 1st, 2021 at 11:54:44 AM permalink
Quote: ThatDonGuy

Median? I don't know - all I know is the mean.

Update - run 75,776 is still in progress, and is approaching 200 million rolls.



Oh. I thought you were getting output of how long each trial took. And would be simple enough to take the median over the 75,000 trials.
The race is not always to the swift, nor the battle to the strong; but that is the way to bet.
ThatDonGuy
ThatDonGuy
Joined: Jun 22, 2011
  • Threads: 101
  • Posts: 4828
February 1st, 2021 at 12:14:15 PM permalink
Quote: unJon

Oh. I thought you were getting output of how long each trial took. And would be simple enough to take the median over the 75,000 trials.


I changed my code to count how many times each length occurs rather than trying to save each length individually, and now I pretty much constantly get a median of 10 rolls.
ThatDonGuy
ThatDonGuy
Joined: Jun 22, 2011
  • Threads: 101
  • Posts: 4828
February 1st, 2021 at 2:09:01 PM permalink
Quote: ThatDonGuy

I changed my code to count how many times each length occurs rather than trying to save each length individually, and now I pretty much constantly get a median of 10 rolls.


Actually, a median of 10 can be calculated without simulation.
Assume one die is red and the other is blue, and let "the difference" be the red sum minus the blue sum.
After one roll, the difference is {-5, -4, ..., 4, 5} with probability {1/36, 2/36, ..., 2/36, 1/36}
For the second roll, if the difference after one roll is -5, the new difference is {-10, -9, ..., 1, 0) with probability {1/36 x 1/36, 1/36 x 2/36, ..., 1/36 x 2/36, 1/36 x 1/36};
if it is -4, the new difference is {-9, -8, ..., 0, 1} with probability with probability {2/36 x 1/36, 2/36 x 2/36, ..., 2/36 x 2/36, 2/36 x 1/36};
and so on through +5 becoming {0, 1, ..., 10}, except that you skip where the previous difference is zero as you would have stopped rolling at that point.
Repeat for the third, fourth, etc. rolls until the sum of all of the probabilities that the sum is zero > 1/2.
Here are the probabilities that you will get matching sums in N rolls or fewer for various values of N:
1: 1 / 6
2: 163 / 648
3: 1,211 / 3,888
4: 300,139 / 839,808
5: 993,427 / 2,519,424
6: 231,266,905 / 544,195,584
7: 1,472,751,395 / 3,265,173,504
8: 222,694,111,193 / 470,184,984,576
9: 4,176,367,195,507 / 8,463,329,722,368
10: 116,789,309,836,109 / 228,509,902,503,936
9 rolls has a probability < 1/2, and 10 has one > 1/2, so the median is 10.
unJon
unJon
Joined: Jul 1, 2018
  • Threads: 14
  • Posts: 2665
February 1st, 2021 at 2:11:27 PM permalink
Quote: ThatDonGuy

Actually, a median of 10 can be calculated without simulation.
Assume one die is red and the other is blue, and let "the difference" be the red sum minus the blue sum.
After one roll, the difference is {-5, -4, ..., 4, 5} with probability {1/36, 2/36, ..., 2/36, 1/36}
For the second roll, if the difference after one roll is -5, the new difference is {-10, -9, ..., 1, 0) with probability {1/36 x 1/36, 1/36 x 2/36, ..., 1/36 x 2/36, 1/36 x 1/36};
if it is -4, the new difference is {-9, -8, ..., 0, 1} with probability with probability {2/36 x 1/36, 2/36 x 2/36, ..., 2/36 x 2/36, 2/36 x 1/36};
and so on through +5 becoming {0, 1, ..., 10}
Repeat for the third, fourth, etc. rolls until the sum of all of the probabilities that the sum is zero > 1/2.
Here are the probabilities that you will get matching sums in N rolls or fewer for various values of N:
1: 1 / 6
2: 163 / 648
3: 1,211 / 3,888
4: 300,139 / 839,808
5: 993,427 / 2,519,424
6: 231,266,905 / 544,195,584
7: 1,472,751,395 / 3,265,173,504
8: 222,694,111,193 / 470,184,984,576
9: 4,176,367,195,507 / 8,463,329,722,368
10: 116,789,309,836,109 / 228,509,902,503,936
9 rolls has a probability < 1/2, and 10 has one > 1/2, so the median is 10.



And there’s our gambling game. The house offers an even money bet that the red and blue dice are equal. Gambler can take the yes within nine rolls or the no within 10 rolls.
The race is not always to the swift, nor the battle to the strong; but that is the way to bet.
Wizard
Administrator
Wizard
Joined: Oct 14, 2009
  • Threads: 1382
  • Posts: 23104
February 1st, 2021 at 2:53:15 PM permalink
This table shows the probability of equal totals after exactly a given number of rolls for the first time.

Rolls Probability
1 0.166667
2 0.112654
3 0.092850
4 0.080944
5 0.072693
6 0.066539
7 0.061722
8 0.057819
9 0.054573
10 0.051819
11 0.049443
12 0.047367
13 0.045532
14 0.043895
15 0.042423
16 0.041089


Excel shows a very close fit to this curve is y = 0.1784*x-1.011, where x = number of rolls and y = probability.
It's not whether you win or lose; it's whether or not you had a good bet.
teliot
teliot
Joined: Oct 19, 2009
  • Threads: 39
  • Posts: 2209
February 1st, 2021 at 4:15:33 PM permalink
Quote: Wizard

This table shows the probability of equal totals after exactly a given number of rolls for the first time.

Rolls Probability
1 0.166667
2 0.112654
3 0.092850
4 0.080944
5 0.072693
6 0.066539
7 0.061722
8 0.057819
9 0.054573
10 0.051819
11 0.049443
12 0.047367
13 0.045532
14 0.043895
15 0.042423
16 0.041089


Excel shows a very close fit to this curve is y = 0.1784*x-1.011, where x = number of rolls and y = probability.

And the "average" waiting time for equality is the dot product (or sumproduct in Excel) of those two columns, if extended to the infinite Excel spreadsheet in the sky..
Poetry website: www.totallydisconnected.com
teliot
teliot
Joined: Oct 19, 2009
  • Threads: 39
  • Posts: 2209
February 1st, 2021 at 4:25:23 PM permalink
I saw this integral on Twitter yesterday. The method the person gave to get the answer seemed too advanced, and I thought there must be an easier way. I believe I found an easier way.



If you think about this integral for a few minutes and what function the sin(x) function approximates near x = 0, the answer to this integral is obvious. Getting there is the hard part.
Poetry website: www.totallydisconnected.com
ThatDonGuy
ThatDonGuy
Joined: Jun 22, 2011
  • Threads: 101
  • Posts: 4828
February 2nd, 2021 at 6:00:01 PM permalink
Quote: teliot

I saw this integral on Twitter yesterday. The method the person gave to get the answer seemed too advanced, and I thought there must be an easier way. I believe I found an easier way.



If you think about this integral for a few minutes and what function the sin(x) function approximates near x = 0, the answer to this integral is obvious. Getting there is the hard part.


I can't come up with an "exact" solution, but I think I have found a reasonable estimate:


Integrate by parts:

u = sin (x^n); dv = x^(-n) dx
du = n x^(n-1) cos (x^n) dx; v = x^(1-n) / (1-n)

INTEGRAL{sin (x^n) / x^n dx) = x^(1-n) sin (x^n) / (1-n) - INTEGRAL{n / (1-n) * x^(n-1) x^(1-n) cos (x^n) dx)
= x^(1-n) sin (x^n) / (1-n) - n / (1-n) * INTEGRAL{cos (x^n) dx)
= x^(1-n) sin (x^n) / (1-n) + n / (n-1) * INTEGRAL{cos (x^n) dx)

On the left half of the plus sign, x = 1 has a value of sin 1 / (1-n), and x = 0 has a value of 0, so, as n approaches +INF, the value approaches 0.
On the right side, note that, for 0 < x < 1, as n approaches +INF, x^n approaches 0, so the graph approaches a horizontal line from (0,1) to (1,1) and then a vertical line from (1,1) to (1,0), whose integral from 0 to 1 = 1.
The solution is 0 + 1 = 1.

teliot
teliot
Joined: Oct 19, 2009
  • Threads: 39
  • Posts: 2209
February 2nd, 2021 at 6:27:27 PM permalink
The way I did it was to plug in the Taylor series for sin(x) and pull the sum outside of the integral so that all that was left was integrating a power of x. A couple more tricks are needed after that to deal with the "discontinuity" at x=1. But yes you got the right answer even though integration by parts is never going to lead to a complete solution.
Last edited by: teliot on Feb 2, 2021
Poetry website: www.totallydisconnected.com
Gialmere
Gialmere
Joined: Nov 26, 2018
  • Threads: 41
  • Posts: 1964
February 9th, 2021 at 8:05:20 AM permalink
For Toughie Tuesday...



I hate to just toss a sudoku on the table but, if you haven't played in a long time or only dabble, you might enjoy the cutting edge of these puzzles.

The one above--by the Dutch master Aad van der Wetering--at first glance seems impossible. However, in addition to the normal sudoku rules (which I assume you're familiar with), this puzzle has three special rules to help you solve it.

1: Both marked diagonals must contain the digits 1-9. (Just like a standard row or column.)

2: Cells that are a chess knight's move apart cannot contain the same digit. (Thus if you put a 6 in a cell and there's another 6 a knight's move away, something is wrong.)

3: The central 3x3 box (shaded gray) must form a magic square. (That is, each row, column and diagonal must add up to the same amount.)

A challenging puzzle. Good luck.
Have you tried 22 tonight? I said 22.

  • Jump to: