intervals-0.2.2.1: Interval Arithmetic

Portability GHC only experimental ekmett@gmail.com Safe-Inferred

Numeric.Interval

Description

Interval arithmetic

Synopsis

# Documentation

data Interval a Source

Constructors

 I !a !a

Instances

 Eq a => Eq (Interval a) (RealExtras a, Ord a) => Floating (Interval a) (Fractional a, Ord a) => Fractional (Interval a) (Num a, Ord a) => Num (Interval a) Ord a => Ord (Interval a) Real a => Real (Interval a) This means that realToFrac will use the midpoint What moron put an Ord instance requirement on Real! RealExtras a => RealFloat (Interval a) We have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval. RealFloat a => RealFrac (Interval a) Show a => Show (Interval a) RealExtras a => RealExtras (Interval a)

(...) :: a -> a -> Interval aSource

The rule of thumb is you should only use this to construct using values that you took out of the interval. Otherwise, use I, to force rounding

The whole real number line

An empty interval

null :: Ord a => Interval a -> BoolSource

negation handles NaN properly

singleton :: a -> Interval aSource

A singleton point

elem :: Ord a => a -> Interval a -> BoolSource

notElem :: Ord a => a -> Interval a -> BoolSource

inf :: Interval a -> aSource

The infinumum (lower bound) of an interval

sup :: Interval a -> aSource

The supremum (upper bound) of an interval

singular :: Ord a => Interval a -> BoolSource

Is the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletons

width :: Num a => Interval a -> aSource

Calculate the width of an interval.

midpoint :: Fractional a => Interval a -> aSource

Nearest point to the midpoint of the interval.

intersection :: (Fractional a, Ord a) => Interval a -> Interval a -> Interval aSource

Calculate the intersection of two intervals.

hull :: Ord a => Interval a -> Interval a -> Interval aSource

Calculate the convex hull of two intervals

bisection :: Fractional a => Interval a -> (Interval a, Interval a)Source

Bisect an interval at its midpoint.

magnitude :: (Num a, Ord a) => Interval a -> aSource

magnitude

mignitude :: (Num a, Ord a) => Interval a -> aSource

certainly :: Ord a => (forall b. Ord b => b -> b -> Bool) -> Interval a -> Interval a -> BoolSource

For all `x` in `X`, `y` in `Y`. `x op y`

(<!) :: Ord a => Interval a -> Interval a -> BoolSource

For all `x` in `X`, `y` in `Y`. `x < y`

(<=!) :: Ord a => Interval a -> Interval a -> BoolSource

For all `x` in `X`, `y` in `Y`. `x <= y`

(==!) :: Eq a => Interval a -> Interval a -> BoolSource

For all `x` in `X`, `y` in `Y`. `x == y`

(>=!) :: Ord a => Interval a -> Interval a -> BoolSource

For all `x` in `X`, `y` in `Y`. `x >= y`

(>!) :: Ord a => Interval a -> Interval a -> BoolSource

For all `x` in `X`, `y` in `Y`. `x > y`

possibly :: Ord a => (forall b. Ord b => b -> b -> Bool) -> Interval a -> Interval a -> BoolSource

Does there exist an `x` in `X`, `y` in `Y` such that `x op y`?

(<?) :: Ord a => Interval a -> Interval a -> BoolSource

Does there exist an `x` in `X`, `y` in `Y` such that `x < y`?

(<=?) :: Ord a => Interval a -> Interval a -> BoolSource

Does there exist an `x` in `X`, `y` in `Y` such that `x <= y`?

(==?) :: Ord a => Interval a -> Interval a -> BoolSource

Does there exist an `x` in `X`, `y` in `Y` such that `x == y`?

(>=?) :: Ord a => Interval a -> Interval a -> BoolSource

Does there exist an `x` in `X`, `y` in `Y` such that `x >= y`?

(>?) :: Ord a => Interval a -> Interval a -> BoolSource

Does there exist an `x` in `X`, `y` in `Y` such that `x > y`?