Interval arithmetic: + - * /

### 6.38.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.

Example.
Input:

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

Output:

[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.

Example.
Input:

-i[2,3]

Output:

[−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.

Examples.

- Input:
  i[1,4]*i[2,3]
  Output:

  [2.00000000000000..0.120000000000000e2]

- Input:
  i[-2,4]*i[3,5]
  Output:

  [−0.100000000000000e2..0.200000000000000e2]

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

Examples.

- textitInput:
  1/i[2,3]
  Output:

  [0.333333333333333..0.500000000000000]

- Input:
  1/i[-6,-3]
  Output:

  [−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.

Examples.

- Input:
  1/i[0,2]
  Output:

  ⎡ ⎣ | 0.500000000000000..+∞ | ⎤ ⎦

- Input:
  1/i[-1,0]
  Output:

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

  Input:
  1/i[-2,3]
  Output:

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

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