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: [mg93895] RE: [mg93869] NSum bug or am I doing something wrong?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 28 Nov 2008 05:06:20 -0500 (EST)
  • References: <11687945.1227782105568.JavaMail.root@m02>

In these cases people usually use Chop. But it does seem like a slight bug
that an imaginary component gets in.

Why not make your do-it-yourself NSum?

Total[(k \[Function] (-1)^(k + 1) .2^k) /@ Range[32]]
0.166667

It actually seems to run faster than NSum.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark 


From: Ebpr Preb [mailto:ebpr08 at gmail.com] 

Hi,

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?

Thanks so much.

ebpr





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