help-octave
[Top][All Lists]
Advanced

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

Re: sumskipnan(nan) = 0 ?


From: James Sherman Jr.
Subject: Re: sumskipnan(nan) = 0 ?
Date: Sun, 9 Sep 2007 16:29:31 -0400

On 9/9/07, address@hidden <address@hidden> wrote:
> 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?

Lets look at 3 sets A, B and C.  Let B and C be disjoint, and A be the
union of sets B and C.  Now a reasonable property of the function sum
would be that the sum of the elements in B plus the sum of elements in
C, would equal the sum of the elements in A, correct?
Now, for example, if we let C be the empty set, then we get that B = A, thus
sum(A) = sum(B) + sum(C)  being a "reasonable" property
           = sum(A) + sum(C)  from our assumption that C is the empty set
hence, subtracting sum(A) from both sides.
sum(C) = 0

Just like Thomas said.

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

No.

>
> To me, the only reasonable choice for the sum of nothing is nothing, that is:
>
> sum(nan) = nan.

I've never seen anywhere that nan is interpreted as "nothing" and
certainly any number + nan is always a nan.

While I agree that sum(nan) should be nan (I believe this is true,
isn't it?), but what you asked earlier wasn't this question.  It was
sumskipnan(nan) which is the same as saying,
sum([]) or sum of the empty set.

James


reply via email to

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