({{, (RefLink[Interval, paclet:ref/Interval])[{min,max}]
represents the range of values between min and max. }, {, (RefLink[Interval, paclet:ref/Interval])[{(min_1),(max_1)},{(min_2),(max_2)},…]
represents the union of the ranges (min_1) to (max_1), (min_2) to (max_2), …. }})

OpenersNotesSection(Spacer1)Details

You can perform arithmetic and other operations on (RefLink[Interval, paclet:ref/Interval]) objects.

(RefLink[Interval, paclet:ref/Interval])[{min,max}] represents the closed interval that includes both end points.

(RefLink[Min, paclet:ref/Min])[interval] and (RefLink[Max, paclet:ref/Max])[interval] give the end points of an interval.

For approximate machine- or arbitrary-precision numbers x, (RefLink[Interval, paclet:ref/Interval])[x] yields an interval reflecting the uncertainty in x.

In operations on intervals that involve approximate numbers, the Wolfram Language always rounds lower limits down and upper limits up.

(RefLink[Interval, paclet:ref/Interval]) can be used as a geometric region.

(RefLink[Interval, paclet:ref/Interval]) can be generated by functions such as (RefLink[Limit, paclet:ref/Limit]).

Relational operators such as (RefLink[Equal, paclet:ref/Equal]) and (RefLink[Less, paclet:ref/Less]) yield explicit (RefLink[True, paclet:ref/True]) or (RefLink[False, paclet:ref/False]) results whenever they are given disjoint intervals.

OpenersPrimaryExamplesSection(Spacer1)Examples  (18)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Add intervals, getting an interval representing the result:

Interval[{1,6}]+Interval[{0,2}]

Indeterminate limits can give intervals:

Limit[Sin[x]+Sin[x^2],x->Infinity]

OpenersExampleSection1(Spacer1)Scope  (8)

Squaring gives a non-negative interval:

Interval[{-2,5}]^2

Some functions can be applied to an interval:

Sin[Interval[{2.5,5.5}]]

Exact inputs yield exact interval results:

Sin[Interval[{2,7}]]

Sin[Interval[{2,10}]]

Disjoint intervals can be generated:

1/Interval[{-2,5}]

Exact comparisons can be made with intervals:

Interval[{5,8}]>Pi

Solve an equation involving an interval:

Solve[3x+2==Interval[{-2,5}],x]

Approximate numbers automatically turn into intervals:

Interval[1.]

Machine numbers always correspond to a certain interval:

%-1

$MachineEpsilon

(RefLink[Interval, paclet:ref/Interval]) can be used as a geometric region:

ℛ=Interval[{0,1}];

RegionQ[ℛ]

RegionMeasure[ℛ]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

Find the interval that the Wolfram Language considers consistent with machine number 0.:

Interval[0.]

Specifying a different precision gives a different interval:

Interval[0``500]

OpenersExampleSection3(Spacer1)Applications  (5)

Watch the widening of intervals in a system with sensitive dependence on initial conditions:

NestList[4#(1-#)&,Interval[0.5],4]

With machine-precision evaluation, this gives a definite but incorrect value:

Sin[N[Pi]]

With (RefLink[Interval, paclet:ref/Interval]), the result spans the correct value:

Sin[Interval[N[Pi]]]

Show how the bounds of an interval vary with a parameter:

Plot[With[{u=Sin[Interval[{6,x}]]},{Min[u],Max[u]}],{x,0,15}]

Test for points within an (RefLink[Interval, paclet:ref/Interval]):

ℛ=Interval[{0,1}];
gr=NumberLinePlot[ℛ]

mf=RegionMember[ℛ]

Apply it to a list of points to test membership:

pts=RandomVariate[UniformDistribution[{{-0.5,1.5}}],100];
col=mf[pts]/.{False->Gray,True->Red};

gp=Graphics[{AbsolutePointSize[1.6],Table[{col[[i]],Point[{pts[[i,1]],3}]},{i,100}]}];

Show[gr,gp,PlotRange->All]

Construct the Cantor set by starting with a {0,1} interval and remove the middle third of each interval in each step:

cantor={a_,b_}:>{{a,a+(b-a)/3},{a+(b-a)2/3,b}};

CantorRegion[n_Integer?NonNegative]:=
Interval@@Nest[Flatten[Map[Function[s,s/.cantor],#],1]&,{{0,1}},n]

Some steps:

CantorRegion[1]

CantorRegion[2]

NumberLinePlot[Table[CantorRegion[i],{i,3}],PlotRange->{{0,1},Automatic}]

Find the length of the region:

Table[RegionMeasure[CantorRegion[i]],{i,5}]

Find a formula for the sequence of lengths using (RefLink[FindSequenceFunction, paclet:ref/FindSequenceFunction]):

FindSequenceFunction[%,n]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

Use (RefLink[Max, paclet:ref/Max]) and (RefLink[Min, paclet:ref/Min]) to find end points of intervals:

Interval[{2,4}]

Max[%]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

Intervals are always assumed independent:

u=Interval[{-1,1}]

u+u^2

A single real variable over the same range yields an interval with a different lower limit:

Minimize[{x+x^2,-1<x<1},x]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Range, paclet:ref/Range])  ▪  (RefLink[IntervalMemberQ, paclet:ref/IntervalMemberQ])  ▪  (RefLink[IntervalUnion, paclet:ref/IntervalUnion])  ▪  (RefLink[IntervalIntersection, paclet:ref/IntervalIntersection])  ▪  (RefLink[Piecewise, paclet:ref/Piecewise])  ▪  (RefLink[NumberLinePlot, paclet:ref/NumberLinePlot])  ▪  (RefLink[MinMax, paclet:ref/MinMax])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Finding Limits, paclet:tutorial/FindingLimits])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Interval Arithmetic, paclet:guide/IntervalArithmetic])}, {▪(RefLinkPlain[Basic Geometric Regions, paclet:guide/GeometricSpecialRegions])}, {▪(RefLinkPlain[WDF (Wolfram Data Framework), paclet:guide/WDFWolframDataFramework])}, {▪(RefLinkPlain[Numbers with Uncertainty, paclet:guide/NumbersWithUncertainty])}})}})