Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: NSum bug or am I doing something wrong?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93904] Re: NSum bug or am I doing something wrong?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Fri, 28 Nov 2008 05:07:59 -0500 (EST)

On 11/27/08 at 5:33 AM, ebpr08 at gmail.com (Ebpr Preb) wrote:

>I'm getting imaginary answers for simple NSums of rational numbers.
>The example below produces the issue in Mathematica 7:

>NSum[(-1)^(k + 1)*(.2)^k, {k, 1, 32}]

>gives me the result:

>0.166667 + 1.1972*10^-44 I

>When I switch to Sum the problem disappears.

>Any hint?

Use Chop, e.g.

In[5]:= Chop@NSum[(-1)^(k + 1)*(.2)^k, {k, 1, 32}]

Out[5]= 0.166667


  • Prev by Date: Re: A problem in Pi digits as Lattice space filling
  • Next by Date: Re: Numerical General Relativity packages
  • Previous by thread: NSum bug or am I doing something wrong?
  • Next by thread: Re: NSum bug or am I doing something wrong?