[Numpy-discussion] Importance of order when summing values in anarray

Hanni Ali hanni.ali@gmail....
Tue Dec 9 08:34:25 CST 2008


Thank you Nadav.

2008/12/9 Nadav Horesh <nadavh@visionsense.com>

> The highest accuracy is obtained when you sum an acceding ordered series,
> and the lowest accuracy with descending ordered. In between you might get a
> variety of rounding errors.
>
>  Nadav.
>
> -----הודעה מקורית-----
> מאת: numpy-discussion-bounces@scipy.org בשם Hanni Ali
> נשלח: ג 09-דצמבר-08 16:07
> אל: Discussion of Numerical Python
> נושא: [Numpy-discussion] Importance of order when summing values in anarray
>
> Hi All,
>
> I have encountered a puzzling issue and I am not certain if this is a
> mistake of my own doing or not. Would someone kindly just look over this
> issue to make sure I'm not doing something very silly.
>
> So, why would the sum of an array have a different value depending on the
> order I select the indices of the array?
>
> >>> vector[[39, 46, 49, 50, 6, 9, 12, 14, 15, 17, 21]].sum()
> 8933281.8757099733
> >>> vector[[6, 9, 12, 14, 15, 17, 21, 39, 46, 49, 50]].sum()
> 8933281.8757099714
> >>> sum(vector[[39, 46, 49, 50, 6, 9, 12, 14, 15, 17, 21]])
> 8933281.8757099733
> >>> sum(vector[[6, 9, 12, 14, 15, 17, 21, 39, 46, 49, 50]])
> 8933281.8757099714
>
> Any thoughts?
>
> Cheers,
>
> Hanni
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081209/dce9d2f5/attachment.html 


More information about the Numpy-discussion mailing list