I am trying to evaluate a infinite series: $$ 2 \sum _{l=1}^{\infty } \Re\left(n^{\frac{2 i \pi l}{\log (q)}} \Gamma \left(\alpha -\frac{2 i l \pi }{\log (q)}\right)\right) $$ With the code:

delta[\[Alpha]_, q_, n_] = 
 2 Sum[Re[Gamma[\[Alpha] - I 2 l \[Pi]/Log[q]] Exp[
      I 2 l \[Pi] Log[n]/Log[q]]], {l, 1, Infinity}]

But Mathematica complaints:

NSum::nsnum: Summand (or its derivative) ((0. +3.14159 I) 2.^(1. +(0. +2.72875 I) l) 5.^((0. +2.72875 I) l) Gamma[1. -(0. +2.72875 I) l]-(0. +1.36438 I) 2.^(1. +(>) l) > Gamma[1. -(0. +>) l] PolyGamma[0.,1. -(0. +2.72875 I) l]) > is not numerical at point l = 16.

Please help me to evaluate it or explain the problem, Thanks!


2 Answers 2


Using Mathematica, I do not receive the error message you did. However, Sum returns unevaluated, which happens when Sum cannot do the summation. Since you are seeking a numerical answer, I suggest that you use a large upper bound on your Sum instead of Infinity. For instance,

delta[\[Alpha]_, q_, n_] := 2 Sum[Re[Gamma[\[Alpha] - I 2 l \[Pi]/Log[q]] 
    Exp[I 2 l \[Pi] Log[n]/Log[q]]], {l, 1, 100}];
N[delta[1, 10, 10]]
(* 0.0818184 *)

Incidentally, I tried NSum instead, but it did not return an answer in a reasonable time.

  • $\begingroup$ Thank you for trying the code. Maybe I am too greed to let Mathematica to compute the infinite sum. You're right, I am trying a bigger upper bound now. By the way, I am using Mathematica Thanks very much! $\endgroup$
    – robit
    Jan 20, 2015 at 8:29

delta[\[Alpha]_?NumericQ, q_?NumericQ, n_?NumericQ] :=
   {z = I 2.0` l \[Pi]/Log[q]},
   Re[2 NSum[Gamma[\[Alpha] - z] n^z,
      {l, 1, Infinity}]]];

delta[1, 10, 10]


  • $\begingroup$ It does work! And produce the answer in a reasonable time,While The code of @bbgodfrey did not. But why is the use of Module accelerate the calculation of Nsum? Because the compact expression with local variable z? $\endgroup$
    – robit
    Jan 21, 2015 at 6:24
  • $\begingroup$ The compact form (reuse of sub calculation of local variable z) helps to speed the calculation up; however, the major cause of the speed up is doing the calculation with approximate real numbers rather than exact numbers and using NSum rather than Sum. $\endgroup$
    – Bob Hanlon
    Jan 21, 2015 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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