packages feed

numeric-prelude 0.3 → 0.3.0.1

raw patch · 2 files changed

+6/−6 lines, 2 filesdep ~arraydep ~basedep ~deepseqPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: array, base, deepseq

API changes (from Hackage documentation)

+ MathObj.Wrapper.Haskell98: instance (Eq a, Num a) => C (T a)
- Algebra.Additive: class C a
+ Algebra.Additive: class C a where negate a = zero - a a - b = a + negate b
- Algebra.Algebraic: class C a => C a
+ Algebra.Algebraic: class C a => C a where sqrt = root 2 root n x = x ^/ (1 % n) x ^/ y = root (denominator y) (x ^- numerator y)
- Algebra.Field: class C a => C a
+ Algebra.Field: class C a => C a where recip a = one / a a / b = a * recip b fromRational' r = fromInteger (numerator r) / fromInteger (denominator r) a ^- n = if n < zero then recip (a ^ (- n)) else a ^ n
- Algebra.IntegralDomain: class C a => C a
+ Algebra.IntegralDomain: class C a => C a where div a b = fst (divMod a b) mod a b = snd (divMod a b) divMod a b = (div a b, mod a b)
- Algebra.Monoid: class C a
+ Algebra.Monoid: class C a where cumulate = foldr (<*>) idt
- Algebra.PrincipalIdealDomain: class (C a, C a) => C a
+ Algebra.PrincipalIdealDomain: class (C a, C a) => C a where extendedGCD = extendedEuclid divMod gcd x y = fst $ extendedGCD x y lcm x y = if isZero x then x else divChecked x (gcd x y) * y
- Algebra.RealIntegral: class (C a, C a, Ord a, C a) => C a
+ Algebra.RealIntegral: class (C a, C a, Ord a, C a) => C a where quot a b = fst (quotRem a b) rem a b = snd (quotRem a b) quotRem a b = let (d, m) = divMod a b in if (signum d < zero) then (d + one, m - b) else (d, m)
- Algebra.RealRing: class (C a, Ord a) => C a
+ Algebra.RealRing: class (C a, Ord a) => C a where splitFraction x = (floor x, fraction x) fraction x = x - fromInteger (floor x) floor x = fromInteger (fst (splitFraction x)) ceiling x = - floor (- x) truncate x = if x >= 0 then floor x else ceiling x round x = let (n, r) = splitFraction x in case compare (2 * r) one of { LT -> n EQ -> if even n then n else n + 1 GT -> n + 1 }
- Algebra.RealTranscendental: class (C a, C a) => C a
+ Algebra.RealTranscendental: class (C a, C a) => C a where atan2 y x = select 0 [(x > 0, atan (y / x)), (x == 0 && y > 0, pi / 2), (x < 0 && y > 0, pi + atan (y / x)), (x <= 0 && y < 0, - atan2 (- y) x), (y == 0 && x < 0, pi)]
- Algebra.Ring: class C a => C a
+ Algebra.Ring: class C a => C a where fromInteger n = if n < 0 then powerAssociative (+) zero (negate one) (negate n) else powerAssociative (+) zero one n a ^ n = if n >= zero then powerAssociative (*) one a n else error "(^): Illegal negative exponent" one = fromInteger 1
- Algebra.Transcendental: class C a => C a
+ Algebra.Transcendental: class C a => C a where x ** y = exp (log x * y) logBase x y = log y / log x tan x = sin x / cos x asin x = atan (x / sqrt (1 - x ^ 2)) acos x = pi / 2 - asin x sinh x = (exp x - exp (- x)) / 2 cosh x = (exp x + exp (- x)) / 2 tanh x = sinh x / cosh x asinh x = log (sqrt (x ^ 2 + 1) + x) acosh x = log (sqrt (x ^ 2 - 1) + x) atanh x = (log (1 + x) - log (1 - x)) / 2
- Algebra.Units: class C a => C a
+ Algebra.Units: class C a => C a where stdAssociate x = x * stdUnitInv x stdUnit x = div one (stdUnitInv x) stdUnitInv x = div one (stdUnit x)

Files

numeric-prelude.cabal view
@@ -1,5 +1,5 @@ Name:           numeric-prelude-Version:        0.3+Version:        0.3.0.1 License:        GPL License-File:   LICENSE Author:         Dylan Thurston <dpt@math.harvard.edu>, Henning Thielemann <numericprelude@henning-thielemann.de>, Mikael Johansson@@ -154,7 +154,7 @@   default:     False  Source-Repository this-  Tag:         0.2.2+  Tag:         0.3.0.1   Type:        darcs   Location:    http://code.haskell.org/numeric-prelude/ @@ -169,11 +169,11 @@     storable-record >=0.0.1 && <0.1,     non-negative >=0.0.5 && <0.2,     utility-ht >=0.0.6 && <0.1,-    deepseq >=1.1 && <1.3+    deepseq >=1.1 && <1.4   If flag(splitBase)     Build-Depends:-      base >= 2 && <6,-      array >=0.1 && <0.4,+      base >= 2 && <5,+      array >=0.1 && <0.5,       containers >=0.1 && <0.5,       random >=1.0 && <1.1   Else
src/MathObj/Wrapper/Haskell98.hs view
@@ -121,7 +121,7 @@    gcd = gcd    lcm = lcm -instance (Num a) => ZeroTestable.C (T a) where+instance (Eq a, Num a) => ZeroTestable.C (T a) where    isZero (Cons a) = a==0  instance (Num a) => Absolute.C (T a) where