Maven module :un.api : api-math :
Class : un.impl.number.Interval
Extends/Implements : un.api.number.Arithmetic
Subclasses : -

Interval arithmetic.

A method developed by mathematicians since the 1950s and 1960s as an approach
to putting bounds on rounding errors and measurement errors in mathematical
computation and thus developing numerical methods that yield reliable results.
( https://en.wikipedia.org/wiki/Interval_arithmetic )

@author Bertrand COTE


Variables : -
Functions : Interval, Interval, Interval, toString, getMin, getMax, zeroNotElementOfThis, zero, isZero, one, isOne, width, rad, mid, mig, add, add, subtract, subtract, mult, mult, divide, divide, sq, sqrt, pow, isSubsetOf, setEpsilon, resetEpsilon




Constructor for the [0., 0.] interval.
public void Interval ()


Constructor for the [val, val] interval.
param  val min and max values
public void Interval (double val)


Main constructor.
param  min one bound of the interval
param  max the other bound of the interval
public void Interval (double min, double max)


String representation of the interval.
return  the string representation of the interval.
public String toString ()


return  the interval's minimum bound
public double getMin ()


return  the interval's maximum bound
public double getMax ()


Check if zero is not element of the interval.
return  true if zero not in the interval
public boolean zeroNotElementOfThis ()

public Interval zero ()

public boolean isZero ()

public Interval one ()

public boolean isOne ()


Compute the width of the interval.
return  the width of the interval
public double width ()


Compute the radius of the interval. (distance between de middle and bounds)
return  the radius of the interval
public double rad ()


Compute the middle of the interval.
return  the middle of the interval.
public double mid ()


Compute the mignitude.
(The smallest absolute value of the elements of the interval. There is no
typo, this is the correct spelling: M-I-G-N-I-T-U-D-E)

@return the smallest absolute value of the elements of the interval
public double mig ()


Addition.
[a, b] + [c, d] = [a + c, b + d]
The addition and multiplication operations are commutative,
associative and sub-distributive: the set X ( Y + Z ) is a subset
of XY + XZ.
@param other addition
@return added interval
public Interval add (Arithmetic other)


Addition with simple real.
param  d addition
return  added interval
public Interval add (double d)


Subtraction.
[a, b] − [c, d] = [a − d, b − c]
@param other subtract
@return subtracted interval
public Interval subtract (Arithmetic other)


Subtraction with simple real.
param  d subtract
return  subtracted interval
public Interval subtract (double d)


Multiplication.
[a, b] × [c, d] = [min (a × c, a × d, b × c, b × d), max (a × c, a × d, b × c, b × d)]
The addition and multiplication operations are commutative,
associative and sub-distributive: the set X ( Y + Z ) is a subset
of XY + XZ.
@param other multiplier
@return multiplied interval
public Interval mult (Arithmetic other)


Multiplication by simple real.
param  d multiplier
return  multiplied interval
public Interval mult (double d)


Division.
[a, b] ÷ [c, d] = [min (a ÷ c, a ÷ d, b ÷ c, b ÷ d), max (a ÷ c, a ÷ d, b ÷ c, b ÷ d)]
when 0 is not in [c, d].
@param other division
@return divided interval
public Interval divide (Arithmetic other)


Division by simple real.
param  d division
return  divided interval
public Interval divide (double d)


Square function
WARNING: In intervals arithmetic: this.sq() != this.mult(this)
return  squared interval
public Interval sq ()


Square root function
return  square interval
public Interval sqrt ()


Compute this^n with n integer.
param  n power
return  pow
public Interval pow (int n)


Check if the interval is a subset of other.
param  other compare interval
return  true if this interval is a subset
public boolean isSubsetOf (Interval other)


Sets the margin of error on isZero and isOne methods
param  epsilon tolerance
public void setEpsilon (double epsilon)

public void resetEpsilon ()