# Interval

Interval[{min,max}]

represents the range of values between min and max.

Interval[{min1,max1},{min2,max2},]

represents the union of the ranges min1 to max1, min2 to max2, .

# 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 arbitraryprecision 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 machineprecision or arbitraryprecision 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 allclose all

## Basic Examples(2)

Add intervals, getting an interval representing the result:

Indeterminate limits can give intervals:

## Scope(8)

Squaring gives a non-negative interval:

Some functions can be applied to an interval:

Exact inputs yield exact interval results:

Disjoint intervals can be generated:

Exact comparisons can be made with intervals:

Solve an equation involving an interval:

Approximate numbers automatically turn into intervals:

Machine numbers always correspond to a certain interval:

Interval can be used as a geometric region:

## Generalizations & Extensions(1)

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

Specifying a different precision gives a different interval:

## Applications(5)

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

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

With Interval, the result spans the correct value:

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

Test for points within an Interval:

Apply it to a list of points to test membership:

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

Some steps:

Find the length of the region:

Find a formula for the sequence of lengths using FindSequenceFunction:

## Properties & Relations(1)

Use Max and Min to find end points of intervals:

## Possible Issues(1)

Intervals are always assumed independent:

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