API reference

All names below are available directly on the top-level pyintval module.

Interval

class pyintval.Interval

A closed, connected set of real numbers with double-precision endpoints.

Construct from bounds Interval(lo, hi), from a single real number Interval(x) (a degenerate point interval), or from a string Interval("[0.1, 0.2]") / Interval("0.1") which is parsed with correct outward rounding so the result provably encloses the exact decimal value.

Every operation returns an interval guaranteed to contain the true image of the operation over its inputs. Division by an interval containing zero yields an unbounded interval (or the empty set) rather than raising.

__and__(self: pyintval._core.Interval, arg0: pyintval._core.Interval) pyintval._core.Interval
__contains__(self: pyintval._core.Interval, arg0: object) bool
__or__(self: pyintval._core.Interval, arg0: pyintval._core.Interval) pyintval._core.Interval
contains(self: pyintval._core.Interval, value: object) bool

True if value (a number or interval) lies in self.

static empty() pyintval._core.Interval

The empty set.

property endpoints

The pair (lo, hi).

static entire() pyintval._core.Interval

The whole real line (-inf, +inf).

property hi

Upper endpoint (-inf for the empty set).

hull(self: pyintval._core.Interval, other: pyintval._core.Interval) pyintval._core.Interval

Interval hull of the union of self and other.

intersection(self: pyintval._core.Interval, other: pyintval._core.Interval) pyintval._core.Interval
property is_common

True if the interval is nonempty and bounded.

is_disjoint(self: pyintval._core.Interval, other: pyintval._core.Interval) bool
property is_empty
property is_entire
is_interior_to(self: pyintval._core.Interval, other: pyintval._core.Interval) bool
property is_singleton

True if the interval is a single point.

less(self: pyintval._core.Interval, other: pyintval._core.Interval) bool
property lo

Lower endpoint (+inf for the empty set).

property mag

the largest absolute value attained in the interval.

Type:

Magnitude

property mid

A finite midpoint inside the interval.

property mig

the smallest absolute value attained in the interval.

Type:

Mignitude

overlaps(self: pyintval._core.Interval, other: pyintval._core.Interval) bool
precedes(self: pyintval._core.Interval, other: pyintval._core.Interval) bool
property rad

Radius (half width, rounded up).

strict_less(self: pyintval._core.Interval, other: pyintval._core.Interval) bool
strict_precedes(self: pyintval._core.Interval, other: pyintval._core.Interval) bool
subset(self: pyintval._core.Interval, other: pyintval._core.Interval) bool

True if self is a subset of other.

superset(self: pyintval._core.Interval, other: pyintval._core.Interval) bool

True if self is a superset of other.

property wid

Width, rounded up.

DecoratedInterval

class pyintval.DecoratedInterval

An interval paired with an IEEE 1788 decoration certifying, from the computation’s history, the strongest property known of the function evaluated so far: ‘com’ (defined, continuous, bounded on a common input), ‘dac’ (defined and continuous), ‘def’ (defined), ‘trv’ (only the enclosure is guaranteed), or ‘ill’ (not an interval). A result decoration of ‘dac’ or ‘com’ is a machine-checked certificate that the whole composed expression is defined and continuous on its input box.

property decoration

The decoration as one of ‘com’/’dac’/’def’/’trv’/’ill’.

static from_parts(interval: pyintval._core.Interval, decoration: str) pyintval._core.DecoratedInterval

Build a decorated interval from a bare interval and an explicit decoration.

property hi
property interval

The bare interval.

property is_common
property is_defined
property is_defined_and_continuous
property is_nai
property lo
static nai() pyintval._core.DecoratedInterval

The Not-an-Interval (ill) value.

Elementary functions

Each math function is polymorphic: an Interval argument returns an Interval, a DecoratedInterval returns a DecoratedInterval carrying the propagated decoration.

pyintval.sqrt(*args, **kwargs)

Overloaded function.

  1. sqrt(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. sqrt(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.sqr(*args, **kwargs)

Overloaded function.

  1. sqr(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. sqr(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.cbrt(*args, **kwargs)

Overloaded function.

  1. cbrt(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. cbrt(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.exp(*args, **kwargs)

Overloaded function.

  1. exp(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. exp(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.exp2(*args, **kwargs)

Overloaded function.

  1. exp2(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. exp2(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.exp10(*args, **kwargs)

Overloaded function.

  1. exp10(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. exp10(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.expm1(*args, **kwargs)

Overloaded function.

  1. expm1(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. expm1(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.log(*args, **kwargs)

Overloaded function.

  1. log(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. log(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.log2(*args, **kwargs)

Overloaded function.

  1. log2(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. log2(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.log10(*args, **kwargs)

Overloaded function.

  1. log10(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. log10(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.log1p(*args, **kwargs)

Overloaded function.

  1. log1p(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. log1p(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.sin(*args, **kwargs)

Overloaded function.

  1. sin(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. sin(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.cos(*args, **kwargs)

Overloaded function.

  1. cos(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. cos(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.tan(*args, **kwargs)

Overloaded function.

  1. tan(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. tan(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.asin(*args, **kwargs)

Overloaded function.

  1. asin(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. asin(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.acos(*args, **kwargs)

Overloaded function.

  1. acos(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. acos(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.atan(*args, **kwargs)

Overloaded function.

  1. atan(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. atan(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.atan2(*args, **kwargs)

Overloaded function.

  1. atan2(y: pyintval._core.Interval, x: pyintval._core.Interval) -> pyintval._core.Interval

  2. atan2(y: pyintval::DecoratedInterval, x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.sinh(*args, **kwargs)

Overloaded function.

  1. sinh(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. sinh(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.cosh(*args, **kwargs)

Overloaded function.

  1. cosh(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. cosh(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.tanh(*args, **kwargs)

Overloaded function.

  1. tanh(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. tanh(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.asinh(*args, **kwargs)

Overloaded function.

  1. asinh(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. asinh(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.acosh(*args, **kwargs)

Overloaded function.

  1. acosh(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. acosh(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.atanh(*args, **kwargs)

Overloaded function.

  1. atanh(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. atanh(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.hypot(*args, **kwargs)

Overloaded function.

  1. hypot(x: pyintval._core.Interval, y: pyintval._core.Interval) -> pyintval._core.Interval

  2. hypot(x: pyintval::DecoratedInterval, y: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.pow(*args, **kwargs)

Overloaded function.

  1. pow(x: pyintval._core.Interval, y: pyintval._core.Interval) -> pyintval._core.Interval

  2. pow(x: pyintval::DecoratedInterval, y: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.pown(*args, **kwargs)

Overloaded function.

  1. pown(x: pyintval._core.Interval, n: typing.SupportsInt | typing.SupportsIndex) -> pyintval._core.Interval

  2. pown(x: pyintval::DecoratedInterval, n: typing.SupportsInt | typing.SupportsIndex) -> pyintval::DecoratedInterval

pyintval.erf(*args, **kwargs)

Overloaded function.

  1. erf(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. erf(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.erfc(*args, **kwargs)

Overloaded function.

  1. erfc(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. erfc(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

Rounding, sign, and step functions

pyintval.abs(*args, **kwargs)

Overloaded function.

  1. abs(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. abs(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.fma(*args, **kwargs)

Overloaded function.

  1. fma(x: pyintval._core.Interval, y: pyintval._core.Interval, z: pyintval._core.Interval) -> pyintval._core.Interval

Fused multiply-add: a tight enclosure of x*y + z.

  1. fma(x: pyintval::DecoratedInterval, y: pyintval::DecoratedInterval, z: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.recip(*args, **kwargs)

Overloaded function.

  1. recip(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. recip(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.floor(*args, **kwargs)

Overloaded function.

  1. floor(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. floor(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.ceil(*args, **kwargs)

Overloaded function.

  1. ceil(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. ceil(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.trunc(*args, **kwargs)

Overloaded function.

  1. trunc(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. trunc(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.round(*args, **kwargs)

Overloaded function.

  1. round(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. round(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.round_ties_to_away(*args, **kwargs)

Overloaded function.

  1. round_ties_to_away(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. round_ties_to_away(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.sign(*args, **kwargs)

Overloaded function.

  1. sign(x: pyintval._core.Interval) -> pyintval._core.Interval

  2. sign(x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.min(*args, **kwargs)

Overloaded function.

  1. min(x: pyintval._core.Interval, y: pyintval._core.Interval) -> pyintval._core.Interval

  2. min(x: pyintval::DecoratedInterval, y: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.max(*args, **kwargs)

Overloaded function.

  1. max(x: pyintval._core.Interval, y: pyintval._core.Interval) -> pyintval._core.Interval

  2. max(x: pyintval::DecoratedInterval, y: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

Set operations and reverse (constraint) operations

pyintval.hull(*args, **kwargs)

Overloaded function.

  1. hull(x: pyintval._core.Interval, y: pyintval._core.Interval) -> pyintval._core.Interval

  2. hull(x: pyintval::DecoratedInterval, y: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.intersection(*args, **kwargs)

Overloaded function.

  1. intersection(x: pyintval._core.Interval, y: pyintval._core.Interval) -> pyintval._core.Interval

  2. intersection(x: pyintval::DecoratedInterval, y: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.cancel_minus(*args, **kwargs)

Overloaded function.

  1. cancel_minus(a: pyintval._core.Interval, b: pyintval._core.Interval) -> pyintval._core.Interval

  2. cancel_minus(a: pyintval::DecoratedInterval, b: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.cancel_plus(*args, **kwargs)

Overloaded function.

  1. cancel_plus(a: pyintval._core.Interval, b: pyintval._core.Interval) -> pyintval._core.Interval

  2. cancel_plus(a: pyintval::DecoratedInterval, b: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.mul_rev(*args, **kwargs)

Overloaded function.

  1. mul_rev(b: pyintval._core.Interval, c: pyintval._core.Interval) -> pyintval._core.Interval

{x : b*x meets c} as an interval hull.

  1. mul_rev(b: pyintval._core.Interval, c: pyintval._core.Interval, x: pyintval._core.Interval) -> pyintval._core.Interval

  2. mul_rev(b: pyintval::DecoratedInterval, c: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

  3. mul_rev(b: pyintval::DecoratedInterval, c: pyintval::DecoratedInterval, x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.sqr_rev(*args, **kwargs)

Overloaded function.

  1. sqr_rev(c: pyintval._core.Interval) -> pyintval._core.Interval

  2. sqr_rev(c: pyintval._core.Interval, x: pyintval._core.Interval) -> pyintval._core.Interval

  3. sqr_rev(c: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

  4. sqr_rev(c: pyintval::DecoratedInterval, x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

pyintval.abs_rev(*args, **kwargs)

Overloaded function.

  1. abs_rev(c: pyintval._core.Interval) -> pyintval._core.Interval

  2. abs_rev(c: pyintval._core.Interval, x: pyintval._core.Interval) -> pyintval._core.Interval

  3. abs_rev(c: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

  4. abs_rev(c: pyintval::DecoratedInterval, x: pyintval::DecoratedInterval) -> pyintval::DecoratedInterval

Constructors and constants

pyintval.empty() pyintval._core.Interval
pyintval.entire() pyintval._core.Interval
pyintval.pi() pyintval._core.Interval

A tight interval enclosing the mathematical constant pi.

pyintval.e() pyintval._core.Interval

A tight interval enclosing Euler’s number e.