September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,10 +1,21 @@
|
|||
cof :: [Double]
|
||||
cof = [76.18009172947146,-86.50532032941677,24.01409824083091,-1.231739572450155,0.001208650973866179,-0.000005395239384953]
|
||||
cof =
|
||||
[ 76.18009172947146
|
||||
, -86.50532032941677
|
||||
, 24.01409824083091
|
||||
, -1.231739572450155
|
||||
, 0.001208650973866179
|
||||
, -0.000005395239384953
|
||||
]
|
||||
|
||||
ser :: Double
|
||||
ser = 1.000000000190015
|
||||
|
||||
gammaln :: Double -> Double
|
||||
gammaln xx = let tmp' = (xx+5.5) - (xx+0.5)*log(xx+5.5)
|
||||
ser' = ser + sum (zipWith (/) cof [xx+1..])
|
||||
in -tmp' + log(2.5066282746310005 * ser' / xx)
|
||||
gammaln xx =
|
||||
let tmp_ = (xx + 5.5) - (xx + 0.5) * log (xx + 5.5)
|
||||
ser_ = ser + sum (zipWith (/) cof [xx + 1 ..])
|
||||
in -tmp_ + log (2.5066282746310005 * ser_ / xx)
|
||||
|
||||
main :: IO ()
|
||||
main = mapM_ print $ gammaln <$> [0.1,0.2 .. 1.0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue