Interval arithmetic

### 6.6.3 Interval arithmetic

You can apply the usual arithmetic operators, such as +, -, * and /, to intervals.

The result of adding two intervals is the interval whose endpoints are the sums of the left end points and the right end points. For example:

i[1,4]+i[2,3]

[3.00000000000000..7.00000000000000] |  |  |  |  |  |  |  |  |  |

The negative of an interval is the result of taking the negative of the end points of the interval. The new end points will have to be switched. For example:

-i[2,3]

[−3.00000000000000..−2.00000000000000] |  |  |  |  |  |  |  |  |  |

The product of two intervals is the interval whose endpoints are the product the left endpoints of the two intervals and the product of the right endpoints of the two intervals. The smallest product will be the left end point of the product interval, and the largest product will be the right end point of the product interval. For example:

i[1,4]*i[2,3]

[2.00000000000000..0.120000000000000e2] |  |  |  |  |  |  |  |  |  |

i[-2,4]*i[3,5]

[−0.100000000000000e2..0.200000000000000e2] |  |  |  |  |  |  |  |  |  |

The reciprocal of an interval is the interval determined by the reciprocals of the end points. For example:

1/i[2,3]

[0.333333333333333..0.500000000000000] |  |  |  |  |  |  |  |  |  |

1/i[-6,-3]

[−0.333333333333333..−0.166666666666667] |  |  |  |  |  |  |  |  |  |

If the original interval has zero as an end point, then the reciprocal interval will have plus or minus infinity as one of the end points. If one end point is positive and the other is negative, then the reciprocal will simply be the interval from -infinity to infinity. For example:

1/i[0,2]

| ⎡ ⎣ | 0.500000000000000..+∞ | ⎤ ⎦

1/i[-1,0]

| ⎡ ⎣ | −∞..−1.00000000000000 | ⎤ ⎦

1/i[-2,3]

| ⎡ ⎣ | −∞..+∞ | ⎤ ⎦

You can also, if you want, do the usual operations such as subtraction, division, powers and roots.