MathGroup Archive 2007

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

Search the Archive

CompensatedSummation in Total


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