help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sumskipnan(nan) = 0 ?


From: gail
Subject: Re: sumskipnan(nan) = 0 ?
Date: Sun, 09 Sep 2007 21:04:58 +0200

On Fri Sep  7 21:43 , Thomas Shores  sent:

>> >> sumskipnan(nan) = 0  ?
>> >
>> >I'm guessing that the sum of the input with all the NaN's removed
>> > is zero. That is the sum of no numbers is considered 0.
>>
>> That seems logical.  Take the set of arguments, remove NaNs, get
>> an empty set.  I think that the sum of an empty set of numbers
>> should be 0.  Why should it be different?

What is so special with 0 here? - Why, if you decide to choose a number, not 1 
or
any other number?

>
>Actually, it's not only logical, it's the only choice.  Look at it 
>this way: the sum of elements over the union of disjoint index sets 
>A and B should be the sum of the sum over indices in A plus the sum 
>over indices in B. Now if B is the empty set, the union of the sets 
>is just A, and A and B are disjoint.   Hence the sum over A union B 
>should be the sum over A.  Hence the sum over B must be zero.

sum(A) + sum(empty) = sum(A) + nan = sum(A). No?

To me, the only reasonable choice for the sum of nothing is nothing, that is:

sum(nan) = nan.

G.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]