Interval package

From Octave
Revision as of 07:03, 2 January 2016 by Oheim (talk | contribs) (Known differences)
Jump to navigation Jump to search

The GNU Octave interval package for real-valued interval arithmetic.

Plotting the interval enclosure of a function


Development status

  • Completeness
    • All required functions from IEEE Std 1788-2015, IEEE standard for interval arithmetic, are implemented. The standard was approved on June 11, 2015. It will remain active for ten years.
    • In addition there are functions for interval matrix arithmetic, plotting and solvers.
  • Quality
    • Includes tests for all functions, many tests for basic functions
    • No known bugs. The package is quite new and still has a small user base, so there might be hidden bugs. Also some advanced functions will always need more testing.
  • Portability
    • Runs in GNU Octave 3.8.2 and 4.0.0
    • Known to run under GNU/Linux, Microsoft Windows, Mac OS X and FreeBSD
  • Possible TODOs
    • To be considered in the future: Algorithms can be migrated from the C-XSC Toolbox (C++ code) from [1] (nlinsys.cpp and cpzero.cpp), however these would need gradient arithmetic and complex arithmetic.
    • Interval version of interp1


The interval package's main goal is to be compliant with IEEE Std 1788-2015, so it is compatible with other standard-conforming implementations (on the set of operations described by the standard document).

Octave Forge simp package

In 2008/2009 there was a Single Interval Mathematics Package (SIMP) for Octave, which has eventually become unmaintained at Octave Forge.

The simp package contains a few basic interval arithmetic operations on scalar or vector intervals. It does not consider inaccurate built-in arithmetic functions, round-off, conversion and representational errors. As a result its syntax is very easy, but the arithmetic fails to produce guaranteed enclosures.

It is recommended to use the interval package as a replacement for simp. However, function names and interval constructors are not compatible between the packages.


This interval package is not meant to be a replacement for INTLAB and any compatibility with it is pure coincidence. Since both are compatible with GNU Octave, they happen to agree on many function names and programs written for INTLAB may possibly run with this interval package as well. Some fundamental differences that I am currently aware of:

  • INTLAB is non-free software, it grants none of the four essential freedoms of free software
  • INTLAB is not conforming to IEEE Std 1788-2015 and the parsing of intervals from strings uses a different format—especially for the uncertain form
  • INTLAB supports intervals with complex numbers and sparse interval matrices, but no empty intervals
  • INTLAB uses inferior accuracy for most arithmetic operations, because it focuses on speed
  • Basic operations can be found in both packages, but the availability of special functions depends
Code: In GNU Octave the interval package can also be run alongside INTLAB.
 # INTLAB intervals
 A1 = infsup (2, 3);
 B1 = hull (-4, A1);
 C1 = midrad (0, 2);
 # Interval package intervals
 pkg load interval
 A2 = infsup (2, 3);
 B2 = hull (-4, A2);
 C2 = midrad (0, 2);
 pkg unload interval
 # Computation with INTLAB
 A1 + B1 * C1
 # Computation without INTLAB
 A2 + B2 * C2

Known differences

Simple programs written for INTLAB should run without modification with this interval package. The following table lists common functions that use a different name in INTLAB.

interval package INTLAB
infsup (x) intval (x)
wid (x) diam (x)
subset (a, b) in (a, b)
interior (a, b) in0 (a, b)
isempty (x) isnan (x)
disjoint (a, b) emptyintersect (a, b)
hdist (a, b) qdist (a, b)
disp (x) disp2str (x)
infsup (s) str2intval (s)
isa (x, "infsup") isintval (x)

Similar software

For C++ there is an interval library libieeep1788 by Marco Nehmeier (member of IEEE P1788). It aims to be standard compliant with IEEE Std 1788-2015 and is designed in a modular way, supporting several interval data types and different flavors of interval arithmetic [2]. The GNU Octave interval package shares several unit tests with libieeep1788.

For Julia there is an evolving interval library ValidatedNumerics.jl by Luis Benet and David P. Sanders. It is planned to become conforming to IEEE Std 1788-2015 (or to the basic standard 1788.1) in the future.