# surprising behavior of Sum

Compare the following. (The option specified is the default value; just to be explicit.)

Sum[b^n, {n, 0, ∞}, VerifyConvergence -> True]  (* 1/(1-b) *)
Sum[2^n, {n, 0, ∞}, VerifyConvergence -> True]  (* failure to converge *)


Is this difference behavior deducible from the documentation? Should the first result be considered a bug, or just a feature that counts on user discretion?

• $\sum^\infty_{i=1}{i^n}|i<1$ is a well known sum, this is more a basic maths question. – Feyre Sep 5 '16 at 13:47
• This issue comes up a lot: (13275), (46453), (83957), (91450), (109712), etc. We should probably have a canonical Q&A, and additionally it should be added to (18393) – Mr.Wizard Sep 6 '16 at 16:55

One option Sum provides is GenerateConditions

Sum[b^n, {n, 0, ∞}, GenerateConditions -> True]
Sum[2^n, {n, 0, ∞}, GenerateConditions -> True]


The first replies:

ConditionalExpression[1/(1 - b), Abs[b] < 1]


while the second gives the Sum does not converge warning.

• Plus, the documentaiton has remarks such as "Use GenerateConditions to get the conditions under which the answer is true:", "Get the conditions for summability:", "Get the conditions for convergence:", etc. – Szabolcs Sep 5 '16 at 13:08
• @Szabolcs That's a bit useful, but what documentation are you looking at. I'm looking here reference.wolfram.com/language/ref/Sum.html and here reference.wolfram.com/language/ref/GenerateConditions.html Also, please see my subsequent comment. – Alan Sep 6 '16 at 3:26
• Bill, I might be missing your point or misunderstanding GenerateConditions ... I expected the result you report, but my question is about the result when GenerateConditions has the default value of False. The value returned is valid only for a very restricted range of b. Why is that the correct thing for Mma to return in this case? What is the principle at work? – Alan Sep 6 '16 at 3:32
• @Alan It's the Sum page you linked to. I agree it's not easy to find. It's among the examples. – Szabolcs Sep 6 '16 at 6:50
• @Alan -- I certainly can't speak for the developers intent in choosing the default options. It does go to underscore that you can't blindly trust computer algebra systems. Maybe a good motto would be "trust but verify". – bill s Sep 6 '16 at 13:37

Some divergent sums can be evaluated using Regularization. In this specific case, Regularization->"Borel" gives the result that you expected from your first Sum

Sum[2^n, {n, 0, ∞}, Regularization -> "Borel"]

(*  -1  *)


Your first Sum is

f1[b_] = Sum[b^n, {n, 0, ∞}]

(*  1/(1 - b)  *)


While the Sum converges only for Abs[b] < 1, the closed form is defined for b != 1

FunctionDomain[f1[b], b]

(*  b < 1 || b > 1  *)


The regularized Sum is

f2[b_] := Sum[b^n, {n, 0, ∞}, Regularization -> "Borel"]


As with f1, f2 is undefined

f2

(*  Sum[1, {n, 0, ∞}, Regularization -> "Borel"]  *)


However, f2 is also undefined since 0^0 (the first term) is undefined

f2

(*  Sum[0^n, {n, 0, ∞}, Regularization -> "Borel"]  *)


Demonstrating that the functions are equivalent (except for b == 0)

Plot[{f1[b], f2[b]}, {b, -3, 3},
Exclusions -> {b == 0, b == 1},
PlotStyle -> (AbsoluteDashing[#] & /@
{{5, 5}, {10, 10}}),
PlotLegends -> {f1, f2}] However, f2 is much slower

AbsoluteTiming[ans1 = f1 /@ Cases[Range[-3, 3, 1/20], _Rational];]

(*  {0.000225, Null}  *)

AbsoluteTiming[ans2 = f2 /@ Cases[Range[-3, 3, 1/20], _Rational];]

(*  {1.62083, Null}  *)


Verifying that results are identical

ans1 === ans2

(*  True  *)

• Thanks, but I am not asking about regularization. I am asking why the first case returns a result that is not generally true (and in fact is true for a narrow range of parameter values). Since the default Regularization is None, I don't think that the possibility of regularization justifies the return value in the first case. What is the principle at work. I realize Mma often returns expressions that are not true for all parameter values, but usually this is a matter of ignoring singularities in order to produce a generally useful result. This example does not fit that justification. – Alan Sep 6 '16 at 3:38