Interval
Usage
• Interval[ min, max ]表示在min和max之间的值的范围。
Notes
• 可以在对象Interval上进行算术和其他运算。 • Min[interval] 和 Max[interval] 给出一个区间的端点。
• 对近似机器数或任意精度的数x, Interval[x]产生一个反映 x 的不确定性的一个区间。
• 在对涉及近似数的区间进行运算时,Mathematica总是四舍五入将下限向下上限向上。 • Interval 可以由如同 Limit的函数产生。 • 如同Equal和Less的关系运算,无论什么时候它们被给在不相交区间,就产生True或False结果. • 参见 Mathematica 全书 : 节 3.6.8.
Further Examples
You can use Max and Min to find the endpoints of intervals.
In[1]:=
|
Out[1]=
|
You can take the union and intersection of the two or more intervals.
In[2]:=
|
Out[2]=
|
Using IntervalMemberQ, you can check if an interval is contained in another.
In[3]:=
|
Out[3]=
|
You can also check if a point belongs to an interval.
In[4]:=
|
Out[4]=
|
You can do interval arithmetic with many functions. For example, this command reflects the fact that the square of any real number between -2 and 5 lies between 0 and 25.
In[5]:=
|
Out[5]=
|
Taking the reciprocal gives two distinct intervals.
In[6]:=
|
Out[6]=
|
You can use intervals in many kinds of functions.
In[7]:=
|
Out[7]=
|
Some functions automatically generate intervals.
In[8]:=
|
Out[8]=
|
With ordinary machine-precision arithmetic, this gives an incorrect result.
In[9]:=
|
Out[9]=
|
The interval generated here, however, correctly includes the point 0.
In[10]:=
|
Out[10]=
|
Interval arithmetic is useful in obtaining or proving bounds. Here we define a function , which depends on two parameters . We then show that this function is monotonically nonincreasing in for all values of the parameter.
In[11]:=
|
Out[11]=
|
In[12]:=
|
|