package interval_base
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=623b6117ba2d36f4ddbf78777d1ba1fad324d00db1f641f064fc231602b40aa2
sha512=09fbca71c9eeb89b56bbf752240f1fec8515757ecb4245912e6e6e7c9baa1cce1e6b009f40f17b5aa97f405ac870c6203f472eba6600efdaf43066e58a018d04
doc/interval_base/Interval/I/index.html
Module Interval.ISource
Interval operations. Locally open this module — using e.g. I.(...) — to redefine classical arithmetic operators for interval arithmetic.
include T with type number = float and type t = t
Numbers type on which intervals are defined.
v a b returns the interval [a, b]. BEWARE that, unless you take care, if you use v a b with literal values for a and/or b, the resulting interval may not contain these values because the compiler will round them to binary numbers before passing them to v.
Returns the interval containing the conversion of an integer to the number type.
to_string i return a string representation of the interval i.
Print the interval to the channel. To be used with Printf format "%a".
Print the interval to the formatter. To be used with Format format "%a".
fmt number_fmt returns a format to print intervals where each component is printed with number_fmt.
Example: Printf.printf ("%s = " ^^ fmt "%.10f" ^^ "\n") name i.
Boolean functions
compare_f a x returns
1ifhigh(a) < x,0iflow(a)≤x≤high(a), i.e., ifx∈a, and-1ifx < low(a).
is_bounded x says whether the interval is bounded, i.e., -∞ < low(x) and high(x) < ∞.
x <= y says whether x is weakly less than y i.e., ∀ξ ∈ x, ∃η ∈ y, ξ ≤ η and ∀η ∈ y, ∃ξ ∈ x, ξ ≤ η.
x >= y says whether x is weakly greater than y i.e., ∀ξ ∈ x, ∃η ∈ y, ξ ≥ η and ∀η ∈ y, ∃ξ ∈ x, ξ ≥ η.
interior x y returns true if x is interior to y in the topological sense. For example interior entire entire is true.
x < y says whether x is strictly weakly less than y i.e., ∀ξ ∈ x, ∃η ∈ y, ξ < η and ∀η ∈ y, ∃ξ ∈ x, ξ < η.
strict_precedes x y returns true iff x is to the left and does not touch y.
Operations
size a returns an interval containing the true width of the interval high a - low a.
size_high a returns the width of the interval high a - low a rounded up.
size_low a returns the width of the interval high a - low a rounded down.
sgn a returns the sign of each bound, e.g., for floats [float (compare (low a) 0.), float (compare (high a) 0.)].
truncate a returns the integer interval containing a, that is [floor(low a), ceil(high a)].
abs a returns the absolute value of the interval, that is
aiflow a≥0.,~- aifhigh a≤0., and- [0,
max (- low a) (high a)] otherwise.
hull a b returns the smallest interval containing a and b, that is [min (low a) (low b), max (high a) (high b)].
inter_exn x y returns Some z where z is the intersection of x and y if it is not empty and None if the intersection is empty.
max a b returns the "maximum" of the intervals a and b, that is [max (low a) (low b), max (high a) (high b)].
min a b returns the "minimum" of the intervals a and b, that is [min (low a) (low b), min (high a) (high b)].
a * b multiplies a by b according to interval arithmetic and returns the proper result. If a=zero or b=zero then zero is returned.
x *. a multiplies a by x according to interval arithmetic and returns the proper result. If x=0. then zero is returned.
a *. x multiplies a by x according to interval arithmetic and returns the proper result. If x=0. then zero is returned.
a / b divides the first interval by the second according to interval arithmetic and returns the proper result. Raise Interval.Division_by_zero if b=zero.
a /. x divides a by x according to interval arithmetic and returns the proper result. Raise Interval.Division_by_zero if x=0.0.
x /: a divides x by a according to interval arithmetic and returns the result. Raise Interval.Division_by_zero if a=zero.
inv a returns 1. /: a but is more efficient. Raise Interval.Division_by_zero if a=zero.
invx a is the extended division. When 0 ∉ a, the result is One(inv a). If 0 ∈ a, then the two natural intervals (properly rounded) Two([-∞, 1/(low a)], [1/(high a), +∞]) are returned. Raise Interval.Division_by_zero if a=zero.
cancelminus x y returns the tightest interval z such that x ⊆ z + y. If no such z exists, it returns entire.
cancelplus x y returns the tightest interval z such that x ⊆ z - y. If no such z exists, it returns entire.