From bug-octave-request at bevo dot che dot wisc dot edu Tue Sep 5 09:58:34 2000 Subject: lgamma bug on real negative axis From: Rolf Fabian To: "'bug-octave UWISC'" Date: Tue, 5 Sep 2000 09:59:11 -0500 (CDT) Hi, one conclusiion from the uploads to the help-list is that lgamma returns incorrect output on the negative real axis for the intervals (0..-1) , (-2..-3) ,( -4..-5) etc.. , in general ( -(EVEN N).. -(N+1) ) because the necessary imaginary part ( +pi*i ) seems to be discarded from output! This bug was observed for V2.0.13 cygwin - win95 (precompiled) V2.1.14 OS/2 and V2.1.31 ( Thanks to Paul Kienzle and Dirk Laurie for testing!). Repeat by e.g. :) log(gamma(x=-1/2:-1:-5)).' ans = 1.26551 + 3.14159i 0.86005 + 0.00000i -0.05624 + 3.14159i -1.30901 + 0.00000i -2.81308 + 3.14159i :) lgamma(x).' ans = 1.265512 0.860047 -0.056244 -1.309007 -2.813084 There's also a typo (sorry) in my previous upload http://www.che.wisc.edu/octave/mailing-lists/help-octave/2000/1114 concerning the sign of the imaginary parts, which needs to be corrected. Correctly you should read Both -pi*i and +pi*i are actually possible, because the complex EXPONENTIAL function is periodical with a period of 2*pi*i, so that the sign depends on some (more or less arbitrary) definition. Rolf ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------