1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
7 * Copyright (C) 2012 - 2016 - Scilab Enterprises
9 * This file is hereby licensed under the terms of the GNU GPL v2.0,
10 * pursuant to article 5.3.4 of the CeCILL v.2.1.
11 * This file was originally licensed under the terms of the CeCILL v2.1,
12 * and continues to be available under such terms.
13 * For more information, see the COPYING file which you should have received
14 * along with this program.
17 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
18 xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
19 xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
20 xmlns:scilab="http://www.scilab.org" xml:id="int2d" xml:lang="en">
22 <refname>int2d</refname>
23 <refpurpose>definite 2D integral by quadrature and cubature
30 [I, err] = int2d(X, Y, f)
31 [I, err] = int2d(X, Y, f, params)
35 <title>Arguments</title>
41 a 3 by <literal>N</literal> array containing the abscissae of the vertices of the
50 a 3 by <literal>N</literal> array containing the ordinates of the vertices of the
58 <para>external (function or list or string) defining the integrand
59 <literal>f(u,v)</literal>
67 a real vector <literal>[tol, iclose, maxtri, mevals, iflag]</literal>.
68 The default value is <literal>[1.d-10, 1, 50, 4000, 1]</literal>.
74 <para>the desired bound on the error. If
75 <literal>iflag=0</literal>, <literal>tol</literal> is
76 interpreted as a bound on the relative error; if
77 <literal>iflag=1</literal>, the bound is on the absolute
85 <para>an integer parameter that determines the selection of
86 LQM0 or LQM1 methods. If <literal>iclose=1</literal> then LQM1
87 is used. Any other value of <literal>iclose</literal> causes
88 LQM0 to be used. LQM0 uses function values only at interior
89 points of the triangle. LQM1 is usually more accurate than
90 LQM0 but involves evaluating the integrand at more points
91 including some on the boundary of the triangle. It will
92 usually be better to use LQM1 unless the integrand has
93 singularities on the boundary of the triangle.
100 <para>the maximum number of triangles in the final
101 triangulation of the region
108 <para>the maximum number of function evaluations to be
109 allowed. This number will be effective in limiting the
110 computation only if it is less than
111 94*<literal>maxtri</literal> when LQM1 is specified or
112 56*<literal>maxtri</literal> when LQM0 is specified.
120 if <literal>iflag=0</literal>, <literal>tol</literal> is
121 interpreted as a bound on the relative error; if <literal>iflag=1</literal>,
122 the bound is on the absolute error.
132 <para>the integral value</para>
138 <para>the estimated error</para>
144 <title>Description</title>
146 <literal>int2d</literal> computes the two-dimensional integral of a
147 function <literal>f</literal> over a region consisting of
148 <literal>n</literal> triangles. A total error estimate is obtained and
149 compared with a tolerance - <literal>tol</literal> - that is provided as
150 input to the subroutine. The error tolerance is treated as either relative
151 or absolute depending on the input value of <literal>iflag</literal>. A
152 'Local Quadrature Module' is applied to each input triangle and estimates
153 of the total integral and the total error are computed. The local
154 quadrature module is either subroutine LQM0 or subroutine LQM1 and the
155 choice between them is determined by the value of the input variable
156 <literal>iclose</literal>.
158 <para>If the total error estimate exceeds the tolerance, the triangle with
159 the largest absolute error is divided into two triangles by a median to
160 its longest side. The local quadrature module is then applied to each of
161 the subtriangles to obtain new estimates of the integral and the error.
162 This process is repeated until either (1) the error tolerance is
163 satisfied, (2) the number of triangles generated exceeds the input
164 parameter <literal>maxtri</literal>, (3) the number of integrand
165 evaluations exceeds the input parameter <literal>mevals</literal>, or (4)
166 the function senses that roundoff error is beginning to contaminate the
171 <title>Examples</title>
172 <programlisting role="example"><![CDATA[
175 deff('z=f(x,y)','z=cos(x+y)')
177 // computes the integrand over the square [0 1]x[0 1]
180 <refsection role="see also">
181 <title>See also</title>
182 <simplelist type="inline">
184 <link linkend="mesh2d">mesh2d</link>
187 <link linkend="int3d">int3d</link>
190 <link linkend="intg">intg</link>
193 <link linkend="intl">intl</link>
196 <link linkend="intc">intc</link>