gamma-0.10.0.0: Gamma function and related functions.

Safe HaskellNone
LanguageHaskell2010

Math.Gamma.Stirling

Description

Stirling's approximation to the gamma function and utility functions for selecting coefficients.

Synopsis

Documentation

lnGammaStirling :: Floating a => [a] -> a -> a Source #

Convergent when Re(z) > 0. The first argument is the c_n series to use (cs is an ineffecient but generic definition of the full infinite series. Some precomputed finite prefix of cs should be fed to this function, the length of which will determine the accuracy achieved.)

cs :: (Fractional a, Ord a) => [a] Source #

The c_n series in the convergent version of Stirling's approximation given on wikipedia at http://en.wikipedia.org/wiki/Stirling%27s_approximation#A_convergent_version_of_Stirling.27s_formula as fetched on 11 June 2010.

s :: Int -> Int -> Integer Source #

The (signed) Stirling numbers of the first kind.

abs_s :: Int -> Int -> Integer Source #

The (unsigned) Stirling numbers of the first kind.

terms :: (Num t, Floating a, Ord a) => a -> a -> t Source #

Compute the number of terms required to achieve a given precision for a given value of z. The mamimum will typically (always?) be around 1, and seems to be more or less independent of the precision desired (though not of the machine epsilon - essentially, near zero I think this method is extremely numerically unstable).