MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: A bug?......In[1]:= Sum[Cos[x], {x, 0, Infinity, Pi}]......Out[1]= 1/2

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41636] Re: A bug?......In[1]:= Sum[Cos[x], {x, 0, Infinity, Pi}]......Out[1]= 1/2
  • From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
  • Date: Thu, 29 May 2003 08:14:05 -0400 (EDT)
  • Organization: NewsReader.Com Subscriber
  • References: <bb1ua4$9do$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

nanoburst at yahoo.com (Mark) wrote:
> I think that the sum does not converge.  Does
> the following (from Mathematica for Students,
> v. 4.0.1) reveal a bug?  If so, do you have
> any insight into this bug?
>
>    In[1]:= Sum[Cos[x], {x, 0, Infinity, Pi}]
>
>    Out[1]= 1/2

The full version 4.2 does this too. I'd call it a bug. However, although
the series diverges, it is Cesaro summable, and it Cesaro sum is 1/2.
Nonetheless, I think that Mathematica should have told us that the series
diverges.

Your question led me to look at some other related things:

Sum[Cos[x], {x, 0, y, Pi}]  correctly gives  1/2*(1 + (-1)^Floor[y/Pi])

but Mathematica considers (-1)^Infinity to be Indeterminate, and so there's
no way to get the Cesaro sum by simply substituting Infinity for y.

Let's get rid of the trig function, and just look at

Sum[(-1)^x, {x, 0, y}].  For this, Mathematica give 1/2*(1 + (-1)^y). I
find that result somewhat disconcerting since we do not know that y is
necessarily a natural number. I think that instead the result should have
been 1/2*(1 + (-1)^Floor[y]). Why? Note that Sum[(-1)^x, {x, 0, Pi}]
correctly gives 0, but that 0 cannot be obtained by replacing y by Pi in
1/2*(1 + (-1)^y).

Mathematica does a good job with Sum[(-1)^(x/a), {x, 0, y, a}], yielding
1/2*(1 + (-1)^Floor[y/a]). But for Sum[(-1)^(x/a), {x, 0, Infinity, a}],
it unfortunately gives 1/2 again, as in your original question.

David Cantrell


  • Prev by Date: Re: Optimizing Non-linear Functions
  • Next by Date: RE: Beginner question: operating on piecewise defined functions
  • Previous by thread: Re: Re: A bug?......In[1]:= Sum[Cos[x], {x, 0, Infinity, Pi}]......Out[1]= 1/2
  • Next by thread: Matrix inverse not evaluating