[Top][All Lists]

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

[Octave-bug-tracker] [bug #43551] Matlab incompatibility for gamma funct

From: Rik
Subject: [Octave-bug-tracker] [bug #43551] Matlab incompatibility for gamma function for negative integer arguments
Date: Fri, 07 Nov 2014 16:25:51 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0

Follow-up Comment #1, bug #43551 (project octave):

I guess we should think about which form is more useful.

The Wikipedia entry for the gamma function has a nice plot of the function
(http://en.wikipedia.org/wiki/Gamma_function).  The magnitude of the function
at a negative integer is infinite.  But, if you choose a consistent direction,
such as always approaching the pole from the left, then the sign of the result
flips back and forth between +1 and -1.  Wolfram Alpha, a.k.a Mathematica,
returns complex infinity for gamma (negative integer).  A complex infinity has
infinite magnitude, but no determined phase.  This is consistent with the plot
which shows that you are either getting +Inf or -Inf in the limit.

So, is it more useful to simply pick a phase (+1) and return Inf as Matlab
does?  Or is it more useful to throw a NaN which will clog up downstream
calculations and indicate that we have gone beyond our ability to truly
calculate the result?


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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