# Changes

,  04:15, 10 June 2019
m
Remove redundant Category:Packages.
The GNU Octave interval package for real-valued [https://sourceforgeen.netwikipedia.org/p/octavewiki/Interval_arithmetic interval/ interval packagearithmetic] provides data types and fundamental operations for .* Intervals are closed, connected subsets of the real valued interval arithmetic based on the common floating-point format “binary64” anumbers. kIntervals may be unbound (in either or both directions) or empty. a. doubleIn special cases <code>+inf</code> and <code>-precisioninf</code> are used to denote boundaries of unbound intervals, but any member of the interval is a finite real number. * Classical functions are extended to interval functions as follows: The result of function f evaluated on interval x is an interval '''Interval arithmeticenclosure of all possible values''' produces mathematically proven numerical resultsof f over x where the function is defined. Most interval arithmetic functions in this package manage to produce a very accurate such enclosure.* The result of an interval arithmetic function is an interval in general. It aims to might happen, that the mathematical range of a function consist of several intervals, but their union will be standard compliant with the (upcoming) [http://standardsreturned, e.ieee g.org, 1 /develop/project/1788.html IEEE 1788[-1, 1] = [Entire] and therefore implements the ''set-based'' interval arithmetic flavor.
Warning__TOC__[[File: The package has not yet been releasedInterval-sombrero.png|280px|thumb|left|Example: Plotting the interval enclosure of a function]]<div style="clear:left"></div>
== Motivation Distribution ==* [https://octave.sourceforge.io/interval/ Latest version at Octave Forge]** <code>pkg install -forge interval</code>** [https://octave.sourceforge.io/interval/overview.html function reference]** [https://octave.sourceforge.io/interval/package_doc/index.html package documentation] (user manual)'''Third-party'''* [https://tracker.debian.org/pkg/octave-interval Debian GNU/Linux], [https://launchpad.net/ubuntu/+source/octave-interval Launchpad Ubuntu]* [https://aur.archlinux.org/packages/octave-interval/ archlinux user repository]* Included in [https://ftp.gnu.org/gnu/octave/windows/ official Windows installer] and installed automatically with Octave (since version 4.0.1)* [https://github.com/macports/macports-ports/tree/master/math/octave-interval/ MacPorts] for Mac OS X* [https://www.freshports.org/math/octave-forge-interval/ FreshPorts] for FreeBSD* [https://cygwin.com/cgi-bin2/package-grep.cgi?grep=octave-interval Cygwin] for Windows* [https://build.opensuse.org/package/show/science/octave-forge-interval openSUSE build service]
{{quote|Give a digital computer a problem in == Development status ==* Completeness** All required functions from [https://standards.ieee.org/findstds/standard/1788-2015.html IEEE Std 1788-2015], IEEE standard for interval arithmetic, and it are implemented. The standard was approved by IEEE-SA on June 11, 2015. It will grind away methodicallyremain active for ten years. The standard was approved by ANSI in 2016.** Also, tirelesslythe minimalistic standard [https://standards.ieee.org/findstds/standard/1788.1-2017.html IEEE Std 1788.1-2017], at gigahertz speedIEEE standard for interval arithmetic (simplified) is fully implemented. The standard was approved by IEEE-SA on December 6, until ultimately it produces the wrong answer2017 (and published in January 2018). … An ** In addition there are functions for interval computation yields a pair of numbersmatrix arithmetic, N-dimensional interval arrays, plotting, an upper and a lower boundsolvers.* Quality** Most arithmetic operations produce tight, correctly-rounded results. That is, the smallest possible interval with double-precision (binary64) endpoints, which are guaranteed encloses the exact result.** Includes [https://github.com/oheim/ITF1788 large test suite] for arithmetic functions** For open bugs please refer to enclose the [https://savannah.gnu.org/search/?words=forge+interval&type_of_search=bugs&only_group_id=1925&exact answer=1 bug tracker].* Performance** All elementary functions have been [https://octave. Maybe you still don’t know org/doc/interpreter/Vectorization-and-Faster-Code-Execution.html vectorized] and run fast on large input data.** Arithmetic is performed with the truth, but at least you know how much you don’t know.|Brian Hayes|[http://dxwww.doimpfr.org/10GNU MPFR] library internally.1511Where possible, the optimized [http://2003web.6archive.484 DOIorg/web/20170128033523/http: 10//lipforge.ens-lyon.1511fr/www/crlibm/2003CRlibm] library is used.* Portability** Runs in GNU Octave ≥ 3.68.484]}}2** Known to run under GNU/Linux, Microsoft Windows, macOS, and FreeBSD
{| class== Project ideas (TODOs) ==* To be considered in the future: Algorithms can be migrated from the C-XSC Toolbox (C++ code) from [http://www2.math.uni-wuppertal.de/wrswt/xsc/cxsc_new.html] (nlinsys.cpp and cpzero.cpp), however these would need gradient arithmetic and complex arithmetic.* Interval version of <code>interp1</code>* Extend <code>subsasgn</code> to allow direct manipulation of inf and sup (and dec) properties. >> A = infsup ("[2, 4]"); >> A.inf = infsup ("[1, 3]") A = [1, 4] >> A.inf = 5 A = [Empty]:* While at it, also allow multiple subscripts in <code>subsasgn</code> >> A(:)(2:4)(2) = 42; # equivalent to A(3) = 42 >> A.inf(3) = 42; # also A(3).inf = 42 >> A.inf.inf = 42 # should produce error? >> A.inf.sup = 42 # should produce error?* Tight Enclosure of Matrix Multiplication with Level 3 BLAS [http://kam.mff.cuni.cz/conferences/swim2015/abstracts/ozaki.pdf] [http://kam.mff.cuni.cz/conferences/swim2015/slides/ozaki.pdf]* Verified Convex Hull for Inexact Data [http://kam.mff.cuni.cz/conferences/swim2015/abstracts/ohta.pdf] [http://kam.mff.cuni.cz/conferences/swim2015/slides/ohta.pdf]* Implement user-controllable output from the interval standard (e. g. via printf functions): a) It should be possible to specify the preferred overall field width (the length of s). b) It should be possible to specify how Empty, Entire and NaI are output, e.g., whether lower or upper case, and whether Entire becomes [Entire] or [-Inf, Inf]. c) For l and u, it should be possible to specify the field width, and the number of digits after the point or the number of significant digits. (partly this is already implemented by output_precision (...) / `format long` / `format short`) d) It should be possible to output the bounds of an interval without punctuation, e.g., 1.234 2.345 instead of [1.234, 2.345]. For instance, this might be a convenient way to write intervals to a file for use by another application. == Compatibility ==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). Other implementations, which are known to aim for standard conformance are: * [https://github.com/JuliaIntervals/IntervalArithmetic.jl IntervalArithmetic.jl package] (Julia)* [https://github.com/jinterval/jinterval JInterval library] (Java)* [https://github.com/nadezhin/libieeep1788 ieeep1788 library] (C++) created by Marco Nehmeier, later forked by Dmitry Nadezhin === 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. === INTLAB ===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 [http://www.gnu.org/philosophy/free-sw.html 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  <div style="wikitabledisplay:flex; align-items: flex-start" ><div style="margin-right: auto2em">{{Code|Computation with this interval package|<syntaxhighlight lang="octave">pkg load intervalA1 = infsup (2, 3);B1 = hull (-4, A2);C1 = midrad (0, 2); A1 + B1 * C1</syntaxhighlight>}}</div><div>{{Code|Computation with INTLAB|<syntaxhighlight lang="octave">startintlabA2 = infsup (2, 3);B2 = hull (-4, A2);C2 = midrad (0, 2); A2 + B2 * C2</syntaxhighlight>}}</div></div> ==== 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.{|!Standard floating point arithmeticinterval package!Interval arithmeticINTLAB
|-
| style = "verticalinfsup (x)| intval (x)|-align: top" | wid (x)|diam (x) octave:1> 19 * 0.1 |- 2 + 0.1 ans = 1.3878e| subset (a, b)| in (a, b)|-16| style = "verticalinterior (a, b)| in0 (a, b)|-align: top" |isempty (x) octave:1> | isnan (x = infsup )|-| disjoint (a, b)| emptyintersect (a, b)|-| hdist (a, b)| qdist ("0.1"a, b); octave:2> 19 * |-| disp (x - 2 + )| disp2str (x) ans = [|-3.1918911957973251e| infsup (s)| str2intval (s)|-16| isa (x, +1.3877787807814457e-16]"infsup")| isintval (x)
|}
Floating point arithmetic, as specified by [http== Developer Information ===== Source Code Repository ===https://ensourceforge.wikipedia.orgnet/p/octave/interval/wikici/IEEE_floating_point IEEE 754], is available in almost every computer system today. It is wide-spread, implemented in common hardware and integral part in programming languages. For example, the extended precision format is the default numeric data type in GNU Octave. Benefits are obvious: The performance of arithmetic operations is well-defined, highly efficient and results are comparable between different systems./tree/
However, there are some downsides of floating point arithmetic in practice, which will eventually produce errors in computations.=== Dependencies ===* Floating point arithmetic is often used mindlessly by developers. [http://docs.oracle.com/cd/E19957 apt-01/806get install liboctave-3568/ncg_goldberg.html]* The binary data types categorically are not suitable for doing financial computations. Very often representational errors are introduced when using “real world” decimal numbers.* Even if the developer would be proficient, most developing environments / technologies limit floating point arithmetic capabilities to a very limited subset of IEEE 754: Only one or two data types, no rounding modes, …* Results are hardly predictable. All operations produce the best possible accuracy ''at runtime'', this is how floating point works. Contrariwise, financial computer systems typically use a [http://en.wikipedia.org/wiki/Fixed-point_arithmetic fixed-point arithmetic] (COBOL, PL/I, …), where overflow and rounding can be precisely predicted ''at compiledev mercurial make automake libmpfr-time''.* If you do not know the technical details, cf. first bullet, you ignore the fact that the computer lies to you in many situations. For example, when looking at numerical output and the computer says “<code>ans = 0.1</code>,” this is not absolutely correct. In fact, the value is only ''close enough'' to the value 0.1.dev
Interval arithmetic addresses above problems in its very special way === Build ===The repository contains a Makefile which controls the build process. Some common targets are:* <code>make release</code> Create a release tarball and introduces new possibilities the HTML documentation for algorithms. For example, the [http://en.wikipedia[Octave Forge]] (takes a while).org* <code>make check</wiki/Interval_arithmetic#Interval_Newton_method interval newton method] is able code> Run the full test-suite to find verify that code changes didn''all'' zeros t break anything (takes a while).* <code>make run</code> Quickly start Octave with minimal recompilation and functions loaded from the workspace (for interactive testing of a particular functioncode changes).
== Theory =='''Build dependencies'''<code>apt-get install libmpfr-dev autoconf automake inkscape zopfli</code>
=== Moore's fundamental theroem of interval arithmetic Architecture ===Let '''''y''''' = ''f''('''''x''''') be the result ofinterval-evaluation of ''f'' over a box '''''x''''' = (''x''<sub>1</sub>, … , ''x''<sub>''n''</sub>)using any interval versions of its component library functions. Then# In all cases, '''''y''''' contains the range of ''f'' over '''''x''''', that is, the set of ''f''('''''x''''') at points of '''''x''''' where it is defined: '''''y''''' ⊇ Rge(''f'' | '''''x''''') = {''f''(''x'') | ''x'' ∈ '''''x''''' ∩ Dom(''f'') }# If also each library operation in ''f'' is everywhere defined on its inputs, while evaluating '''''y''''', then ''f'' is everywhere defined on '''''x''''', that is Dom(''f'') ⊇ '''''x'''''.# If in addition, each library operation in ''f'' is everywhere continuous on its inputs, while evaluating '''''y''''', then ''f'' is everywhere continuous on '''''x'''''.# If some library operation in ''f'' is nowhere defined on its inputs, while evaluating '''''y''''', then ''f'' is nowhere defined on '''''x''''', that is Dom(''f'') ∩ '''''x''''' = Ø.
== Quick start introduction ==In a nutshell the package provides two new data types to users: bare intervals and decorated intervals. The data types are implemented as:* class <code>infsup</code> (bare interval) with attributes <code>inf</code> (lower interval boundary) and <code>sup</code> (upper interval boundary)* class <code>infsupdec</code> (decorated interval) which extends the former and adds attribute <code>dec</code> (interval decoration).
=== Input and output ===Before exercising interval arithmeticAlmost all functions in the package are implemented as methods of these classes, interval objects must be created, typically from non-interval datae. g. There are interval constants <code>empty<@infsup/code> and <code>entiresin</code> and implements the class constructors <code>infsup</code> sine function for bare intervals and <. Most code>infsupdec</is kept in m-files. Arithmetic operations that require correctly-rounded results are implemented in oct-files (C++ code> for decorated intervals. The class constructors ), these are very sophisticated and can be used with several kinds internally by the m-files of parameters: Interval boundaries can be given by numeric values or string values with decimal numbersthe package. Also it The source code is possible to use so called interval literals with square brackets.organized as follows:
octave:1> infsup (1)+- doc/ – package manual ans = +- inst/ octave:2> | +- @infsup (1, 2)/ ans = [1, 2]| | +- infsup.m – class constructor for bare intervals octave:3> infsup | | +- sin.m – sine function for bare intervals ("3", "4"uses mpfr_function_d internally) ans = [3, 4]| | `- ... – further functions on bare intervals octave:4> infsup ("1.1")| +- @infsupdec/ ans = [1.0999999999999998, 1| | +- infsupdec.1000000000000001]m – class constructor for decorated intervals octave:5> | | +- sin.m – sine function for decorated intervals (uses @infsup ("[5, 6.5]"/sin internally) ans = [5, 6| | `- ...5] – further functions on decorated intervals octave:6> infsup ("[5| `- ...8e – a few global functions that don't operate on intervals `- src/ +-17]"mpfr_function_d.cc – computes various arithmetic functions correctly rounded (using MPFR) ans = [5 `- ..799999999999999e-17, 5.800000000000001e – other oct-17]file sources
It is possible to access the exact numeric interval boundaries with the functions === Best practices ======= Parameter checking ====* All methods must check <code>infnargin</code> and call <code>supprint_usage</code>if the number of parameters is wrong. The default text representation of This prevents simple errors by the user.* Methods with more than 1 parameter must convert non-interval parameters to intervals can be created with <code>intervaltotext</code>using the class constructor. The default text representation is not guaranteed This allows the user to be exact (see mix non-interval parameters with interval parameters and the function <code>intervaltoexact</code>), because this would massively spam console outputtreats any inputs as intervals. For example, the exact text representation of <code>realmin</code> would Invalid values will be over 700 decimal places long! However, the default text representation is correct as it guarantees to contain handled by the actual boundaries and is accurate enough to separate different boundariesclass constructors. if (not (isa (x, "infsup"))) x = infsup (x); endif if (not (isa (y, "infsup"))) y = infsup (y); endif
octave:7> infsup if (1not (isa (x, 1 + eps"infsupdec"))) x = infsupdec (x); ans = [1, 1.0000000000000003]endif octave:8> infsup if (not (1isa (y, 1 + 2 * eps"infsupdec"))) y = infsupdec (y); ans = [1, 1.0000000000000005]endif
Warning: Decimal fractions should always ==== Use of Octave functions ====Octave functions may be passed used as long as a string to the constructorthey don't introduce arithmetic errors. Otherwise it is possibleFor example, that GNU Octave introduces conversion errors when the numeric literal is converted into floating-point format '''before''' ceil function can be used safely since it is passed to the constructorexact on binary64 numbers. function x = ceil (x) ... parameter checking ... x.inf = ceil (x.inf); x.sup = ceil (x.sup); endfunction
octave:9> infsup If Octave functions would introduce arithmetic/rounding errors, there are interfaces to MPFR (<span style = "color:red"code>0.2mpfr_function_d</spancode>) ans = [.20000000000000001, .20000000000000002] octave:10> infsup and crlibm (<span style = "color:green"code>"0.2"crlibm_function</spancode>) ans = [.19999999999999998, which can produce guaranteed boundaries.20000000000000002]
==== Vectorization & Indexing ====All functions should be implemented using vectorization and indexing. This is very important for performance on large data. For convenience it is possible to implicitly call example, consider the plus function. It computes lower and upper boundaries of the interval constructor during all interval operations if at least one input already is result (x.inf, y.inf, x.sup, y.sup may be vectors or matrices) and then uses an interval objectindexing expression to adjust values where empty intervals would have produces problematic values. function x = plus (x, y) ... parameter checking ... l = mpfr_function_d ('plus', -inf, x.inf, y.inf); u = mpfr_function_d ('plus', +inf, x.sup, y.sup); emptyresult = isempty (x) | isempty (y); l(emptyresult) = inf; u(emptyresult) = -inf; endfunction
octave== VERSOFT ==The [http:11> infsup ("17//uivtx.7") + 1 ans = [18cs.699999999999999, 18cas.700000000000003cz/~rohn/matlab/ VERSOFT] octave:12> ans + "[0, 2]" ans = [18software package (by Jiří Rohn) has been released under a free software license (Expat license) and algorithms may be migrated into the interval package.699999999999999, 20.700000000000003]
|-
| com<br/>(common)plusminusoneset| | ✓| ✓style="color:green"| '''''x''''' is a bounded, nonempty subset of Dom(''f''); ''f'' is continuous at each point of '''''x'''''; and the computed interval ''f''('''''x''''') is boundedfree
|-
| dac<br/>(defined &amp; continuous)verabsvaleqn|| ✓style="color:green"| free| '''''x''''' is a nonempty subset of Dom(''f''); and the restriction of ''f'' to '''''x''''' is continuousbe migrated
|-
| def<br/>(defined)verabsvaleqnall|style="color:green"|free| | '''''x''''' is a nonempty subset of Dom(''f'')depends on <code>verabsvaleqn</code>, see also [http://uivtx.cs.cas.cz/~rohn/publist/absvaleqnall.pdf], to be migrated
|-
| trv<br/>(trivial)verbasintnpprob|style="color:red"|trapped|| always true (so gives no information)depends on <code style="color:red">verregsing</code>
|-
| ill<br/>(ill-formed)
|
|
|
| Not an interval, at least one interval constructor failed during the course of computation
|}
In the following example, all decoration information is lost when the interval is possibly divided by zero, i. e., the overall function is not guaranteed to be defined for all possible inputs.

octave:1> infsupdec(3, 4)
ans = [3, 4]_com
octave:2> ans + 12
ans = [15, 16]_com
octave:3> ans / "[0, 2]"
ans = [7.5, Inf]_trv

=== Arithmetic operations ===

=== Reverse arithmetic operations ===

=== Numerical operations ===

=== Boolean operations ===
[[Category:Octave-Forge]]
1,180

edits