1
$\begingroup$

I would like to know the numerical value of a giant fraction, which I got from doing some combinatoric calculation (n choose k gets huge).

For example, say I have

Sum[Binomial[2048, k] (1/5)^k (4/5)^(2048 - k), {k, 9728/25, 10752/
  25}]

This code runs fine and gives me a huge fraction, and I know its value should be somewhere between .6 and 1. However, I cannot simply use N[] or Round[] since the value gets too large/too small as Mathematica tries to work it out and reaches the precision limits of machine numbers.

What other options do I have for finding the value of this fraction?

$\endgroup$
1
  • 1
    $\begingroup$ Note that sometimes even numeric expressions can be simplified. LeafCount /@ {sum, sum // Simplify} evaluates to {575, 295} $\endgroup$
    – Bob Hanlon
    Dec 21, 2022 at 5:54

2 Answers 2

2
$\begingroup$

one option

res = Sum[Binomial[2048, k] (1/5)^k (4/5)^(2048 - k), {k, 9728/25, 10752/25}];
N[res, 50]

Mathematica graphics

Compare to

N[res]

Mathematica graphics

Note that N with no options uses MachinePrecision. From help

enter image description here

Which is only

Mathematica graphics

But note what help says

enter image description here

$\endgroup$
0
1
$\begingroup$

Better is using general symbolic solution of series:

series = Sum[Binomial[c, k] (1/5)^k (4/5)^(c - k), {k, a, b}, Assumptions -> {a > 0, b > 0, c > 0, c > b}]

(*4^(-1 - a - b + c) 5^-c (4^(1 + b)
 Binomial[c, a] Hypergeometric2F1[1, a - c, 1 + a, -(1/4)] - 
4^a Binomial[c, 1 + b] Hypergeometric2F1[1, 1 + b - c, 
 2 + b, -(1/4)])*)

f = series /. {a -> 9728/25, b -> 10752/25, c -> 2048} (*Short expression*)

N[f, 20]

(*0.75358037090014508511*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.