|
From: | Michael D Godfrey |
Subject: | Re: incorrect test on gamma function ? |
Date: | Wed, 27 Oct 2010 12:02:07 -0700 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Thunderbird/3.1.4 |
On 10/27/2010 10:57 AM, Marco Atzeri wrote:
gamma(0) = Inf gamma(-1) = NaN>>>>> processing /pub/hg/octave/src/mappers.cc***** test x = [-1, 0, 1, Inf]; v = [NaN, Inf, 1, Inf]; assert (gamma(x), v); assert (gamma(single (x)), single (v)); !!!!! test failed assert (gamma (x),v) expected NaN Inf 1 Inf but got Inf Inf 1 Inf NaNs don't match considering the graphics http://en.wikipedia.org/wiki/Gamma_function I presume the two values should be both Inf (or both NaN) Marco
The 2 values should both be Inf (also, that is the Matlab result). In looking at this I noticed that both matlab and Octave restrict the argument to reals. It would be useful to provide gamma for complex argument. Does an m file for this exist somewhere? Numerical method for this is in Abramowitz and Stegun, but newer methods may be around. Gamma is defined for complex argument, so just modifying the current gamma to accept complex would be appropriate. Michael
[Prev in Thread] | Current Thread | [Next in Thread] |