# Indeterminant numerical value of summation

I have the following two-fold summation.

lim = 300;
Sum[((-1)^(n1 + n2) Gamma[5 + n1] (0.1)^(-1 - n1/5) (0.1)^(-1 - n2))/(
5 Gamma[1 + n1] Gamma[29/3 + n1 + n2]), {n1, 0, lim}, {n2, 0, lim}]


which works fine and gives the correct numerical result 0.000577481. But now if I increase the summation upper-limit to 400, then Mathematica shows Indeterminant and Complex Infinity encountered. This is not expected because no terms between lim=300 and 400 blows up.

This is a possible issue with internal default numerical precision. Hence, I tried to increase $MaxExtraPrecision and $MaxPrecision as follows,

lim = 400;
Sum[Block[{$$MaxExtraPrecision = Infinity,$$MaxPrecision = Infinity},
N[((-1)^(n1 + n2) Gamma[5 + n1] (0.1)^(-1 - n1/5) (0.1)^(-1 - n2))/(
5 Gamma[1 + n1] Gamma[29/3 + n1 + n2]), Infinity] // Quiet], {n1,
0, lim}, {n2, 0, lim}]


But still, the same error persists.

Any reason for this behaviour, and what is the solution to this?

• I think that Simplify might give a more stable version of your summand. Both your numerator and denominator are going to be very large. Sep 3, 2021 at 13:02
• You can use 1/10 instead of 0.1 and get an exact answer. N[answer, precision] will give the decimal value to precision digits. Sep 4, 2021 at 21:12

Clear["Global*"]


Instead of machine precision (0.1), use arbitrary-precision (0.120)

expr = ((-1)^(n1 + n2) Gamma[
5 + n1] (0.120)^(-1 - n1/5) (0.120)^(-1 - n2))/(5 Gamma[1 + n1] Gamma[
29/3 + n1 + n2]);

sum[lim_] := Sum[expr, {n1, 0, lim}, {n2, 0, lim}]

sum[400]

(* 0.00057748068405058200 *)

Precision[%]

(* 17.5845 *)

sum[500]

(* 0.00057748068405058200 *)

Precision[%]

(* 17.5845 *)

sum[Infinity]

(* 0.00057748068405058199972 + 0.*10^-24 I *)

Precision[%]

(* 20. *)


You can remove the imaginary artifact with Chop