David, Google search for "0.49191381609762019978" yields [2] and many other pages like it, thus your terms are indeed a Lanczos approximation as in [1], with n=15, g=607/128=4.7421875. - Robert [1] http://www.vttoth.com/CMS/projects/41-the-lanczos-approximation [2] http://blog.javia.org/implementing-the-lgamma-function-in-java/ On Sat, Dec 31, 2011 at 06:57, David Makin <makinmagic@tiscali.co.uk> wrote:
In case it isn't obvious I'm pretty sure the table of values used in the implementation in Ultra Fractal that I posted is from the Lanczos approximation, which at one point I was meaning to implement myself to get the table but that was before I found the one that I used (which saved a lot of time).
I would have posted the links to all the relevant sources I used but I've
moved 3 computers on since then and the old Windows PC with the links on is now in storage ;)
On 2011-12-28, Dave Makin <dave_makin@lineone.net> wrote:
On the subject of the gamma function, I'd be interested to know if I got this correct for complex gamma - it's the func I wrote for the Ultra Fractal math library = obviously it's not the most accurate implementation but I was balancing speed with accuracy and in adition it was taking too long to hunt down a better table of values to use ;) *************** ; Complex Gamma() David Makin June 2008 ; @param pz complex argument ; @return Gamma function of argument static complex func ComplexGamma(complex pz) complex w = pz if pz==0.0 w = recip(0) else if real(pz)<0.0 w = -pz if imag(pz)==0.0 if (real(pz)%1)==0.0 w = recip(0) endif endif endif if real(w)<1e300 w = (sqrt(2.0*#pi)* \ (0.99999999999999709182 \ + 57.156235665862923517/(w+1.0) \ - 59.597960355475491248/(w+2.0) \ + 14.136097974741747174/(w+3.0) \ - 0.49191381609762019978/(w+4.0) \ + .33994649984811888699E-4/(w+5.0) \ + .46523628927048575665E-4/(w+6.0) \ - .98374475304879564677e-4/(w+7.0) \ + .15808870322491248884E-3/(w+8.0) \ - .21026444172410488319e-3/(w+9.0) \ + .21743961811521264320e-3/(w+10.0) \ - .16431810653676389022e-3/(w+11.0) \ + .84418223983852743293e-4/(w+12.0) \ - .26190838401581408670e-4/(w+13.0) \ + .36899182659531622704e-5/(w+14.0)) \ /w) * exp(-w-5.2421875)*(w+5.2421875)^(w+0.5) if real(pz)<0.0 w = pz*w*sin(#pi*pz) if (w==0.0) w = recip(0) else w = -#pi/w endif endif endif endif return w endfunc **************
-- Robert Munafo -- mrob.com Follow me at: gplus.to/mrob - fb.com/mrob27 - twitter.com/mrob_27 - mrob27.wordpress.com - youtube.com/user/mrob143 - rilybot.blogspot.com