<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>int3d</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 1993</DATE>
  <SHORT_DESCRIPTION name="int3d"> definite 3D integral by quadrature and cubature method</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>[result,err]=int3d(X,Y,Z,f [,nf[,params]])  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>X</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a 4 by <VERB>NUMTET</VERB> array containing the abscissae of the vertices   of the <VERB>NUMTET</VERB> tetrahedrons.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>Y</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a 4 by <VERB>NUMTET</VERB> array containing the ordinates of the vertices   of the <VERB>NUMTET</VERB> tetrahedrons.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>Z</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a 4 by <VERB>NUMTET</VERB> array containing the third coordinates of the vertices   of the <VERB>NUMTET</VERB> tetrahedrons.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>f</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: external (function or list or string) defining the integrand <VERB>f(xyz,nf)</VERB>, where <VERB>xyz</VERB> is the vector of a point coordinates and nf the number functions</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>nf</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: the number of function to integate (default is 1)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>params</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: real vector <VERB>[minpts, maxpts, epsabs, epsrel]</VERB>. default value is <VERB>[0, 1000, 0.0, 1.d-5]</VERB>.</SP>
          <PARAM_INDENT>
            <PARAM_ITEM>
              <PARAM_NAME>epsabs</PARAM_NAME>
              <PARAM_DESCRIPTION>
                <SP>: Desired bound on the absolute error.</SP>
              </PARAM_DESCRIPTION>
            </PARAM_ITEM>
            <PARAM_ITEM>
              <PARAM_NAME>epsrel</PARAM_NAME>
              <PARAM_DESCRIPTION>
                <SP>: Desired bound on the relative error.</SP>
              </PARAM_DESCRIPTION>
            </PARAM_ITEM>
            <PARAM_ITEM>
              <PARAM_NAME>minpts</PARAM_NAME>
              <PARAM_DESCRIPTION>
                <SP>: Minimum number of function evaluations.</SP>
              </PARAM_DESCRIPTION>
            </PARAM_ITEM>
            <PARAM_ITEM>
              <PARAM_NAME>maxpts</PARAM_NAME>
              <PARAM_DESCRIPTION>
                <SP>: Maximum number of function evaluations.  The number of function evaluations over each subregion is 43</SP>
              </PARAM_DESCRIPTION>
            </PARAM_ITEM>
          </PARAM_INDENT>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>result</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: the integral value,or vector of the integral values.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>err</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: Estimates of absolute errors.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>
    The function calculates an approximation to a given
    vector of definite integrals</P>
    <VERBATIM>
<![CDATA[
I  I  I (F ,F ,...,F )      dx(3)dx(2)dx(1),
          1  2      numfun
   ]]>
    </VERBATIM>
    <P>
    where the region of integration is a collection of
    NUMTET tetrahedrons and where</P>
    <VERBATIM>
<![CDATA[
F = F (X(1),X(2),X(3)), J = 1,2,...,NUMFUN.
 J   J
   ]]>
    </VERBATIM>
    <P>
    A globally adaptive strategy is applied in order to
    compute approximations <VERB>result(k)</VERB>
    hopefully satisfying, for each component of I, the
    following claim for accuracy:
    <VERB>ABS(I(K)-RESULT(K))&lt;=MAX(EPSABS,EPSREL*ABS(I(K)))</VERB></P>
    <P><VERB>int3d</VERB> repeatedly subdivides the tetrahedrons with greatest
    estimated errors and estimates the integrals and the errors over the
    new subtetrahedrons until the error request is met or <VERB>MAXPTS</VERB>
    function evaluations have been used.</P>
    <P>
    A 43 point integration rule with all evaluation points inside the
    tetrahedron is applied. The rule has polynomial degree 8.</P>
    <P>
    If the values of the input parameters <VERB>EPSABS</VERB> or <VERB>EPSREL</VERB> are
    selected great enough, an integration rule is applied over each
    tetrahedron and the results are added up to give the approximations
    <VERB>RESULT(K)</VERB>. No further subdivision of the tetrahedrons will then
    be applied.</P>
    <P>
    When <VERB>int3d</VERB> computes estimates to a vector of
    integrals, all components of the vector are given
    the same treatment. That is, <VERB>I(Fj)</VERB> and <VERB>I(Fk)</VERB> for</P>
    <P><VERB>j</VERB> not equal to <VERB>k</VERB>, are estimated with the same
    subdivision of the region of integration.
    For integrals with enough similarity, we may save
    time by applying <VERB>int3d</VERB> to all integrands in one call.
    For integrals that varies continuously as functions of
    some parameter, the estimates produced by <VERB>int3d</VERB>  will
    also vary continuously when the same subdivision is
    applied to all components. This will generally not be
    the case when the different components are given
    separate treatment.</P>
    <P>
    On the other hand this feature should be used with
    caution when the different components of the integrals
    require clearly different subdivisions.</P>
  </DESCRIPTION>
  <SECTION label="References">
    <P>
    Fortran routine dcutet.f</P>
  </SECTION>
  <EXAMPLE>
<![CDATA[
X=[0;1;0;0];
Y=[0;0;1;0];
Z=[0;0;0;1];
[RESULT,ERROR]=int3d(X,Y,Z,'int3dex')
// computes the integrand exp(x*x+y*y+z*z) over the 
//tetrahedron (0.,0.,0.),(1.,0.,0.),(0.,1.,0.),(0.,0.,1.)


//integration over a cube  -1<=x<=1;-1<=y<=1;-1<=z<=1

//  bottom  -top-     right    -left-   front   -rear- 
X=[ 0, 0,    0, 0,    0, 0,    0, 0,    0, 0,    0, 0;          
   -1,-1,   -1,-1,    1, 1,   -1,-1,   -1,-1,   -1,-1; 
    1,-1,    1,-1,    1, 1,   -1,-1,    1,-1,    1,-1;     
    1, 1,    1, 1,    1, 1,   -1,-1,    1, 1,    1, 1];         
Y=[ 0, 0,    0, 0,    0, 0,    0, 0,    0, 0,    0, 0; 
   -1,-1,   -1,-1,   -1, 1,   -1, 1,   -1,-1,    1, 1;
   -1, 1,   -1, 1,    1, 1,    1, 1,   -1,-1,    1, 1;   
    1, 1,    1, 1,   -1,-1,   -1,-1,   -1,-1,    1, 1]; 
Z=[ 0, 0,    0, 0,    0, 0,    0, 0,    0, 0,    0, 0;
   -1,-1,    1, 1,   -1, 1,   -1, 1,   -1,-1,   -1,-1; 
   -1,-1,    1, 1,   -1,-1,   -1,-1,   -1, 1,   -1, 1;  
   -1,-1,    1, 1,    1, 1,    1, 1,    1, 1,    1, 1];      

function v=f(xyz,numfun),v=exp(xyz'*xyz),endfunction
[result,err]=int3d(X,Y,Z,f,1,[0,100000,1.d-5,1.d-7])

function v=f(xyz,numfun),v=1,endfunction
[result,err]=int3d(X,Y,Z,f,1,[0,100000,1.d-5,1.d-7])

   ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>intc</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>intl</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>int2d</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
  <AUTHORS>
    <AUTHORS_ITEM label="Jarle Berntsen"> The Computing Centre,
University of Bergen, Thormohlens gt. 55,
N-5008 Bergen, Norway
Phone..  47-5-544055
Email..  jarle@eik.ii.uib.no, 
</AUTHORS_ITEM>
    <AUTHORS_ITEM label="Ronald Cools"> Dept. of Computer Science,
Katholieke Universiteit Leuven, Celestijnenlaan 200A,
B-3030 Heverlee, Belgium
Phone..  32-16-201015 (3562)
Email..  ronald@cs.kuleuven.ac.be,
</AUTHORS_ITEM>
    <AUTHORS_ITEM label="Terje O. Espelid"> Department of Informatics,
University of Bergen, Thormohlens gt. 55,
N-5008 Bergen, Norway
Phone..  47-5-544180
Email..  terje@eik.ii.uib.no
</AUTHORS_ITEM>
  </AUTHORS>
</MAN>
