Our problem is that the 2 methods provided agree for small problems but disagree on the large one. Why is this?
Before we can answer that we need to find out which answer is correct so we do the problem in a third way.
With 10000 throws of a die what is the coefficient of x^50000?
This is equivalent to the diophantine equation:
a1 + a2 + a3 + ... a10000 = 50000
with 1 <= a1,a2,...a10000 <= 6
We make a change of variable.
a1 = a1+1, a2 = a2+1, a3 = a3+1, ...a10000=a10000+1
we get
a1 + a2 + a3 + ... + a10000 +10000 = 50000
this becomes
The equation becomes
a1 + a2 + a3 + ... + a10000 = 40000
0 <= a1,a2,...,a10000 <= 5
with the answer being the coefficient of x^40000
The gf for that is:
You should recognize that
are the coefficients with no restrictions.
Now
Only the terms x^6 to x^39996 could possibly contribute to the coefficient of x^40000, making the final answer:
The whole process looks a lot like a PIE so it can be generalized to the following series. For,
with
In Mathematica speak:
r = 40000;
n = 10000;
m = 5;
ans = Binomial[r + n - 1, n - 1] +
Sum[(-1)^
k Binomial[n, k] Binomial[(r + n - 1) - (m + 1) k, n - 1], {k, 1,
Floor[r/(m + 1)]}];
To get the probability of the sum being 50000:
Which agrees with Part 2's answer. We can now safely say that the result in Part 1 is incorrect.
Okay, what went wrong?
Numerical methods are not infallible and some sort of round off error is destroying the precision of the complex analysis method. This happens and we should forgive those mathematicians who love it so much.
That method is typical of guys who think their beloved complex analysis is truly amazing and naively think what they know from textbooks works in the real world. Kaboobly doo!
I see the problem! When will you post part 3?
]]>As soon as you get the correct answer you will see that there is an even bigger problem looming on the horizon. Also, then will come Part 3.
]]>Use this one:
RecurrenceTable[{a[n] ==
1/(-10000 +
n) (60005 a[-5 + n] - n a[-5 + n] + 50004 a[-4 + n] -
n a[-4 + n] + 40003 a[-3 + n] - n a[-3 + n] +
30002 a[-2 + n] - n a[-2 + n] + 20001 a[-1 + n] -
n a[-1 + n]), a[10000] == 1, a[10001] == 10000,
a[10002] == 50005000, a[10003] == 166716670000,
a[10004] == 416916712502500}, a, {n, 10000, 50000}] // Last;