math-functions-0.3.4.2: Collection of tools for numeric computations
Copyright (c) 2009 2011 Bryan O'Sullivan
License BSD3
Maintainer bos@serpentine.com
Stability experimental
Portability portable
Safe Haskell None
Language Haskell2010

Numeric.SpecFunctions.Extra

Description

Less common mathematical functions.

Synopsis

Documentation

bd0 Source #

Arguments

:: Double
x
-> Double
np
-> Double

Evaluate the deviance term x log(x/np) + np - x .

chooseExact :: Int -> Int -> Double Source #

Calculate binomial coefficient using exact formula

logChooseFast :: Double -> Double -> Double Source #

Quickly compute the natural logarithm of n choose k , with no checking.

Less numerically stable:

exp $ lg (n+1) - lg (k+1) - lg (n-k+1)
  where lg = logGamma . fromIntegral

logGammaAS245 :: Double -> Double Source #

Compute the logarithm of the gamma function Γ( x ). Uses Algorithm AS 245 by Macleod.

Gives an accuracy of 10-12 significant decimal digits, except for small regions around x = 1 and x = 2, where the function goes to zero. For greater accuracy, use logGammaL .

Returns ∞ if the input is outside of the range (0 < x ≤ 1e305).

logGammaCorrection :: Double -> Double Source #

Compute the log gamma correction factor for Stirling approximation for x ≥ 10. This correction factor is suitable for an alternate (but less numerically accurate) definition of logGamma :

\[ \log\Gamma(x) = \frac{1}{2}\log(2\pi) + (x-\frac{1}{2})\log x - x + \operatorname{logGammaCorrection}(x) \]