[comp.sys.handhelds] COMB

dwrfielder@dahlia.waterloo.edu (Dave Fielder) (06/22/91)

Does anyone know as to why the 48sx does not like negatives
in the COMB function.  They should be valid.

eg. COMB(-8,4) should return (-8)(-9)(-10)(-11)/(4!) = 330.

It isn't like HP to screw up on important functions like this.
Or, then again, is it...Hmmm :^).


--Dave.

PS.  What happened to the guy who was going to post those stats
routines of his.  I'm still interested if you can still post them.

Dan_Ciarniello@cc.sfu.ca (06/22/91)

>Does anyone know as to why the 48sx does not like negatives
>in the COMB function.  They should be valid.
>
>eg. COMB(-8,4) should return (-8)(-9)(-10)(-11)/(4!) = 330.
>
>It isn't like HP to screw up on important functions like this.
>Or, then again, is it...Hmmm :^).
>
>
>--Dave.
 
HP didn't screw up on this function.  COMB(x,y) returns the number of 
possible combinations of x distinct objects taken y at a time.  In 
this context negative numbers make no sense (how many objects are 
-8).
 
Also, the factorial function is defined only for the positive integers
(including 0).  It is not defined for the negative integers.  The gamma
function *is* defined for negative numbers but it is undefined for the 
negative integers (the 48 gives an Infinite Result error).
 
Dan Ciarniello
Physics Department
Capilano College
North Vancouver, B. C.
 

dwrfielder@dahlia.waterloo.edu (Dave Fielder) (06/26/91)

In article <3238343@cc.sfu.ca> Dan_Ciarniello@cc.sfu.ca writes:
>>Does anyone know as to why the 48sx does not like negatives
>>in the COMB function.  They should be valid.
>>
>>eg. COMB(-8,4) should return (-8)(-9)(-10)(-11)/(4!) = 330.
>>
>HP didn't screw up on this function.  COMB(x,y) returns the number of 
>possible combinations of x distinct objects taken y at a time.  In 
>this context negative numbers make no sense (how many objects are 
>-8).
> 
>Also, the factorial function is defined only for the positive integers
>(including 0).  It is not defined for the negative integers.  The gamma
>function *is* defined for negative numbers but it is undefined for the 
>negative integers (the 48 gives an Infinite Result error).
> 

Well, perhaps then COMB should not be defined only for the positive integers
but rather be extended.

        (r)
  ie.  n    is a symbol read "n to r factors", is defined as follows:
        (r)
       n   =n(n-1)(n-2)...(n-r+1), r>0
        (0)
       n   =1.

                                        (r)
       If n is a non-negative integer, n   is the number of arrangements,
       or permutations, of n different things taken r at a time, for which
       another common symbol is nPr.  In particular, 
        (n)
       n   = nPn is the number of arrangements or permutations of n different
       things taken all at a time, and is given a special symbol n! called
       "n factorial".
                                           (r)
       "n choose r" is then defined as:   n      for r>= 0.
                                         -----
                                          r!
        
       If r and n are non-negative integers, then "n choose r" is the number
       of ways to choose r items from n when the order of choice is unimportant.       This is sometimes referred to as the number of combinations of n things
       taken r at a time, and another frequently used symbol is nCr.

       Excerpts taken from:
       Probability and Statistical Inference Volume 1: Probability
       by non other than J.G. Kalbfleisch. Dean of Faculty of Mathematics
       at U of W. (God I hate this textbook!)  :^).

Now, the whole point of all this is that is possible to take n as being 
negative in "n choose r", and this is really useful when you get into the
binomial theorum for statistics, and combinatorics and optomizations.

       ie.       n   ___  /   \  r
            (1+t)  = \_   | n | t
                     /__  | r |
                     r>=0 \   /

I find it suprizing that HP restricted the domain of COMB(n,r) such that
n is a positive integer rather than a real.

Just my $.02 worth. 

--Dave Hubert
  3A Math Non-Specailist
  Faculty of Mathematics
  University of Waterloo, Canada.

mueller@schaefer.math.wisc.edu (Carl Mueller) (06/26/91)

In article <1991Jun25.171406.17170@watdragon.waterloo.edu> dwrfielder@dahlia.waterloo.edu (Dave Fielder) writes:
>In article <3238343@cc.sfu.ca> Dan_Ciarniello@cc.sfu.ca writes:
>>>Does anyone know as to why the 48sx does not like negatives
>>>in the COMB function.  They should be valid.
>>>
>>>eg. COMB(-8,4) should return (-8)(-9)(-10)(-11)/(4!) = 330.
>>>
>>HP didn't screw up on this function.  

>I find it suprizing that HP restricted the domain of COMB(n,r) such that
>n is a positive integer rather than a real.
>
Well, I'd say HP did the right thing.  Most people who use the COMB function
are using it in its usual sense.  Thus the 48 SHOULD indicate that something
is wrong if it is being fed negative or fractional values as input.  If you want
the extended version, you can program it yourself.

>Just my $.02 worth. 
>
>--Dave Hubert
>  3A Math Non-Specailist
>  Faculty of Mathematics
>  University of Waterloo, Canada.

Adding my $.02.

Carl Mueller (mueller@math.wisc.edu)

ags@seaman.cc.purdue.edu (Dave Seaman) (06/26/91)

In article <1991Jun25.191006.4983@schaefer.math.wisc.edu> mueller@schaefer.UUCP (Carl Mueller) writes:

>Well, I'd say HP did the right thing.  Most people who use the COMB function
>are using it in its usual sense.  Thus the 48 SHOULD indicate that something
>is wrong if it is being fed negative or fractional values as input.  If you want
>the extended version, you can program it yourself.

Applying the same reasoning, the 48 SHOULD indicate that something is wrong if
it is fed complex values as input to functions such as SIN or LN, since most
people use these functions only on real values and they should be told when
they are probably making a mistake.  If you want the SIN of a complex
number, you can program it yourself, just like on all those ordinary
calculators.

If we keep extending this line of reasoning, we should be able to reduce the
HP48 to a simple four-function calculator.

--
Dave Seaman
ags@seaman.cc.purdue.edu

grue@cs.uq.oz.au (Frobozz) (06/26/91)

In <1991Jun25.191006.4983@schaefer.math.wisc.edu> mueller@schaefer.math.wisc.edu (Carl Mueller) writes:

]>I find it suprizing that HP restricted the domain of COMB(n,r) such that
]>n is a positive integer rather than a real.
]>
]Well, I'd say HP did the right thing.  Most people who use the COMB function
]are using it in its usual sense.  Thus the 48 SHOULD indicate that something
]is wrong if it is being fed negative or fractional values as input. If you want
]the extended version, you can program it yourself.

Then why did they include the gamma function instead of a simple factorial?


        						Pauli
seeya

Paul Dale               | Internet/CSnet:            grue@cs.uq.oz.au
Dept of Computer Science| Bitnet:       grue%cs.uq.oz.au@uunet.uu.net
Uni of Qld              | JANET:           grue%cs.uq.oz.au@uk.ac.ukc
Australia, 4072         | EAN:                          grue@cs.uq.oz
                        | UUCP:           uunet!munnari!cs.uq.oz!grue
f4e6g4Qh4++             | JUNET:                     grue@cs.uq.oz.au
--

mueller@schaefer.math.wisc.edu (Carl Mueller) (06/26/91)

In article <13978@mentor.cc.purdue.edu> ags@seaman.cc.purdue.edu (Dave Seaman) writes:
>In article <1991Jun25.191006.4983@schaefer.math.wisc.edu> mueller@schaefer.UUCP (Carl Mueller) writes:
>
>>Well, I'd say HP did the right thing.  Most people who use the COMB function
>>are using it in its usual sense.  
>
>Applying the same reasoning, the 48 SHOULD indicate that something is wrong if
>it is fed complex values as input to functions such as SIN or LN, since most
>people use these functions only on real values and they should be told when
>they are probably making a mistake.
>
>If we keep extending this line of reasoning, we should be able to reduce the
>HP48 to a simple four-function calculator.
>
Well, I'm not convinced that complex number support in basic functions can
properly be compared to an extended version of the COMBINATION function
whose mathematical definition is in terms of integers, but I'm willing to
concede that it is saying too much to say that HP did the right thing. It
would also be wrong to say that they did the wrong thing.  It was a judgement
call and I think that I would have made the same decision. 

>--
>Dave Seaman
>ags@seaman.cc.purdue.edu

Carl Mueller (mueller@math.wisc.edu)

mueller@schaefer.math.wisc.edu (Carl Mueller) (06/26/91)

In article <2141@uqcspe.cs.uq.oz.au> grue@cs.uq.oz.au writes:
>In <1991Jun25.191006.4983@schaefer.math.wisc.edu> mueller@schaefer.math.wisc.edu (Carl Mueller) writes:
>
[STUFF DELETED]
>
>Then why did they include the gamma function instead of a simple factorial?
>
OK, maybe this will clear stuff up.  They includede BOTH the gamma function 
and the factorial function.  The factorial function requires non-negative
integers as input (or should ... I don't have my calculator [can we call it
that?] with me to check), the gamma function requires anything but negative
integers as input.  The factorial function is simply no defined for fractional
or negative numbers.  Thus the gamma function is provided.  Perhaps HP should
have provided a generalized COMB function in addition to the COMB function
that is provided which (apparently -- though I haven't checked) is defined
only for integers.
>
>        						Pauli
>seeya
>
Carl Mueller (mueller@math.wisc.edu)

akcs.vttoth@hpcvbbs.UUCP (Viktor T. Toth) (06/30/91)

Lines: 7

Well, here is something else for you guys. How about the analytic
continuation of the gamma function? While I never before saw COMB
extended to negative numbers, applying the gamma function to complex
numbers is fairly commonplace. In fact, in the few occasions when I
needed the gamma function myself, I had to program it from scratch. HP,
please, why did you not include a gamma function routine that is a.)
extended over the complex plane and b.) differentiable?