# RRi -- the class of all real intervals

## Description

A real interval is entered as a pair of real numbers to the interval function. It is stored internally as an arbitrary precision interval using the MPFI library.
 i1 : interval(3.1415,3.1416) o1 = [3.1415,3.1416] o1 : RRi (of precision 53)
The precision is measured in bits, is visible in the ring displayed on the second of each pair of output lines, and can be recovered using precision.
 i2 : precision interval(3.1415,3.1416) o2 = 53
For real intervals, the functions class and ring yield different results. That allows numbers of various precisions to be used without creating a new ring for each precision.
 i3 : class interval(3.1,3.5) o3 = RRi o3 : InexactFieldFamily i4 : ring interval(3.1,3.5) o4 = RRi 53 o4 : RealIntervalField
The precision can be specified on input by specifying the precision of both input RR numbers.Alternatively, the precision can be specified by including the option Precision.
 i5 : interval(2.5p100,3.2p1000) o5 = [2.5,3.2] o5 : RRi (of precision 100) i6 : interval(2.5,3.2,Precision=>200) o6 = [2.5,3.20000000000000017763568394002504646778106689453125] o6 : RRi (of precision 200)
Intervals can also be created using span(Sequence) to create the smallest interval containing the inputs.
 i7 : span(2,Precision=>100) o7 = [2,2] o7 : RRi (of precision 100) i8 : span(2,3,interval(-1.5,-0.5),73) o8 = [-1.5,73] o8 : RRi (of precision 53)
Operations using intervals are computed as sets so that the resulting intervals contain all possible outputs from pairs of points in input intervals.
 i9 : interval(1,3)+interval(2,4) o9 = [3,7] o9 : RRi (of precision 53) i10 : interval(-1,1)*interval(2,3) o10 = [-3,3] o10 : RRi (of precision 53) i11 : interval(0,1)-interval(0,1) o11 = [-1,1] o11 : RRi (of precision 53) i12 : interval(1,2)/interval(1,2) o12 = [.5,2] o12 : RRi (of precision 53)
The notion of equality tested by == amounts to checking the equality of the endpoints of intervals.The notion of equality tested by === takes into account the precision of the inputs as well.
 i13 : interval(1,3) == interval(1,3,Precision=>100) o13 = true i14 : interval(1,3) === interval(1,3,Precision=>100) o14 = false i15 : interval(1/3,1,Precision=>100)==interval(1/3,1,Precision=>1000) o15 = false
The notion of inequalities for intervals amounts to testing the inequality for all points in the intervals. In particular, <= is not the same as < or ==.
 i16 : interval(1,2)<=interval(2,3) o16 = true i17 : interval(1,2)<=interval(1,2) o17 = false i18 : interval(1,2)
Transcendental functions on intervals produce intervals containing the image of the function on the interval.
 i20 : exp(interval(2,4)) o20 = [7.38905609893065,54.5981500331442] o20 : RRi (of precision 53) i21 : cos(interval(1,1.3)) o21 = [.267498828624587,.54030230586814] o21 : RRi (of precision 53) i22 : sqrt(interval(2)) o22 = [1.41421356237309,1.4142135623731] o22 : RRi (of precision 53)
Transcendental functions are available to high precision, with numericInterval.
 i23 : numericInterval(100,pi) o23 = [3.14159265358979323846264338328,3.14159265358979323846264338328] o23 : RRi (of precision 100) i24 : numericInterval_200 EulerConstant o24 = [.577215664901532860606512090082402431042159335939923598805767 ,.577215664901532860606512090082402431042159335939923598805768] o24 : RRi (of precision 200)

## Functions and methods returning a real interval :

• "QQ * RRi" -- see * -- a binary operator, usually used for multiplication
• "RR * RRi" -- see * -- a binary operator, usually used for multiplication
• "RRi * QQ" -- see * -- a binary operator, usually used for multiplication
• "RRi * RR" -- see * -- a binary operator, usually used for multiplication
• "RRi * RRi" -- see * -- a binary operator, usually used for multiplication
• "RRi * ZZ" -- see * -- a binary operator, usually used for multiplication
• "ZZ * RRi" -- see * -- a binary operator, usually used for multiplication
• "+ RRi" -- see + -- a unary or binary operator, usually used for addition
• "QQ + RRi" -- see + -- a unary or binary operator, usually used for addition
• "RR + RRi" -- see + -- a unary or binary operator, usually used for addition
• "RRi + QQ" -- see + -- a unary or binary operator, usually used for addition
• "RRi + RR" -- see + -- a unary or binary operator, usually used for addition
• "RRi + RRi" -- see + -- a unary or binary operator, usually used for addition
• "RRi + ZZ" -- see + -- a unary or binary operator, usually used for addition
• "ZZ + RRi" -- see + -- a unary or binary operator, usually used for addition
• "- RRi" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "QQ - RRi" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RR - RRi" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RRi - QQ" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RRi - RR" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RRi - RRi" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RRi - ZZ" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "ZZ - RRi" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "QQ / RRi" -- see / -- a binary operator, usually used for division
• "RR / RRi" -- see / -- a binary operator, usually used for division
• "RRi / QQ" -- see / -- a binary operator, usually used for division
• "RRi / RR" -- see / -- a binary operator, usually used for division
• "RRi / RRi" -- see / -- a binary operator, usually used for division
• "RRi / ZZ" -- see / -- a binary operator, usually used for division
• "ZZ / RRi" -- see / -- a binary operator, usually used for division
• "abs(RRi)" -- see abs -- absolute value function
• "acos(RRi)" -- see acos -- arccosine
• "asin(RRi)" -- see asin -- arcsine
• "atan(RRi)" -- see atan -- compute the arctangent of a number
• "atan2(RRi,RRi)" -- see atan2 -- compute an angle of a certain triangle
• atan2(RR,RRi) (missing documentation)
• atan2(RRi,RR) (missing documentation)
• "cos(RRi)" -- see cos -- compute the cosine
• "cosh(RRi)" -- see cosh -- compute the hyperbolic cosine
• "cot(RRi)" -- see cot -- cotangent
• "coth(RRi)" -- see coth -- hyperbolic cotangent
• "csc(RRi)" -- see csc -- cosecant
• "csch(RRi)" -- see csch -- hyperbolic cosecant
• "exp(RRi)" -- see exp -- exponential function
• "expm1(RRi)" -- see expm1 -- exponential minus 1
• intersect(RRi) -- computes intersection of input intervals
• intersect(RRi,RRi) (missing documentation)
• "log(RRi)" -- see log -- logarithm function
• "log(RRi,RRi)" -- see log -- logarithm function
• log(RR,RRi) (missing documentation)
• log(RRi,RR) (missing documentation)
• "log1p(RRi)" -- see log1p -- logarithm of 1+x
• "sec(RRi)" -- see sec -- secant
• "sech(RRi)" -- see sech -- hyperbolic secant
• "sin(RRi)" -- see sin -- compute the sine
• "sinh(RRi)" -- see sinh -- compute the hyperbolic sine
• "sqrt(RRi)" -- see sqrt -- square root function
• "tan(RRi)" -- see tan -- compute the tangent
• "tanh(RRi)" -- see tanh -- compute the hyperbolic tangent

## Methods that use a real interval :

• "QQ == RRi" -- see == -- equality
• "RR == RRi" -- see == -- equality
• "RRi == QQ" -- see == -- equality
• "RRi == RR" -- see == -- equality
• "RRi == RRi" -- see == -- equality
• "RRi == ZZ" -- see == -- equality
• "ZZ == RRi" -- see == -- equality
• "diameter(RRi)" -- see diameter -- diameter of an interval
• intersection(RRi,RRi) -- computes intersection of input intervals
• isEmpty(RRi) -- empty test for an interval
• "isMember(QQ,RRi)" -- see isMember -- membership test in an interval
• "isMember(RR,RRi)" -- see isMember -- membership test in an interval
• "isMember(ZZ,RRi)" -- see isMember -- membership test in an interval
• "isReal(RRi)" -- see isReal -- whether a number is real
• isSubset(RRi,RRi) -- subset test for intervals
• "RRi << ZZ" -- see left shift
• "lift(RRi,type of QQ)" -- see lift -- lift to another ring
• "lift(RRi,type of RR_*)" -- see lift -- lift to another ring
• "lift(RRi,type of ZZ)" -- see lift -- lift to another ring
• "numeric(RRi)" -- see numeric -- convert to floating point
• "numeric(ZZ,RRi)" -- see numeric -- convert to floating point
• "RRi >> ZZ" -- see right shift
• "ring(RRi)" -- see ring -- get the associated ring of an object
• "size2(RRi)" -- see size2 -- number of binary digits to the left of the point

## For the programmer

The object RRi is , with ancestor classes InexactNumber < Number < Thing.