Safe Haskell | None |
---|---|
Language | Haskell2010 |
Field classes
Synopsis
- class (Distributive a, Subtractive a, Divisive a) => Field a
- class Field a => ExpField a where
- class (Field a, Multiplicative b, Additive b) => QuotientField a b where
- properFraction :: a -> (b, a)
- round :: a -> b
- ceiling :: a -> b
- floor :: a -> b
- truncate :: a -> b
- class Field a => UpperBoundedField a where
- class (Subtractive a, Field a) => LowerBoundedField a where
- negInfinity :: a
- class Field a => TrigField a where
- half :: Field a => a
Documentation
class (Distributive a, Subtractive a, Divisive a) => Field a Source #
A Field is a set on which addition, subtraction, multiplication, and division are defined. It is also assumed that multiplication is distributive over addition.
A summary of the rules inherited from super-classes of Field. Floating point computation is a terrible, messy business and, in practice, only rough approximation can be achieve for association and distribution.
zero + a == a a + zero == a ((a + b) + c) (a + (b + c)) a + b == b + a a - a == zero negate a == zero - a negate a + a == zero a + negate a == zero one * a == a a * one == a ((a * b) * c) == (a * (b * c)) (a * (b + c)) == (a * b + a * c) ((a + b) * c) == (a * c + b * c) a * zero == zero zero * a == zero a / a == one || a == zero recip a == one / a || a == zero recip a * a == one || a == zero a * recip a == one || a == zero
Instances
Field Double Source # | |
Defined in NumHask.Algebra.Field | |
Field Float Source # | |
Defined in NumHask.Algebra.Field | |
Field a => Field (Complex a) Source # | |
Defined in NumHask.Data.Complex | |
(Ord a, Signed a, Integral a, Ring a) => Field (Ratio a) Source # | |
Defined in NumHask.Data.Rational | |
Field b => Field (a -> b) Source # | |
Defined in NumHask.Algebra.Field |
class Field a => ExpField a where Source #
A hyperbolic field class
sqrt . (**2) == id log . exp == id for +ive b, a != 0,1: a ** logBase a b ≈ b
class (Field a, Multiplicative b, Additive b) => QuotientField a b where Source #
Conversion from a Field
to a Ring
a - one < floor a <= a <= ceiling a < a + one round a == floor (a + half)
properFraction :: a -> (b, a) Source #
default floor :: (Ord a, Subtractive b) => a -> b Source #
Instances
QuotientField Double Int Source # | |
QuotientField Double Integer Source # | |
QuotientField Float Int Source # | |
QuotientField Float Integer Source # | |
(Ord a, Signed a, Integral a, Ring a, Ord b, Signed b, Integral b, Ring b, Field a, FromIntegral b a) => QuotientField (Ratio a) b Source # | |
QuotientField b c => QuotientField (a -> b) (a -> c) Source # | |
class Field a => UpperBoundedField a where Source #
A bounded field introduces the concepts of infinity and NaN.
one / zero + infinity == infinity infinity + a == infinity zero / zero != nan
Note the tricky law that, although nan is assigned to zero/zero, they are never-the-less not equal. A committee decided this.
Nothing
Instances
UpperBoundedField Double Source # | |
UpperBoundedField Float Source # | |
(UpperBoundedField a, Subtractive a) => UpperBoundedField (Complex a) Source # | |
(Ord a, Signed a, Integral a, Ring a, Distributive a) => UpperBoundedField (Ratio a) Source # | |
UpperBoundedField b => UpperBoundedField (a -> b) Source # | |
class (Subtractive a, Field a) => LowerBoundedField a where Source #
Negative infinity.
Nothing
negInfinity :: a Source #
Instances
LowerBoundedField Double Source # | |
Defined in NumHask.Algebra.Field negInfinity :: Double Source # | |
LowerBoundedField Float Source # | |
Defined in NumHask.Algebra.Field negInfinity :: Float Source # | |
LowerBoundedField a => LowerBoundedField (Complex a) Source # | |
Defined in NumHask.Data.Complex negInfinity :: Complex a Source # | |
(Ord a, Signed a, Integral a, Field a) => LowerBoundedField (Ratio a) Source # | |
Defined in NumHask.Data.Rational negInfinity :: Ratio a Source # | |
LowerBoundedField b => LowerBoundedField (a -> b) Source # | |
Defined in NumHask.Algebra.Field negInfinity :: a -> b Source # |
class Field a => TrigField a where Source #
Trigonometric Field