HERA-0.2

Data.Number.DyadicInterval

Synopsis

Documentation

type Interval = Maybe BallSource

A wrapper around Ball allowing the results of operations like division by interval containing zero to be represented and do not cause errors.

Nothing represents undefined interval.

fromBallA :: Precision -> Ball -> IntervalSource

Make an interval from a ball and normalize it to specified precision.

fromBall :: Ball -> IntervalSource

Just make an interval from a ball.

make :: Dyadic -> Dyadic -> IntervalSource

Make an interval from two endpoints so that no precision is lost.

makeASource

Arguments

:: Precision

precision of the interval's center

-> Dyadic

left endpoint

-> Dyadic

right endpoint

-> Interval 

Make an interval from two endpoints.

below :: Interval -> Interval -> BoolSource

Checks if second interval is inside the first. _|_ is above all.

contains :: Interval -> Dyadic -> BoolSource

Checks if interval contains dyadic. _|_ contains everything.

includes :: Interval -> Interval -> InclusionSource

Returns Below if second interval is inside first, Above if converse, NoInclusion otherwise.

intersectA :: Precision -> Interval -> Interval -> IntervalSource

Return the intersection of two intervals. The resulting interval's center has specified precision.

If one of the intervals is _|_ then just return the other (even if it is _|_).

intersect :: Interval -> Interval -> IntervalSource

Return the intersection of two intervals so that no precision is lost.

neg :: Precision -> Interval -> IntervalSource

Negate the interval. neg _|_ = _|_.

add :: Precision -> Interval -> Interval -> IntervalSource

Addition. If one of the arguments is _|_, so is the result.

mul :: Precision -> Interval -> Interval -> IntervalSource

Multiplication. If one of the arguments is _|_, so is the result

sub :: Precision -> Interval -> Interval -> IntervalSource

Subtraction. If one of the arguments is _|_, so is the result

div :: Precision -> Interval -> Interval -> IntervalSource

Division. If one of the arguments is _|_ or divisor contains 0 then result is _|_.

sqrt :: Precision -> Interval -> IntervalSource

Square root. If one argument is _|_ or interval contains 0 then result is _|_.

exp :: Precision -> Interval -> IntervalSource

e ^ i If argument is _|_ so is the result.

log :: Precision -> Interval -> IntervalSource

Natural logarithm. If one argument is _|_ or interval contains 0 then result is _|_.

compareI :: Interval -> Interval -> POrderingSource

Compare two intervals. If one of them is _|_ the result is incomparable, otherwise result is comparison of balls.

maxI :: Precision -> Interval -> Interval -> IntervalSource

Maximum of intervals. If one interval is _|_ so is the result.

minI :: Precision -> Interval -> Interval -> IntervalSource

Similar to maxI.

center :: Monad m => Interval -> m DyadicSource

Center of interval. Center on _|_ will result in fail.

radius :: Monad m => Interval -> m DyadicSource

Radius of interval. Radius on _|_ will result in fail.

lower :: Monad m => Interval -> m DyadicSource

Lower endpoint of interval with precision of the center. Lower on _|_ will result in fail.

upper :: Monad m => Interval -> m DyadicSource

Upper endpoint of interval with precision of the center. Upper on _|_ will result in fail.

width :: Monad m => Interval -> m DyadicSource

Width of the interval. Widht on _|_ will result in fail.