| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
NumHask.Algebra.Field
Description
Field classes
Synopsis
- class (MultiplicativeInvertible a, MultiplicativeGroup a, Semiring a) => Semifield a
- class (AdditiveGroup a, MultiplicativeGroup a, Ring a) => Field a
- class Field a => ExpField a where
- class (Field a, Integral b, AdditiveGroup b, MultiplicativeUnital b) => QuotientField a b where
- class Semifield a => UpperBoundedField a where
- class Field a => LowerBoundedField a where
- class (UpperBoundedField a, LowerBoundedField a) => BoundedField a
- class Field a => TrigField a where
Documentation
class (MultiplicativeInvertible a, MultiplicativeGroup a, Semiring a) => Semifield a #
A Semifield is chosen here to be a Field without an Additive Inverse
Instances
| Semifield Double # | |
Defined in NumHask.Algebra.Field | |
| Semifield Float # | |
Defined in NumHask.Algebra.Field | |
| (Semifield a, AdditiveGroup a) => Semifield (Complex a) # | |
Defined in NumHask.Algebra.Field | |
| (Ord a, Signed a, Integral a, Multiplicative a, Ring a) => Semifield (Ratio a) # | |
Defined in NumHask.Algebra.Rational | |
class (AdditiveGroup a, MultiplicativeGroup a, Ring a) => Field a #
A Field is a Ring plus additive invertible and multiplicative invertible operations.
A summary of the rules inherited from super-classes of Field
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 * b == b * a a / a = one recip a = one / a recip a * a = one a * recip a = one
Instances
| Field Double # | |
Defined in NumHask.Algebra.Field | |
| Field Float # | |
Defined in NumHask.Algebra.Field | |
| Field a => Field (Complex a) # | |
Defined in NumHask.Algebra.Field | |
| (Ord a, Signed a, Integral a, Multiplicative a, Ring a) => Field (Ratio a) # | |
Defined in NumHask.Algebra.Rational | |
| (MultiplicativeGroup a, AdditiveGroup a, Semiring a) => Field (Complex a) # | |
Defined in NumHask.Data.Complex | |
class Field a => ExpField a where #
A hyperbolic field class
sqrt . (**2) == identity log . exp == identity for +ive b, a != 0,1: a ** logBase a b ≈ b
class (Field a, Integral b, AdditiveGroup b, MultiplicativeUnital b) => QuotientField a b where #
quotient fields explode constraints if they allow for polymorphic integral types
a - one < floor a <= a <= ceiling a < a + one round a == floor (a + one/(one+one))
fixme: had to redefine Signed operators here because of the Field import in Metric, itself due to Complex being defined there
Minimal complete definition
Instances
| QuotientField Double Integer # | |
| QuotientField Float Integer # | |
| (Ord a, Signed a, ToInteger a, Integral a, Multiplicative a, Ring a, Eq b, AdditiveGroup b, Integral b, FromInteger b) => QuotientField (Ratio a) b # | |
class Semifield a => UpperBoundedField a where #
A bounded field includes the concepts of infinity and NaN, thus moving away from error throwing.
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.
Instances
| UpperBoundedField Double # | |
| UpperBoundedField Float # | |
| (AdditiveGroup a, UpperBoundedField a) => UpperBoundedField (Complex a) # | todo: work out boundings for complex as it stands now, complex is different eg one / (zero :: Complex Float) == nan |
| (Ord a, Signed a, Integral a, AdditiveInvertible a, Multiplicative a, Ring a) => UpperBoundedField (Ratio a) # | |
class Field a => LowerBoundedField a where #
Methods
negInfinity :: a #
Instances
| LowerBoundedField Double # | |
Defined in NumHask.Algebra.Field Methods negInfinity :: Double # | |
| LowerBoundedField Float # | |
Defined in NumHask.Algebra.Field Methods negInfinity :: Float # | |
| (Ord a, Signed a, Integral a, Multiplicative a, Ring a, AdditiveInvertible a) => LowerBoundedField (Ratio a) # | |
Defined in NumHask.Algebra.Rational Methods negInfinity :: Ratio a # | |
class (UpperBoundedField a, LowerBoundedField a) => BoundedField a #
Instances
| (UpperBoundedField a, LowerBoundedField a) => BoundedField a # | |
Defined in NumHask.Algebra.Field | |