1

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?

Rotartsi
  • 113
  • 4
  • 1
    Note that sometimes even numeric expressions can be simplified. LeafCount /@ {sum, sum // Simplify} evaluates to {575, 295} – Bob Hanlon Dec 21 '22 at 05:54

2 Answers2

2

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

Nasser
  • 143,286
  • 11
  • 154
  • 359
1

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)

Mariusz Iwaniuk
  • 13,841
  • 1
  • 25
  • 41