Interval
Details
- You can perform arithmetic and other operations on Interval objects.
- Interval [{min,max}] represents the closed interval that includes both end points.
- Min [interval] and Max [interval] give the end points of an interval.
- For approximate machine‐ or arbitrary‐precision numbers x, 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.
- Interval can be used as a geometric region.
- Interval can be generated by functions such as Limit .
- Relational operators such as Equal and Less yield explicit True or False results whenever they are given disjoint intervals.
Background & Context
- Interval [{min,max}] represents the closed interval of real values between min and max that includes both endpoints. The multi-argument form Interval [{min1,max1},{min2,max2},…]
represents the union of the ranges min1 to max1, min2 to max2, … and is equivalent to IntervalUnion [Interval[{min1,max1}],Interval[{min2,max2}],…]. The endpoints of an interval may be symbolic, real infinite or any real numeric expression, including exact, approximate machine‐precision or arbitrary‐precision numbers. - Arithmetic and relational operators may be applied to Interval objects in a process known as interval arithmetic. In the simplest case of interval of the form Interval [{min,max}], Min [interval] and Max [interval] return min and max, respectively.
- Interval may also serve as a one-dimensional region specification over which a computation should be performed, and a number of functions including Limit can return expressions involving Interval objects.
- NumberLinePlot may be used to visualize Interval objects on a number line.
- Interval is related to a number of other symbols. IntervalUnion and IntervalIntersection are the Interval analogs of Union and Intersection , respectively, while IntervalMemberQ may be used to explicitly test whether values (or intervals) are contained in a given interval. RegionMember may be used to generate a RegionMemberFunction for a given Interval , the result of which can be used to test elements for interval membership. Interval is also related to Range , Piecewise , MinMax , Line , InfiniteLine and HalfLine .
Examples
open all close allBasic 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]Scope (8)
Squaring gives a non-negative interval:
Interval[{-2, 5}] ^ 2Some 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}] > PiSolve 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$MachineEpsilonInterval can be used as a geometric region:
ℛ = Interval[{0, 1}];RegionQ[ℛ]RegionMeasure[ℛ]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]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 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 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 FindSequenceFunction :
FindSequenceFunction[%, n]Properties & Relations (2)
Use Max and Min to find end points of intervals:
Interval[{2, 4}]Max[%]CenteredInterval represents real intervals or complex rectangles:
CenteredInterval[1, 1 / 10]CenteredInterval[1 + 2I, 1 / 100 + I / 100]Convert a bounded Interval to CenteredInterval representation:
CenteredInterval[Interval[{1, 2}]]Convert it back:
Interval[Information[%, "Bounds"]]When interval endpoints are not binary rationals, conversion makes the interval larger:
Interval[{0, 1 / 3}]CenteredInterval[%]Interval[Information[%, "Bounds"]]N[%[[1]] - %%%[[1]]]Possible Issues (1)
Intervals are always assumed independent:
u = Interval[{-1, 1}]u + u ^ 2A single real variable over the same range yields an interval with a different lower limit:
Minimize[{x + x ^ 2, -1 < x < 1}, x]See Also
Range IntervalMemberQ IntervalUnion IntervalIntersection CenteredInterval Piecewise NumberLinePlot MinMax Around DateInterval
Function Repository: IntervalComplement RemoveSubintervals
Tech Notes
Related Guides
History
Introduced in 1996 (3.0) | Updated in 2014 (10.0)
Text
Wolfram Research (1996), Interval, Wolfram Language function, https://reference.wolfram.com/language/ref/Interval.html (updated 2014).
CMS
Wolfram Language. 1996. "Interval." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/Interval.html.
APA
Wolfram Language. (1996). Interval. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Interval.html
BibTeX
@misc{reference.wolfram_2026_interval, author="Wolfram Research", title="{Interval}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Interval.html}", note=[Accessed: 04-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_interval, organization={Wolfram Research}, title={Interval}, year={2014}, url={https://reference.wolfram.com/language/ref/Interval.html}, note=[Accessed: 04-September-2026]}