| Int4Sci_Tutorial Int4Sci Tutorial
 Introduction
    Int4Sci is an interval analysis interface for Scilab based on the C/C++
      BIAS/PROFIL low level interval library .
     A basic version based on Boost C++ library is also available.
     This interface creates an high level library for Scilab by loading and
     building a low level library. For further explanations about installation see the
      Install file. 
      ==========A IntervalA-1 Creating interval elements
     An interval is created with the function interval, whose shortcut is #. For example : 
    --> t = interval(0,2)
    --> t = #(0,2)
     creates the range [0,2] and affect it to t. The width of an interval [xi,xs]
    is defined as xs - xi, its radius is (xs - xi)/2, while the mid-point of the interval is 
    (xs + xi)/2. Hence the width of t is 2, its radius is 1 while its 
    mid-point is 1. Interval matrix may also be created by specifying a real matrix for the
    lower bound and another matrix for the upper bound. For example :  
--> A = [1,2;3,4] 
--> B = [2,3;4,5] 
--> C = interval(A,B) //or --> C = #(A,B))
    will create the interval matrix [1,2],[2,3] [3,4],[4,5] printed on your Scilab window as : 
 C  =
 
 
!|1,2|  |2,3|  !
!              !
!|3,4|  |4,5|  !
 
 The following example shows the different possibilities for interval
    element creation : 
--> interval(0,1)
 ans  =
 
 
 |0,1|   
    
--> C = interval(A)
 C  =
 
 
!|1,1|  |2,2|  !
!              !
!|3,3|  |4,4|  !
--> C = interval(A,7)
 C  =
 
 
!|1,7|  |2,7|  !
!              !
!|3,7|  |4,7|  !
 The notation interval(x)
       is equivalent to interval(x,x).
      Such an interval [x,x] is called a
      degenerate interval. An interval can also be created
      with the function mradius which takes
      as input the mid-point value and the radius of the interval. 
      For example  if x and r are real the
      call mradius(x,r) will create the interval [x-r,x+r]. We may also use mradius with an interval as mid-point. If x=[xi,xs], then
      the call mradius(x,r) will create the interval [xi-r,xs+r].
       The function mradius is extended for mid-point matrix/vectors with  real
      or matrix radius. For example:  -->A = [1,2;3,4]  -->B = [2,3;4,5]  -->S = mradius(A,2)  -->T = mradius(A,B)  will create the interval matrices : 
 S  =Int4Sci_Tutorial.htm
 
 
!|-1,3|  |0,4|  !
!               !
!|1,5|   |2,6|  !
 T  =
 
 
!|-1,3|  |-1,5|  !
!                !
!|-1,7|  |-1,9|  !
       ----------------------------A-2 Interval characteristics
     An interval t=[x,y] has basic characteristics that can be retrieved with
    Int4Sci functions : 
  Functions inf and sup for getting he lower and upper bound
  x and y of the interval t .Function mid for getting the mid-point of t
    defined as (y+x)/2.Function rad for getting the radius of t  
  defined as |y-x|/2.Function width for getting the interval width defined as twice
    the radius.Function mag for getting the interval magnitude defined as the maximum of the absolute value of its
    bounds.Function mig for getting the interval mignitude defined as the minimum of the
    absolute values of all reals included in the interval. All those definitions are extended here to interval
      matrix or vector : 
--> C = interval(A,B)
 C  =
 
 
!|-1,2|  |-2,3|  !
!                !
!|3,4|   |4,5|   !
 
--> inf(C)
 ans  =
 
  - 1.  - 2.  
    3.    4.  
 
--> sup(C)
 ans  =
 
    2.    3.  
    4.    5.  
 
--> mid(C)
 ans  =
 
    0.5    0.5  
    3.5    4.5  
 
--> rad(C)
 ans  =
 
    1.5    2.5  
    0.5    0.5  
 
--> width(C)
 ans  =
 
    3.    5.  
    1.    1.  
 
--> mag(C)
 ans  =
 
    2.    3.  
    4.    5.  
 
--> mig(C)
 ans  =
 
    0.    0.  
    3.    4. 
 ----------------------------A-3 Operation on intervals
    Interval arithmetic theory defines the intersection of two intervals
    as the interval containing all the reals that belong to both intervals. The function t=intersection(x,y) allows using such functionality for
      interval matrix or vector by returning t, an interval vector or matrix containing the 
      intersection of each x and y components. For example :
     
-->A = [1,2;-4,-5];
 
-->B = [2,4;-2,-3];
 
-->C = interval(A,B)
 C  =
 
 
!|1,2|    |2,4|    !
!                  !
!|-4,-2|  |-5,-3|  !
 
-->D=  [0,3;-3,-4];
 
-->E = interval(D,B)
 E  =
 
 
!|0,2|    |3,4|    !
!                  !
!|-3,-2|  |-4,-3|  !
 
-->F = intersection(C,E)
 F  =
 
 
!|1,2|    |3,4|    !
!                  !
!|-3,-2|  |-4,-3|  !
 It may occur that the intersection of two intervals is the empty set
represented by |Nan,Nan|.
To test if an interval is the empty set you may use the isempty  function.
  The inclusion of an interval or a real into another interval is checked
with the function in :
 
-->in(C,F)
 ans  =
 
  T F  
  F F  
 
 Finally, hull and dothull furnish respectively hull and element-wise hull calculations : 
--> a = #([1,2,3;4,5,6],[3,4,5;6,7,8]);
--> b = #([2,-3,4;-%inf,6,6],11);
--> dothull(a,b)
 ans  =
 
 
!|1,11|     |-3,11|  |3,11|  !
!                            !
!|-Inf,11|  |5,11|   |6,11|  !
--> hull(a,b)
 ans  =
 
 
 |-Inf,11|   
 ----------------------------A-4 Manipulation of interval structures
    Int4Sci offers tools that allow the manipulation of interval
    structures. These tools use a syntax close to Scilab functions. Their name
    and role for any mathematical structure are coherent with other Scilab functions For further information, the help for a Scilab function is obtained with : 
--> help function-name;
 And for the functions of Int4Sci, the help is obtained with : 
--> help interval;
--> help I4S_Basic_Func;
--> help I4S_Functions;
 ----------------------------A-4-1 Scilab-like functions
     The following functions of Scilab keep their classical uses and definitions :
     ': returns the transpose
      of an interval matrix or vector (help quote;) diag: returns the diagonal of an
      interval matrix or creates a diagonal interval matrix based on an
      interval vector sum: returns the sum of the components
      of an interval matrix or vector (see the section Interval arithmetic
      for addition of intervals) Insertion and extraction for interval matrices or
      vectors: intervals can be inserted/extracted into/from
      a real/interval matrix or vector ( help insertion; help extraction;) matrix: resize an interval vector or matrix size: for an interval matrix/vector,size returns the number of its rows and columns. length: for an interval matrix/vector, length returns the total number of elements it contains. Examples
    
    
-->A = [1,2,3;-3,-4,-5];
 
-->B = [2,3,4;-2,-3,-4];
 
-->C = interval(A,B)
 C  =
 
 
!|1,2|    |2,3|    |3,4|    !
!                           !
!|-3,-2|  |-4,-3|  |-5,-4|  !
 
-->D = C' //transpose
 D  =
 
 
!|1,2|  |-3,-2|  !
!                !
!|2,3|  |-4,-3|  !
!                !
!|3,4|  |-5,-4|  !
 
-->matrix(D,[2,3])//returns C
 ans  =
 
 
!|1,2|  |3,4|    |-4,-3|  !
!                         !
!|2,3|  |-3,-2|  |-5,-4|  !
 
-->E = diag(C)
 E  =
 
 
!|1,2|    !
!         !
!|-4,-3|  !
 
-->diag(E)
 ans  =
 
 
!|1,2|  |0,0|    !
!                !
!|0,0|  |-4,-3|  !
 
-->C
 C  =
 
 
!|1,2|    |2,3|    |3,4|    !
!                           !
!|-3,-2|  |-4,-3|  |-5,-4|  !
 
-->sum(C)
 ans  =
 
 
 |-6,0|   
 
-->sum(C,'r')
 ans  =
 
 
!|-2,0|  |-2,0|  |-2,0|  !
 
-->C(1,1) = #(-20,20)
 C  =
 
 
!|-20,20|  |2,3|    |3,4|    !
!                            !
!|-3,-2|   |-4,-3|  |-5,-4|  !
 
-->C(1:2,2)
 ans  =
 
 
!|2,3|    !
!         !
!|-4,-3|  !
 
-->A
 A  =
 
    1.    2.    3.  
  - 3.  - 4.  - 5.  
 
-->A(1:2,2) = #([-10;-30],[10;30])
 A  =
 
 
!|1,1|    |-10,10|  |3,3|    !
!                            !
!|-3,-3|  |-30,30|  |-5,-5|  !
-->size(A)
 ans  =
 
    2.    3.  
 
-->size(A,1)
 ans  =
 
    2.  
 
-->length(A)
 ans  =
 
    6. 
     ----------------------------A-4-2 Other functions
    
      norm: this function is an overload for intervals of the
      Scilab norm function. Various norms may be
       defined for a real matrix t and have been extended to interval matrix. Int4Sci provides the following norms : 
        infinity norm: the real defined as the maximum row sum, where
	the row sum is the
	 sum of the absolute values of the elements in a given rowThe 1_norm: the real defined as the maximum column sum, where
	the column sum is
           the sum of the absolute values of the elements in a given column. See the section Elementary Functions for the definition of the
      absolute value of interval.  The infinity norm exists too for an interval vector t, and is
      defined as the largest
       absolute value of the components of t. The 1_norm for interval
       vector is based on the  p_norm defined as : 
        y=sum(t(i)^p))^(1/p)( see Arithmetic operations below
          for power of intervals). The default norm returned 
          by norm(t) is the 2_norm (i.e. p=2). Interval order: The use
      of >, >=, <, <=, ==, <> is possible in Int4Sci. These operators
      will return a Boolean value as for reals. An interval x is 
      greater than an other one y if the
      lower bound of x is greater than the upper bound of y. This definition is
      extended for >=, < and <=.  == and <> will compare respectively the equality/inequality
      of the bounds of two different intervals. Examples
    
     
-->A = [1,2,3;-3,-4,-5];
 
-->B = [2,3,4;-2,-3,-4];
 
-->C = interval(A,B)
 C  =
 
 
!|1,2|    |2,3|    |3,4|    !
!                           !
!|-3,-2|  |-4,-3|  |-5,-4|  !
 
-->E = norm(C)
 E  =
 
    12.  
 
-->E = norm(C(1,:),5)
 E  =
 
 
 |3.0773849,4.1949021|   
 
-->C
 C  =
 
 
!|1,2|    |2,3|    |3,4|    !
!                           !
!|-3,-2|  |-4,-3|  |-5,-4|  !
 
-->C(1,:) < C(2,:)
 ans  =
 
  F F F  
 
-->C(1,:) > C(2,:)
 ans  =
 
  T T T  
 
-->C(1,:) == C(2,:)
 ans  =
 
  F F F  
 
-->C(1,:) <> C(2,:)
 ans  =
 
  T T T  
      ----------------------------A-4-3 Adding your own function
    You can add your own functions in Int4Sci. For that : 1-  Write your own function in the file intervaloperator.sci located 
      in the directory HighLevel. 2- Close any Scilab windows in which you have used Int4Sci. 3- Open a Scilab window and type exec loader.sce;. For further explanation about function writing or overloading in Scilab: help function; help functions; help overloading; FOR FURTHER INFORMATION ABOUT THESE FUNCTIONS : help I4S_Functions; ==========B Interval arithmeticB-1 Elementary operator
    Classical interval arithmetic is implemented
      in this interface. It is possible to add,
      subtract, multiply or divide two intervals. Int4Sci implements the
      extension to interval matrices or vectors of the the classical Scilab operator: +, -, *( matrix multiplication),
      .*( element-wise multiplication), .*.( Kronecker multiplication ), / (multiplication with the
       inverse of a matrix),
      ./ (element-wise division), .\ (element-wise left division) and \. 
      For interval arithmetic the \ operator is the inverse of / (i.e. B\A is
      equivalent to A/B). Note that this symbol is also used for linear system solving (see the section
      Solving Interval Linear System). These operations can usually be applied to: 
         interval vectors or matrices of compatible size
	 interval matrix or vector and an interval (in which case the operation
	 is performed between all elements of the matrix/vector and the interval)
	 interval and real vector/matrix
	  Exceptions are for the Kronecker multiplication (defined whatever is the
	vector/matrix size) and for the "divisions" ( / and \ are only available for operations between
	an interval matrix/vector and a simple interval).
	 Note that a division by
      an interval including 0
      returns the interval ]-inf,+inf[ (i.e. the set of real numbers printed as |-Inf,Inf| on 
      Scilab ). In theory, such an operation should return the union of two intervals. For example [1,2]/[-1,1] is defined 
      as the set of real numbers x such that it exists y in [1,2] and z in [-1,1] such 
      that x = y/z and consequently this set is ]-inf,-2] union [1,+inf[. 
      Hence the result provided by / is conservative and the exact result for the division of two single intervals may be obtained 
      with the function extdiv whose result is a list of two interval. Note also that the division by the degenerate interval [0,0] will return
      the interval [Nan,Nan]. All arithmetic operations are performed through a call to an appropriate
      procedure of the BIAS/PROFIL interval library.  Examples
    
-->#(0,1) + #(-1,1)
 ans  =
 
 
 |-1,2|   
 
-->#(-1,1)- #(-1,1)
 ans  =
 
 
 |-2,2|   
 
-->#(0,1)* #(-1,1)
 ans  =
 
 
 |-1,1|   
 
-->#(1,2) / #(3,4)
 ans  =
 
 
 |0.25,0.6666667|   
 
 
-->extdiv(#(3,4),#(-1,1))
 ans  =
 
 
       ans(1)
 
 
 |-Inf,-3|   
 
       ans(2)
 
 
 |3,Inf|   
 
 
-->A = [1,2,3;-3,-4,-5];
 
-->B = [2,3,4;2,3,4];
-->C = interval(A,B)
 C  =
 
 
!|1,2|   |2,3|   |3,4|   !
!                        !
!|-3,2|  |-4,3|  |-5,4|  !
 
 
-->D = C + 3
 D  =
 
 
!|4,5|  |5,6|   |6,7|   !
!                       !
!|0,5|  |-1,6|  |-2,7|  !
 
-->E = C + #(0,1)
 E  =
 
 
!|1,3|   |2,4|   |3,5|   !
!                        !
!|-3,3|  |-4,4|  |-5,5|  !
 
-->F = D + E
 F  =
 
 
!|5,8|   |7,10|   |9,12|   !
!                          !
!|-3,8|  |-5,10|  |-7,12|  !
 
-->F = D - E
 F  =
 
 
!|1,4|   |1,4|    |1,4|    !
!                          !
!|-3,8|  |-5,10|  |-7,12|  !
-->F.*C // Element wise multiplication
 ans  =
 
 
!|1,8|     |2,12|    |3,16|    !
!                              !
!|-24,16|  |-40,30|  |-60,48|  !
-->F*C' //matrix-matrix multiplication
 ans  =
 
 
!|6,36|    |-48,36|   !
!                     !
!|-49,94|  |-124,94|  !
Power ^ is also defined for interval and matrix
      while .^ denotes element-wise power.
      The power should be either an integer or a real between -1 and 1.
      For such reals, a root calculation is performed element-wise (with .^) only for intervals containing a positive part. The square root function sqrt exists too. Examples
    
      
-->A = [1,2;-3,-4];
 
-->B = [2,3;2,3];
 
-->C = interval(A,B)
 C  =
 
 
!|1,2|   |2,3|   !
!                !
!|-3,2|  |-4,3|  !
 
 
-->C^3
 ans  =
 
 
!|-61,50|  |-84,75|    !
!                      !
!|-96,95|  |-133,132|  !
 
-->C.^3
 ans  =
 
 
!|1,8|     |8,27|    !
!                    !
!|-27,18|  |-64,48|  !
 
-->C.^(1./3)
 ans  =
 
 
!|1,1.259921|  |1.259921,1.4422496|  !
!                                    !
!|0,1.259921|  |0,1.4422496|         !
 
 
-->sqrt(C)
 ans  =
 
 
!|1,1.4142136|  |1.4142136,1.7320508|  !
!                                      !
!|0,1.4142136|  |0,1.7320508|          !
 
-->n = [1,2./3;3,4]
 n  =
 
    1.    0.6666667  
    3.    4.         
 
-->C.^n
 ans  =
 
 
!|1,2|     |1.4142136,1.7320508|  !
!                                 !
!|-27,18|  |0,256|                !
FOR FURTHER INFORMATION ABOUT THESE OPERATIONS : help I4S_Arith_Op; ----------------------------B-2 Elementary Functions
    
 Interval arithmetic in Int4Sci allows also one to use basic unary functions whose list is
presented below. These functions may also be used for interval matrix and
vector. List of Scilab arithmetic functions that may be applied to interval :
    
-->A = [1,2;-3,-4];
 
-->B = [2,3;2,3];
 
-->C = interval(A,B)
 C  =
 
 
!|1,2|   |2,3|   !
!                !
!|-3,2|  |-4,3|  !
 
-->abs(C) //absolute value
 ans  =
 
 
!|1,2|  |2,3|  !
!              !
!|0,3|  |0,4|  !
 
-->exp(C) //exponential
 ans  =
 
 
!|2.7182818,7.3890561|  |7.3890561,20.085537|  !
!                                              !
!|0.0497871,7.3890561|  |0.0183156,20.085537|  !
 
-->log(C) //natural logarithm
 ans  =
 
 
!|0,0.6931472|     |0.6931472,1.0986123|  !
!                                         !
!|-Inf,0.6931472|  |-Inf,1.0986123|       !
 
-->log10(C) // logarithm with base 10
 ans  =
 
 
!|0,0.30103|     |0.30103,0.4771213|  !
!                                     !
!|-Inf,0.30103|  |-Inf,0.4771213|     !
 
-->A = [%pi/6;-%pi/3];
 
-->B = [%pi/3;-%pi/6];
-->C = interval(A,B)
 C  =
 
 
!|0.5235988,1.0471976|    !
!                         !
!|-1.0471976,-0.5235988|  !
 
-->sin(C)
 ans  =
 
 
!|0.5,0.8660254|    !
!                   !
!|-0.8660254,-0.5|  !
 
-->cos(C)
 ans  =
 
 
!|0.5,0.8660254|  !
!                 !
!|0.5,0.8660254|  !
 
-->tan(C)
 ans  =
 
 
!|0.5773503,1.7320508|    !
!                         !
!|-1.7320508,-0.5773503|  !
 
-->cotg(C)
 ans  =
 
 
!|0.5773503,1.7320508|    !
!                         !
!|-1.7320508,-0.5773503|  !
 
-->A = [0.2;0.5];
 
-->B = [1;0.9];
 
-->C = interval(A,B)
 C  =
 
 
!|0.2,1|    !
!           !
!|0.5,0.9|  !
 
-->asin(C)
 ans  =
 
 
!|0.2013579,1.5707963|  !
!                       !
!|0.5235988,1.1197695|  !
-->acos(C)
 ans  =
 
 
!|0,1.3694384|          !
!                       !
!|0.4510268,1.0471976|  !
 
-->atan(C)
 ans  =
 
 
!|0.1973956,0.7853982|  !
!                       !
!|0.4636476,0.7328151|  !
 
-->A = [2;3];
 
-->B = [4;6];
 
-->C = interval(A,B)
 C  =
 
 
!|2,4|  !
!       !
!|3,6|  !
 
-->sinh(C)
 ans  =
 
 
!|3.6268604,27.289917|  !
!                       !
!|10.017875,201.71316|  !
 
-->cosh(C)
 ans  =
 
 
!|3.7036859,27.366743|  !
!                       !
!|10.044008,201.73929|  !
 
-->tanh(C)
 ans  =
 
 
!|0.1325280,7.3683131|  !
!                       !
!|0.0496575,20.082935|  !
 
-->coth(C)
 ans  =
 
 
!|0.1357163,7.5455737|  !
!                       !
!|0.0497935,20.137933|  !
-->asinh(C)
 ans  =
 
 
!|1.4436355,2.0947125|  !
!                       !
!|1.8184465,2.4917799|  !
 
-->acosh(C)
 ans  =
 
 
!|1.3169579,2.0634371|  !
!                       !
!|1.7627472,2.4778887|  !
 
-->atanh(1/C)
 ans  =
 
 
!|0.2554128,0.5493061|  !
!                       !
!|0.1682361,0.3465736|  !
  There may be restrictions for some of these functions in terms of
definition domain: for example
the function asin should be called with an interval included in [-1,1]. 
If not, a fatal error is returned. Note that the result returned by BIAS are certified with respect to
numerical round-off errors.
Hence the result of Int4Sci may be rounded. For example log(#(1,2)) is
computed as [-0.49 10-323,0.693..] (depending on your Scilab version and your computer)
although it should be [0,0.693..].
 FOR FURTHER INFORMATION ABOUT THESE FUNCTIONS : help I4S_Arith_Func; ----------------------------B-3 Natural Evaluation
    
     An interval evaluation of a single variable function f(x) over a range X
    for x is an interval Y=[yi,ys] such that for all 
    x in X we have :   yi <= f(x) <= ys   There are many ways to calculate the interval evaluation of a function.
     The most simple one is to use interval arithmetic by substituting all mathematical operators in f
     by their interval equivalent. Consider for example the function f(x) = x^2-2x +1 that has to
     be interval evaluated over the range [0,2].  On Scilab : 
-->function y=f(x)
-->y = x^2-2*x+1
-->endfunction
-->//Evaluation of f(x) = x^2-2x-1 for x in |0,2|
 
-->// Natural extension of f to intervals
 
-->X=#(0,2)
 X  =
 
 
 |0,2|   
 
-->f(X)
 ans  =
 
 
 |-3,5| 
      We may consider now another formulation of f, which may be written as f1(x) = (x-1)^2.
      
-->function y=f1(x)                              
-->y = (x-1)^2                                   
-->endfunction
 
-->//Evaluation of f(x) = x^2-2x-1 for x in |0,2|
-->// Same extension written on an other form : f(x) = f1(x) = (x-1)^2
 
-->X=#(0,2)
 X  =
 
 
 |0,2|   
 
-->f1(X)
 ans  =
 
 
 |0,1|  
 It may be seen that two different values are returned. This simple example
shows the
complexity of a function evaluation. It is due to interval arithmetic rules that
may lead to
an overestimation of the lower and upper bounds. Note that there is a
single occurrence
of the variable x in (x-1)^2 : in that case the natural evaluation [yi,ys]
is optimal i.e.
there are x1, x2 in X such that 
f(x1) = yi, f(x2) = ys while yi <= f(x) <= ys
holds for all
x in X. 
 Natural evaluation can evidently be extended to multi-variate functions. ==========C Solving with interval analysisC-1 Solving interval linear system
     Int4Sci allows the solving of interval linear systems AX = b where A is an 
    interval square matrix of dimensions n x n and b an n-dimensional interval vector.
     A linear interval system represents a set of real linear systems and solving such system
    means finding a domain, called the enclosure of the system, that includes the solutions
    of all systems in the set.
      Such system may be solved if A is not singular 
    (meaning there is no real matrix a included in A such as det(a) = 0)
    but the current version of Int4Sci does not offer the possibility of checking the regularity of an interval matrix. The current version of Int4Sci is not able to deal with system involving infinite
    element(s).  By default the usual Scilab symbol for linear resolution \ is used in Int4Sci
    and the call X = A\b involves a call to the BIAS/PROFIL interval linear
    system solver ILSS.
      However other algorithms for solving interval linear system are available by using the
    I4Slinearsolve function. This function allows choosing different methods that are defined
    in [Hansen03], [Jaulin01] and [Neumaier90] and are implemented in the PROFIL library. The following methods are available: 
     PROFIL ILSS method called by I4Slinearsolve(A,b) (default execution equivalent to A\b).  Gauss elimination method called by I4Slinearsolve(A,b,"GE").  Gauss elimination method with preconditioning called by I4Slinearsolve(A,b,"PGE").  Bareiss method called by I4Slinearsolve(A,b,"B"). Bareiss method with preconditioning called by I4Slinearsolve(A,b,"PB"). Hansen Bliek method called by I4Slinearsolve(A,b,"HB").  Hansen Bliek method with preconditioning called by I4Slinearsolve(A,b,"PHB").   Some methods, called contractor, require an initial estimation of the solution, here
    called y: 
     Krawczyck contractor method called by I4Slinearsolve(A,b,y,"K"). Krawczyck contractor method with preconditioning called by I4Slinearsolve(A,b,y,"PK"). Faster Krawczyck contractor method called by I4Slinearsolve(A,b,y,"KGS"). Faster Krawczyck contractor method with preconditioning called by I4Slinearsolve(A,b,y,"PKGS"). Gauss Seidel contractor method called by I4Slinearsolve(A,b,y,"GS").  Gauss Seidel contractor method with preconditioning called by I4Slinearsolve(A,b,y,"PGS").  If any other string than the twelve shown above is used, or if any contractor method is called without initial estimation, 
    then an error will occur and will stop the calculation.  Note that the preconditioning usually improves the efficiency in terms of size of the enclosure
     and computation time. Refer to the I4Slinearsolve help for more details about preconditioning.   In most cases these methods will not return the same enclosure for a given interval
	linear system. The contractor methods may, for example, be used to refine a solution
	found with Gauss elimination, Bareiss or Hansen Bliek method.  Examples
    
-->Ai = [2,0;1,2];
 
-->As = [3,1;2,3];
 
-->A = interval(Ai,As)
 A  =
 
 
!|2,3|  |0,1|  !
!              !
!|1,2|  |2,3|  !
 
-->bi = [0;60];
 
-->bs = [120;240];
 
-->b = interval(bi,bs)
 b  =
 
 
!|0,120|   !
!          !
!|60,240|  !
 
-->A\b // default execution
 ans  =
 
 
!|-141.78491,169.05764|  !
!                        !
!|-165.41018,269.04655|  !
 
-->x = I4Slinearsolve(A,b,"GE")
 x  =
 
 
!|-120,90|  !
!           !
!|-60,240|  !
 
-->I4Slinearsolve(A,b,x,"K") // try to see if x is the sharpest solution
 
  Krawczyck's test failure   
 ans  =
 
 
!|-120,90|  !
!           !
!|-60,240|  !
 
-->// it doesn't work because A is not adapted for this method
 
-->I4Slinearsolve(A,b,x,"GS")
 
  no more intersection during iterative Gauss Seidel algorithm   
 ans  =
 
 
!|-120,90|  !
!           !
!|-60,240|  !
 
-->// x is maybe included in an enclosure of the solution
 
-->// Let's try with preconditioning methods
 
-->x = I4Slinearsolve(A,b,"PGE")
 x  =
 
 
!|-130.22727,167.72727|  !
!                        !
!|-60,267.27273|         !
 
 
-->A = #([4,-1,1.5;-0.5,-7,1;-1.5,-0.7,2],[5,1,2.5;.5,-5,2;-.5,-.5,3])
 A  =
 
 
!|4,5|        |-1,1|       |1.5,2.5|  !
!                                     !
!|-0.5,0.5|   |-7,-5|      |1,2|      !
!                                     !
!|-1.5,-0.5|  |-0.7,-0.5|  |2,3|      !
 
-->b = #([3;0;3],[4;2;4])
 b  =
 
 
!|3,4|  !
!       !
!|0,2|  !
!       !
!|3,4|  !
 
-->A\b
 ans  =
 
 
!|-1.2138764,1.4405166|  !
!                        !
!|-0.9653743,1.3795559|  !
!                        !
!|-0.0567019,3.0467616|  !
-->I4Slinearsolve(A,b,"GE")
 ans  =
 
 
!|-1.8192789,1.1687204|  !
!                        !
!|-0.4140698,1.7252296|  !
!                        !
!|0.7002321,3.4207543|   !
 
-->I4Slinearsolve(A,b,"PB")
 ans  =
 
 
!|-3.4419653,3.7186643|  !
!                        !
!|-3.3077733,4.0960635|  !
!                        !
!|0.2051336,10.214535|   !
 FOR FURTHER INFORMATION ABOUT THESE FUNCTIONS : help I4Slinearsolve; ==========D Designing your own interval analysis solver
    
    One purpose of Int4Sci is also to allow you to prototype your own solving algorithm.
    Int4Sci offers some basic building blocks to design your software.
 D-1 Bisection
     Bisection is a key element of most interval analysis algorithm. Int4Sci hence offers
    a general purpose bisection tool with the operator :. t:k bisects an interval t = [xi,xs] in k ranges
    [xi+(j-1)(xs-xi)/k,xi+j(xs-xi)/k] for j in [1,k].
    The result is stored in a k element list.  If t is an interval matrix/vector, t:k bisects the t component
    with the largest width. Any t component can be cut by adding its Scilab line matrix index 
    g : t:k:g .
     Finally, k can be a real in ]0,1]. In this case t:k creates the 
    two ranges [xi,xi+k(xs-xi)] and [xi+k(xs-xi),xs] stored in a two element list.
     Examples
    
-->#(1,3):2
 ans  =
 
 
       ans(1)
 
 
 |1,2|   
 
       ans(2)
 
 
 |2,3|   
 
-->#(1,3):0.9
 ans  =
 
 
       ans(1)
 
 
 |1,2.8|   
 
       ans(2)
 
 
 |2.8,3|   
-->#(1,3):3         
 ans  =
 
 
       ans(1)
 
 
 |1,1.6666667|   
 
       ans(2)
 
 
 |1.6666667,2.3333333|   
 
       ans(3)
 
 
 |2.3333333,3|   
 
-->A = [-1,-2;3,4];
 
-->B = [2,3;4,5];
 
-->C = interval(A,B)
 C  =
 
 
!|-1,2|  |-2,3|  !
!                !
!|3,4|   |4,5|   !
 
-->C:2
 ans  =
 
 
       ans(1)
 
 
!|-1,2|  |-2,0.5|  !
!                  !
!|3,4|   |4,5|     !
 
       ans(2)
 
 
!|-1,2|  |0.5,3|  !
!                 !
!|3,4|   |4,5|    !
 
-->C:2:3
 ans  =
 
 
       ans(1)
 
 
!|-1,2|  |-2,0.5|  !
!                  !
!|3,4|   |4,5|     !
 
       ans(2)
 
 
!|-1,2|  |0.5,3|  !
!                 !
!|3,4|   |4,5|    !
 
FOR FURTHER INFORMATION ABOUT THESE FUNCTIONS : help I4S_Basic_Tools; ==========Authors
    Raphael PEREIRA, David DANEY, Jean Pierre MERLET
      COPRIN Project INRIA Sophia Antipolis Contacts : int4sci@lists-sop.inria.fr ==========Bibliography[Hansen03] E. Hansen, and G. W. Walster, Global Optimization Using Interval Analysis, Marcel Dekker, 2003. [Jaulin01] L. Jaulin, M. Kieffer, O. Didrit, and E. Walter, Applied Interval Analysis with Examples in Parameter and 
State Estimation, Robust Control and Robotics, Springer-Verlag, 2001. [Rump99] S. M. Rump, Fast And Parallel Interval Arithmetic, Springer Netherlands, 1999. [Kearfott96] R. Baker Kearfott, Rigorous Global Search : Continuous Problems, Kluwer Academic Publishers, 1996. [Neumaier90] A. Neumaier, Interval Methods For Systems Of Equations, Cambridge Univ. Press, 1990. [Moore66] R. E. Moore, Interval Analysis, Prentice Hall, 1966. |