0
$\begingroup$

In one of my calculations, I run the command:

Sum[(StirlingS2[k - 1, 4] + StirlingS2[k, 4])/6^k, {k, Infinity}]

Surprisingly, Mathematica (run on Wolfram Cloud) does not want to perform this very simple summation, returning the definition of the command.

Even more surprisingly, the function starts returning numerical result if the argument of the first StirlingS2 is changed from k - 1 to k, but it processes the summation still incredibly long (it is just a sum of eight geometric series!).

What is the reason for the problem?

$\endgroup$
5
  • 2
    $\begingroup$ ListPlot[Table[Sum[(StirlingS2[k-1,4]+StirlingS2[k,4])/6^k,{k,2,j}],{j,2,32}]] strongly hints what the sum out to Infinity might be, unless you need some astonishing precision. Whether you start from 1 to j or 2 to j doesn't seem to make any obvious difference. So maybe the algorithm is fast for modest upper bounds and far slower for Infinite bounds. And maybe an infinite summation isn't as simple as you imagine it to be. $\endgroup$
    – Bill
    Commented Feb 21, 2021 at 3:46
  • $\begingroup$ You should avoid using the bugs tag until your issue is confirmed to be a bug by the community. Simply returning the input probably means that Mathematica doesn't know the answer rather than it encountering some kind of bug. $\endgroup$
    – MassDefect
    Commented Feb 21, 2021 at 4:13
  • $\begingroup$ @Bill Possibly I overestimate Mathematica. For me the result $\sum_{n=0}^\infty x^n=\frac1{1-x}$ for $|x|<1$ does not require long computation. Probably Mathematica does not recognize the sum. And the reason for the problem with the lower limit I cannot even guess. $\endgroup$
    – drer
    Commented Feb 21, 2021 at 7:39
  • 1
    $\begingroup$ I would appreciate if the downvoters communicate what they don't like in my question so that I could improve it. $\endgroup$
    – drer
    Commented Feb 21, 2021 at 10:04
  • $\begingroup$ Index shifting leads to joy: Sum[(StirlingS2[k, 4] + StirlingS2[k + 1, 4])/6^(k + 1), {k, 0, ∞}] $\endgroup$ Commented Feb 22, 2021 at 16:17

1 Answer 1

4
$\begingroup$
Clear["Global`*"]

As you indicated, the problematic term is the one with StirlingS2[k-1, 4]

sum1 = Sum[#, {k, 1, Infinity}] & /@ 
  Expand[(StirlingS2[k - 1, 4] + StirlingS2[k, 4])/6^k]

enter image description here

Translate the index,

eqn1 = Inactive[Sum][StirlingS2[k - 1, 4]/6^k, {k, 1, Infinity}] == 
  Inactive[Sum][StirlingS2[k, 4]/6^(k + 1), {k, 0, Infinity}]

enter image description here

sum2 = eqn1[[-1]] // Activate

(* 1/720 *)

Adding the partial sums,

sum = sum1[[1]] + sum2

(* 7/720 *)

Checking numerically,

NSum[(StirlingS2[k - 1, 4] + StirlingS2[k, 4])/6^k, {k, 1, Infinity}] // 
  RootApproximant // Quiet

(* 7/720 *)

EDIT: Timing

Clear["Global`*"]

$HistoryLength = 0;

Sum[StirlingS2[k, 4]/6^k, {k, Infinity}] // RepeatedTiming

(* {0.00014183, 1/120} *)

Sum[(StirlingS2[k, 4] + StirlingS2[k, 4])/6^k, {k, 
   Infinity}] // RepeatedTiming

(* {0.000171701, 1/60} *)
$\endgroup$
7
  • $\begingroup$ Do you have an explanation for this behavior? $\endgroup$
    – drer
    Commented Feb 21, 2021 at 10:09
  • 1
    $\begingroup$ For whatever reason, Mathematica does not have a pattern rule that matches StirlingS2[k - 1, 4] and it returns unevaluated. Manual intervention is needed to enable it to find a matching pattern. $\endgroup$
    – Bob Hanlon
    Commented Feb 21, 2021 at 17:19
  • $\begingroup$ Can you clarify why the computation of the sum involving two Stirling numbers is several orders of magnitude slower than that involving a single number? $\endgroup$
    – drer
    Commented Feb 21, 2021 at 18:00
  • $\begingroup$ You don't say which two sums you are comparing so I have no way of guessing. If the sum with two Stirling numbers includes one that doesn't evaluate to a closed form, then I would assume that a lot of time is spent unsuccessfully trying transformations in an effort to find a closed form. $\endgroup$
    – Bob Hanlon
    Commented Feb 21, 2021 at 18:10
  • $\begingroup$ I indicated in my question that the "test" was performed after I replaced $k-1$ with $k$ in the first term. So they both were evaluated. And I compared the timing with the sum involving one of the both terms. It was several orders of magnitude faster. $\endgroup$
    – drer
    Commented Feb 21, 2021 at 18:16

Your Answer

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

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