Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

CompensatedSummation in Total

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81075] CompensatedSummation in Total
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 10 Sep 2007 18:57:54 -0400 (EDT)

In the 'More Information' section of the help for Total it mentions that 
Method -> "CompensatedSummation" can be used as an option to reduce 
numerical error. But in the Options, Method section they use the option 
without quotation marks:  Method -> CompensatedSummation.  They actually 
both seem to work.

I thought that the following example might be one that CompensatedSummation 
might help on since the sum tends to be much smaller than a sum of the 
absolute values. But I obtain exactly the same answer with or without 
CompensatedSummation - every time. So I wonder exactly what 
CompensatedSummation does for us?

testlist = Table[RandomReal[{-1, 1}], {10000000}];
NumberForm[Total[testlist], 16] // Timing
NumberForm[Total[testlist, Method -> "CompensatedSummation"],
  16] // Timing

testlist = Table[RandomReal[{-1, 1}], {10000000}];
NumberForm[Total[testlist], 16] // Timing
NumberForm[Total[testlist, Method -> CompensatedSummation],
  16] // Timing

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




  • Prev by Date: Dt "gradient" (dumb title, sorry)
  • Next by Date: Re: plot error messages are completelly missing
  • Previous by thread: Re: Dt "gradient" (dumb title, sorry)
  • Next by thread: Re: CompensatedSummation in Total