# Why doesn't Mathematica provide an answer while Wolfram|Alpha does, concerning a series convergence?

Among other series I've been working on, I was asked to find whether $$\sum_n 1-\cos(\frac{\pi}{n})$$ converged, and Mathematica's output to SumConvergence[1 - Cos[Pi/n], n] simply was repeating the input, without further information. Wolfram|Alpha, though, at least told me which test were or not conclusive.

I'm new to Mathematica, and even though I've looked both on Google and into Wolfram's documentation, I haven't found information that could help me figure out how to get, from Mathematica, the conditions for the convergence of a series involving something else than powers of a variable.

I would appreciate if you could give me some clues on the typical procedure to make Mathematica correctly evaluate the convergence of a series, or/and to return the conditions for convergence. Thank you in advance.

• SumConvergence does not have Comparison Test which Wolfram Alpha used to determine it convergence. Not sure how Wolfram alpha found the other series to compare with, but Wolfram Alpha uses AI. May be that is why it was smarter in this case than Wolfram Mathematica, or may be it is using version that is not yet released for Wolfram Mathematica. The methods that SumConvergence uses are integral test, Raabes, Ratio test, root test Jun 16, 2020 at 13:12
• What about the methods one would use to evaluate that series on Mathematica? Jun 16, 2020 at 18:39
• The answer here is this: mathematica.stackexchange.com/a/257607 It prints 2 which is convergent. Nov 29, 2021 at 6:57

This is a bug in mathematica, still present in 13.0.1 not like in https://mathematica.stackexchange.com/a/259312/82985, there DivergenceTest fails (since older buggy version of Limit is used inside SumConvergence[]) and thus no other tests are applied. Here RaabeTest has a bug because (IMHO) it cannot check the sequence is nonnegative (indeed the cos term goes to 1 after x is 2, but changes sign there, may be not obvious that after doing "1-" it is all positive).

So doing Raabe test by hand allows to find (>1 is convergent):

b[n_] = 1 - Cos[Pi/n];

Limit[n (b[n]/b[n + 1] - 1), n -> Infinity] (* 2 *)


or even Bertrand test (it is used if previous test is 1 so useless, but can be used even if Raabe test is good, it will be just Infinity or -Infinity) (>1 is convergent).

Limit[Log[n] (n (b[n]/b[n + 1] - 1) - 1), n -> Infinity] (*Infinity*)


P.S.

SumConvergence[a[n], n, Method -> "RaabeTest"]

just returns unevaluated.

BTW, it is also quite bad that Mathematica does not have Bertrand test.

• The Raabe test "fails" (that is, the internal code returns \$Failed) because the summand contains a trigonometric function. It is explicitly tested internally. May 28, 2022 at 16:14
• Further, the Raabe test is not attempted in SumConvergence[1 - Cos[Pi/n] // TrigToExp, n] because the summand contains a complex number. May 28, 2022 at 16:38
• You might be interested in this. I showed how to add Bertrand's test to SumConvergence here: mathematica.stackexchange.com/q/268826/4999 May 29, 2022 at 16:21
• Another example (RaabeTest does not work, but does work by hand, FunctionRange does not work) mathematica.stackexchange.com/questions/185209/… Jul 2, 2022 at 23:10

Here's a hack, which works in V13.0.1:

The Raabe test "fails" internally because if the summand contains a trigonometric function, which is explicitly tested for, the Raabe test is not tried. Also if a complex number is present in the integrand, then the Raabe test is not tried, so the following does not work:

SumConvergence[1 - Cos[Pi/n] // TrigToExp, n] (* FAILS *)


So we have to get even trickier:

a // ClearAll;
a[n_] /; MemberQ[Stack[], Limit] := 1 - Cos[Pi/n];
SumConvergence[a[n], n]
(*  True  *)


This hides the Cos until it is inside Limit.

I assume the trigonometric functions are excluded for the reason @Валерий Заподовников points out, that it is too difficult to determine the signs of the terms. For instance, this takes about 0.25, which is fairly slow for an easy problem:

ClearSystemCache[];
Simplify[
Reduce[
n > 10^5 \[Implies]
(1 - Cos[Pi/n]) Sign[1 - Cos[Pi/n] /. n -> 10^5] > 0,
n],
n ∈ Integers && n > 10^5] // AbsoluteTiming

(*  {0.244874, True}  *)

• So it is a duplicate of mathematica.stackexchange.com/a/163329/82985 where myLCT and FreeQ methods work (I did mention that in mathematica.stackexchange.com/a/259312/82985). You need to only check that it is nonnegative since some n. May 29, 2022 at 9:42
• FunctionRange[1-Cos[Pi/n], n, y] works too. Of course there may be a need to do n ∈ Integers there too. That is 2 times faster. Of course we only care about 1, 2, 3 ... for n. May 29, 2022 at 12:02