gamma 0.9.0.1 → 0.9.0.2
raw patch · 4 files changed
+11/−10 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Math.Gamma: class (Floating a, Factorial a) => Gamma a
+ Math.Gamma: class (Eq a, Floating a, Factorial a) => Gamma a
- Math.Gamma.Incomplete: lnLowerGammaHypGeom :: Floating a => a -> a -> a
+ Math.Gamma.Incomplete: lnLowerGammaHypGeom :: (Eq a, Floating a) => a -> a -> a
- Math.Gamma.Incomplete: lnUpperGammaConvergents :: Floating a => a -> a -> [a]
+ Math.Gamma.Incomplete: lnUpperGammaConvergents :: (Eq a, Floating a) => a -> a -> [a]
- Math.Gamma.Incomplete: lowerGammaHypGeom :: Floating b => b -> b -> b
+ Math.Gamma.Incomplete: lowerGammaHypGeom :: (Eq b, Floating b) => b -> b -> b
Files
- gamma.cabal +3/−2
- src/Math/Gamma.hs +1/−1
- src/Math/Gamma.hs-boot +1/−1
- src/Math/Gamma/Incomplete.hs +6/−6
gamma.cabal view
@@ -1,5 +1,5 @@ name: gamma-version: 0.9.0.1+version: 0.9.0.2 stability: provisional cabal-version: >= 1.6@@ -18,7 +18,8 @@ tested-with: GHC == 6.10.4, GHC == 6.12.1, GHC == 6.12.3, GHC == 7.0.1, GHC == 7.0.2,- GHC == 7.2.1+ GHC == 7.2.1,+ GHC == 7.4.1-rc1 extra-source-files: extras/*.hs
src/Math/Gamma.hs view
@@ -18,7 +18,7 @@ import Math.Sequence.Converge -- |Gamma function. Minimal definition is ether 'gamma' or 'lnGamma'.-class (Floating a, Factorial a) => Gamma a where+class (Eq a, Floating a, Factorial a) => Gamma a where -- |The gamma function: gamma z == integral from 0 to infinity of -- @\t -> t**(z-1) * exp (negate t)@ gamma :: a -> a
src/Math/Gamma.hs-boot view
@@ -2,7 +2,7 @@ import Math.Factorial -class (Floating a, Factorial a) => Gamma a where+class (Eq a, Floating a, Factorial a) => Gamma a where -- |The gamma function: gamma z == integral from 0 to infinity of -- @\t -> t**(z-1) * exp (negate t)@ gamma :: a -> a
src/Math/Gamma/Incomplete.hs view
@@ -28,14 +28,14 @@ -- From Abramowitz & Stegun (6.5.12). -- -- Recommended for use when x < s+1-lowerGammaHypGeom :: Floating b => b -> b -> b+lowerGammaHypGeom :: (Eq b, Floating b) => b -> b -> b lowerGammaHypGeom 0 0 = 0/0 lowerGammaHypGeom s x = x ** s * exp (negate x) / s * m_1_sp1 s x -- |Natural logarithm of lower gamma function, based on the same identity as -- 'lowerGammaHypGeom' and evaluated carefully to avoid overflow and underflow. -- Recommended for use when x < s+1-lnLowerGammaHypGeom :: Floating a => a -> a -> a+lnLowerGammaHypGeom :: (Eq a, Floating a) => a -> a -> a lnLowerGammaHypGeom 0 0 = 0/0 lnLowerGammaHypGeom s x = log ((signum x)**s * sign_m / signum s)@@ -94,7 +94,7 @@ -- |Natural logarithms of the convergents of the upper gamma function, -- evaluated carefully to avoid overflow and underflow. -- Recommended for use when x >= s+1-lnUpperGammaConvergents :: Floating a => a -> a -> [a]+lnUpperGammaConvergents :: (Eq a, Floating a) => a -> a -> [a] lnUpperGammaConvergents s x = map (a -) (concat (eval theCF)) where eval = map (map evalSign) . modifiedLentzWith signLog addSignLog negateSignLog 1e-30@@ -125,14 +125,14 @@ -- -- m_1_sp1 s z = M(1;s+1;z) -- -m_1_sp1 :: Fractional a => a -> a -> a+m_1_sp1 :: (Eq a, Fractional a) => a -> a -> a m_1_sp1 s z = converge . scanl (+) 0 . scanl (*) 1 $ [z / x | x <- iterate (1+) (s+1)] -log_m_1_sp1 :: Floating a => a -> a -> (a,a)+log_m_1_sp1 :: (Eq a, Floating a) => a -> a -> (a,a) log_m_1_sp1 s z = converge (concat (log_m_1_sp1_convergents s z)) -log_m_1_sp1_convergents :: Floating a => a -> a -> [[(a,a)]]+log_m_1_sp1_convergents :: (Eq a, Floating a) => a -> a -> [[(a,a)]] log_m_1_sp1_convergents s z = modifiedLentzWith signLog addSignLog negateSignLog 1e-30 $ sumPartialProducts (1:[z / x | x <- iterate (1+) (s+1)])