       Re: Issue with Sum Version7

• To: mathgroup at smc.vnet.net
• Subject: [mg95637] Re: Issue with Sum Version7
• From: Bill Rowe <readnews at sbcglobal.net>
• Date: Fri, 23 Jan 2009 05:08:27 -0500 (EST)

On 1/22/09 at 7:05 AM, bghekaya at gmail.com wrote:

>Anyone seen this:

>In:= Sum[i, {i, 0, 99999, .1}]

>Out= 4.99991*10^10

>In:= Sum[i, {i, 0, 100000, .1}]

>Out= Sum[i, {i, 0, 100000, 0.1}]

>On Mac OS X 10.5.6

I get the same result. But this result is easily avoided by either

In:= NSum[i, {i, 0, 100000, .1}]

Out= 5.00001*10^10

or

In:= Sum[i, {i, 0, 100000, 1/10}]

Out= 50000050000

The general rule in Mathematica is when working with machine

The key advantage of Sum over NSum is being able to return
symbolic answers for simple problems. Note

In:= Sum[n, {n, 0, k, a}]

Out= (k (a+k))/(2 a)

returns nearly instantly, much faster than doing the explicit sum.

Compare

In:= Sum[n, {n, 0, 100000, 1/10}] // Timing

Out= {0.135397,50000050000}

In:= Sum[n, {n, 0, k, a}] /. {a -> 1/10, k -> 100000} // Timing

Out= {0.018729,50000050000}

Of course none of this changes the fact there appears to be a
problem with Sum.

• Prev by Date: Extracting Graphics3D from Plots
• Next by Date: A question about Mathematica
• Previous by thread: Re: Issue with Sum Version7
• Next by thread: Tab and Cursor Arrow Key Bindings