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.

  • 3
    $\begingroup$ 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 $\endgroup$
    – Nasser
    Jun 16, 2020 at 13:12
  • $\begingroup$ What about the methods one would use to evaluate that series on Mathematica? $\endgroup$
    – Albert
    Jun 16, 2020 at 18:39
  • $\begingroup$ The answer here is this: mathematica.stackexchange.com/a/257607 It prints 2 which is convergent. $\endgroup$ Nov 29, 2021 at 6:57

2 Answers 2


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*)


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

just returns unevaluated.

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

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

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

(*  {0.244874, True}  *)

Your Answer

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

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