Function: I = midrad (M, R)
Function: I = midrad (M)
Function: I = midrad ()
Function: [M, R] = midrad (I)

Create an interval enclosure I for [M-R, M+R].

With two output arguments, compute a rigorous midpoint M and radius R for interval I.

Without input parameters, return the empty interval. With only one input parameter, the radius R defaults to zero.

Parameters can be simple numbers, intervals or interval literals as strings. If needed, broadcasting is performed.

The result is not guaranteed to be tightest if parameters are given as strings. This is due to intermediate results. The infsupdec constructor with interval literals in uncertain form m?ruE can instead be used to create tight enclosures of decimal numbers with a radius.

Accuracy (with one output argument): The result is an accurate enclosure. The result is tightest if M and R are floating-point numbers or intervals.

Accuracy (with two output arguments): M is the interval’s midpoint in binary64 precision, rounded to nearest and ties to even. The returned radius R will make a tight enclosure of the interval together with M. That is, R is the smallest binary64 number, which will make [M-R, M+R] enclose the interval I.

midrad (42, 3)
  ⇒ ans = [39, 45]_com
midrad (0, inf)
  ⇒ ans = [Entire]_dac
midrad ("1.1", "0.1")
  ⇒ ans ⊂ [0.99999, 1.2001]_com
midrad ("25", "3/7")
  ⇒ ans ⊂ [24.571, 25.429]_com

See also: @infsupdec/infsupdec, hull, @infsupdec/mid, @infsupdec/rad.

Package: interval