From: dmoews@xraysgi.ims.uconn.edu (David Moews) Subject: Re: gamma function for a computer ... Date: 12 Jan 2001 13:13:21 -0800 Newsgroups: sci.math Summary: Stirling's formula for log(gamma(z)) In article <120120010909400540%edgar@math.ohio-state.edu>, G. A. Edgar wrote: |How about this. Use Stirling's formula for large enough x |(how large, depends on the number of correct digits you want), |then use the functional equation for smalleer x (reduce it |1 at a time)...? This is the approach Pari uses. (Why not use Pari, or some other package?) For the benefit of the original poster, I will state Stirling's formula. It is log gamma(z) = (z-1/2) log z - z + 1/2 log(2pi) + sum(z^{1-2m} B_{2m}/(2m(2m-1)), m=1, ..., n) + R, where for z>0, |R|, the absolute value of the remainder term, is bounded by z^{-1-2n} |B_{2n+2}|/((2n+1)(2n+2)). B_{q} is the qth Bernoulli number, which is the coefficient of t^q in t/(e^t-1). Note that this is for log gamma(z). Exponentiate to get gamma(z). -- David Moews dmoews@xraysgi.ims.uconn.edu