Bug in summing series
- To: mathgroup@smc.vnet.net
- Subject: [mg11582] Bug in summing series
- From: "Ruben Krasnopolsky (without any z)" <rubenz@tapir.caltech.eduz>
- Date: Tue, 17 Mar 1998 10:43:03 -0500
- Organization: Caltech
- References: <6e7vgj$mrg@smc.vnet.net>
Hi, Here is a bug report:-( Recently I found many wrong results summing infinite series using Mathematica. I have already reported them to support@wolfram.com. Meanwhile, here they are for the ng to see. Some other bugs in summing series can be seen at http://www.wolfram.com/support/Kernel/Symbols/System/Sum.html Maybe those are related to the bugs reported here. The version of Mathematica used here is 3.0, running either on HP-UX, Solaris, Linux or MSWindows. An installation here of Version 2.2, running on MSWindows) didn't show these bugs, maybe because it was lacking the feature of doing the sums in these examples analytically, so it did only a numerical sum, which was correct. I had at first the need to find the sum of the series In[1]:= Sum[n^2/(4 n^2 -1)^5,{n,1,Infinity}] 2 4 144 + 15 Pi - Pi Mathematica answered with Out[1]= ------------------ 12288 2 4 15 Pi - Pi But the correct result is ------------- 12288 Even weirder, the sum of the series of positive terms Sum[1/(4 n^2 -1)^4,{n,1,Infinity}] gave as output (-576 + 30 Pi^4 + Pi^4)/768, which is a negative number --it can't be right! The correct result here is (-384 + 30 Pi^2 + Pi^4)/768, found by adding 1/4 to the wrong output. Other bad results can be seen by comparing finite sums to the infinite ones: # In[3]:= Table[{Sum[(2 n-1)^-j,{n,1,Infinity}]},{j,2,5}] # # 2 4 # Pi 16 + 7 Zeta[3] Pi 64 + 31 Zeta[5] # Out[3]= {{---}, {--------------}, {---}, {---------------}} # 8 8 96 32 # In[4]:= Table[{N[Sum[(2 n-1)^-j,{n,1,Infinity}]]},{j,2,5}] # Out[4]= {{1.2337}, {3.0518}, {1.01468}, {3.00452}} # # In[5]:= Table[{N[Sum[(2 n-1)^-j,{n,1,100}]]},{j,2,5}] # Out[5]= {{1.2312}, {1.05179}, {1.01468}, {1.00452}} The results are approximately the same for j=2 and 4, as it should be. For j=3 and 5, the finite sums are giving a correct result, but the infinite sum is off by 2. The following sum should have given some infinity, as the first term for m=1 is divergent: # In[30]:= Sum[1/(m-1)^3,{m,1,Infinity}] # Out[30]= 2 + Zeta[3] But it didn't diverge. I then tried (working with a friend here at Caltech) a change of variables, shifting the lower bound by doing m=n+1-shift in the sum above. The result was strangely dependent on the value of the shift: # In[37]:= Table[Sum[1/((n+1-shift)-1)^3,{n,shift,Infinity}], # {shift,-4,4,1/2}] # # General::dbyz: Division by zero. # # General::dbyz: Division by zero. # # General::dbyz: Division by zero. # # General::stop: Further output of General::dbyz # will be suppressed during this calculation. # # Out[37]= {ComplexInfinity, ComplexInfinity, ComplexInfinity, # ComplexInfinity, ComplexInfinity, ComplexInfinity, # ComplexInfinity, ComplexInfinity, ComplexInfinity, # ComplexInfinity, 2 + Zeta[3], ComplexInfinity, # ComplexInfinity, ComplexInfinity, ComplexInfinity, # ComplexInfinity, ComplexInfinity} As you see, these results are all correct, but for shift=1. In the following example, also the only wrong result (excessive by 2) happens when the lower bound of the sum is shift=1: # In[23]=Table[N[Sum[1/(2 (n+1-shift)-1)^3,{n,shift,Infinity}]] # ,{shift,-4,4,1/2}] # Out[23]= {1.0518, 1.0518, 1.0518, 1.0518, 1.0518, 1.0518, 1.0518, # 1.0518, # 1.0518, 1.0518, 3.0518, 1.0518, 1.0518, 1.0518, 1.0518, 1.0518, # 1.0518} # # # In[36]:= Table[Sum[1/(2 (n+1-shift)-1)^3,{n,shift,Infinity}], # {shift,-4,4,1/2}] # # 7 Zeta[3] 7 Zeta[3] 7 Zeta[3] 7 Zeta[3] 7 Zeta[3] # Out[36]= {---------, ---------, ---------, ---------, ---------, # 8 8 8 8 8 # # 7 Zeta[3] # ---------, # 8 # # 7 Zeta[3] 7 Zeta[3] 7 Zeta[3] 7 Zeta[3] 16 + 7 Zeta[3] # > ---------, ---------, ---------, ---------, --------------, # 8 8 8 8 8 # # 7 Zeta[3] # ---------, # 8 # # 7 Zeta[3] 7 Zeta[3] 7 Zeta[3] 7 Zeta[3] 7 Zeta[3] # > ---------, ---------, ---------, ---------, ---------} # 8 8 8 8 8 In the next example, wrong results are found for all non-negative integers. The worst case is still for shift=1. #In[27]:= Table[N[Sum[(n+1-shift)^2/(4 * (n+1-shift)^2 -1)^5 # ,{n,shift,Infinity}]],{shift,-4,4,1/2}] # #Out[27]= {0.00412068, 0.00412068, 0.00412068, 0.00412068, # 0.00412068, 0.00412068, 0.00412068, 0.00412068, # 0.00412068, 0.00412068, 0.0158394 , 0.00412068, # 0.00404031, 0.00412068, 0.00409443, 0.00412068, # 0.00411023} # # In[28]:= Table[Sum[(n+1-shift)^2/(4 * (n+1-shift)^2 -1)^5 # ,{n,shift,Infinity}],{shift,-4,4,1/2}] # # 2 4 2 4 2 4 2 4 # 15 Pi - Pi 15 Pi - Pi 15 Pi - Pi 15 Pi - Pi # Out[28]= {------------, ------------, ------------, ------------, # 12288 12288 12288 12288 # # 2 4 2 4 2 4 2 4 2 4 #15 Pi -Pi 15 Pi -Pi 15 Pi -Pi 15 Pi -Pi 15 Pi -Pi #-----------, -----------, -----------, -----------, ----------- # 12288 12288 12288 12288 12288 # # 2 4 2 4 2 4 2 4 #15 Pi -Pi 144 + 15 Pi -Pi 15 Pi -Pi -80 +1215 Pi -81 Pi #-----------, -----------------, -----------, --------------------, # 12288 12288 12288 995328 # # 2 4 2 4 2 4 #15 Pi - Pi -1008 + 46875 Pi - 3125 Pi 15 Pi - Pi #------------, ----------------------------, ------------, # 12288 38400000 12288 # # 2 4 #-2160 + 252105 Pi - 16807 Pi #------------------------------} # 206524416 In the example below, a sum clearly equal to Zeta[3] gives a wrong divergent answer for shift=2, 3 and 4. # In[2]:= Table[Sum[1/(n+1-shift)^3,{n,shift,Infinity}], # {shift,-4,4,1/2}] # # -3 # Power::infy: Infinite expression 0 encountered. # # -3 # Power::infy: Infinite expression 0 encountered. # # -3 # Power::infy: Infinite expression 0 encountered. # # General::stop: Further output of Power::infy # will be suppressed during this calculation. # # Out[2]= {Zeta[3], Zeta[3], Zeta[3], Zeta[3], Zeta[3], # Zeta[3], Zeta[3], Zeta[3], Zeta[3], Zeta[3], # Zeta[3], Zeta[3], ComplexInfinity, Zeta[3], # ComplexInfinity, Zeta[3], ComplexInfinity} If the exponent is not an integer, weird results with imaginary parts can also appear: # In[1]:= Sum[(2*n-1)^(-3.1),{n,1,Infinity}] # Out[1]= 2.99642 - 0.309017 I Perhaps the algorithm does some internal variable change to shift the lower boundary of the sum, and it is done wrong sometimes. That could explain the weird dependence on the shift. Maybe a good idea for the users would be to check results numerically, do finite sums, and then take the limit to infinity. Thanks for your attention. Let's hope this problem gets cured, or documented as a bug, so users can take caution. As I said to the support technicians at Wolfram, I am now reporting this bug to the Usenet newsgroup comp.soft-sys.math.mathematica, so users get feedback on this. I think this feedback is necessary to ensure the consistent high quality of Mathematica as a tool for calculation and research. Ruben Krasnopolsky rubenz@tapir.caltech.eduz -- without any z's in the address