14
14
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="int2d" xml:lang="en">
16
<refname>int2d</refname>
17
<refpurpose>definite 2D integral by quadrature and cubature
22
<title>Calling Sequence</title>
23
<synopsis>[I,err]=int2d(X,Y,f [,params])</synopsis>
26
<title>Arguments</title>
32
a 3 by <literal>N</literal> array containing the abscissae of the vertices of the
41
a 3 by <literal>N</literal> array containing the ordinates of the vertices of the
49
<para>external (function or list or string) defining the integrand
50
<literal>f(u,v)</literal>
58
a real vector <literal>[tol, iclose, maxtri, mevals, iflag]</literal>.
59
The default value is <literal>[1.d-10, 1, 50, 4000, 1]</literal>.
65
<para>the desired bound on the error. If
66
<literal>iflag=0</literal>, <literal>tol</literal> is
67
interpreted as a bound on the relative error; if
68
<literal>iflag=1</literal>, the bound is on the absolute
76
<para>an integer parameter that determines the selection of
77
LQM0 or LQM1 methods. If <literal>iclose=1</literal> then LQM1
78
is used. Any other value of <literal>iclose</literal> causes
79
LQM0 to be used. LQM0 uses function values only at interior
80
points of the triangle. LQM1 is usually more accurate than
81
LQM0 but involves evaluating the integrand at more points
82
including some on the boundary of the triangle. It will
83
usually be better to use LQM1 unless the integrand has
84
singularities on the boundary of the triangle.
91
<para>the maximum number of triangles in the final
92
triangulation of the region
99
<para>the maximum number of function evaluations to be
100
allowed. This number will be effective in limiting the
101
computation only if it is less than
102
94*<literal>maxtri</literal> when LQM1 is specified or
103
56*<literal>maxtri</literal> when LQM0 is specified.
111
if <literal>iflag=0</literal>, <literal>tol</literal> is
112
interpreted as a bound on the relative error; if <literal>iflag=1</literal>,
113
the bound is on the absolute error.
123
<para>the integral value</para>
129
<para>the estimated error</para>
135
<title>Description</title>
137
<literal>int2d</literal> computes the two-dimensional integral of a
138
function <literal>f</literal> over a region consisting of
139
<literal>n</literal> triangles. A total error estimate is obtained and
140
compared with a tolerance - <literal>tol</literal> - that is provided as
141
input to the subroutine. The error tolerance is treated as either relative
142
or absolute depending on the input value of <literal>iflag</literal>. A
143
'Local Quadrature Module' is applied to each input triangle and estimates
144
of the total integral and the total error are computed. The local
145
quadrature module is either subroutine LQM0 or subroutine LQM1 and the
146
choice between them is determined by the value of the input variable
147
<literal>iclose</literal>.
149
<para>If the total error estimate exceeds the tolerance, the triangle with
150
the largest absolute error is divided into two triangles by a median to
151
its longest side. The local quadrature module is then applied to each of
152
the subtriangles to obtain new estimates of the integral and the error.
153
This process is repeated until either (1) the error tolerance is
154
satisfied, (2) the number of triangles generated exceeds the input
155
parameter <literal>maxtri</literal>, (3) the number of integrand
156
evaluations exceeds the input parameter <literal>mevals</literal>, or (4)
157
the function senses that roundoff error is beginning to contaminate the
162
<title>Examples</title>
163
<programlisting role="example"><![CDATA[
16
<refname>int2d</refname>
17
<refpurpose>definite 2D integral by quadrature and cubature
22
<title>Calling Sequence</title>
23
<synopsis>[I,err]=int2d(X,Y,f [,params])</synopsis>
26
<title>Arguments</title>
32
a 3 by <literal>N</literal> array containing the abscissae of the vertices of the
41
a 3 by <literal>N</literal> array containing the ordinates of the vertices of the
49
<para>external (function or list or string) defining the integrand
50
<literal>f(u,v)</literal>
58
a real vector <literal>[tol, iclose, maxtri, mevals, iflag]</literal>.
59
The default value is <literal>[1.d-10, 1, 50, 4000, 1]</literal>.
65
<para>the desired bound on the error. If
66
<literal>iflag=0</literal>, <literal>tol</literal> is
67
interpreted as a bound on the relative error; if
68
<literal>iflag=1</literal>, the bound is on the absolute
76
<para>an integer parameter that determines the selection of
77
LQM0 or LQM1 methods. If <literal>iclose=1</literal> then LQM1
78
is used. Any other value of <literal>iclose</literal> causes
79
LQM0 to be used. LQM0 uses function values only at interior
80
points of the triangle. LQM1 is usually more accurate than
81
LQM0 but involves evaluating the integrand at more points
82
including some on the boundary of the triangle. It will
83
usually be better to use LQM1 unless the integrand has
84
singularities on the boundary of the triangle.
91
<para>the maximum number of triangles in the final
92
triangulation of the region
99
<para>the maximum number of function evaluations to be
100
allowed. This number will be effective in limiting the
101
computation only if it is less than
102
94*<literal>maxtri</literal> when LQM1 is specified or
103
56*<literal>maxtri</literal> when LQM0 is specified.
111
if <literal>iflag=0</literal>, <literal>tol</literal> is
112
interpreted as a bound on the relative error; if <literal>iflag=1</literal>,
113
the bound is on the absolute error.
123
<para>the integral value</para>
129
<para>the estimated error</para>
135
<title>Description</title>
137
<literal>int2d</literal> computes the two-dimensional integral of a
138
function <literal>f</literal> over a region consisting of
139
<literal>n</literal> triangles. A total error estimate is obtained and
140
compared with a tolerance - <literal>tol</literal> - that is provided as
141
input to the subroutine. The error tolerance is treated as either relative
142
or absolute depending on the input value of <literal>iflag</literal>. A
143
'Local Quadrature Module' is applied to each input triangle and estimates
144
of the total integral and the total error are computed. The local
145
quadrature module is either subroutine LQM0 or subroutine LQM1 and the
146
choice between them is determined by the value of the input variable
147
<literal>iclose</literal>.
149
<para>If the total error estimate exceeds the tolerance, the triangle with
150
the largest absolute error is divided into two triangles by a median to
151
its longest side. The local quadrature module is then applied to each of
152
the subtriangles to obtain new estimates of the integral and the error.
153
This process is repeated until either (1) the error tolerance is
154
satisfied, (2) the number of triangles generated exceeds the input
155
parameter <literal>maxtri</literal>, (3) the number of integrand
156
evaluations exceeds the input parameter <literal>mevals</literal>, or (4)
157
the function senses that roundoff error is beginning to contaminate the
162
<title>Examples</title>
163
<programlisting role="example"><![CDATA[
166
166
deff('z=f(x,y)','z=cos(x+y)')
167
167
[I,e]=int2d(X,Y,f)
168
168
// computes the integrand over the square [0 1]x[0 1]
169
169
]]></programlisting>
171
<refsection role="see also">
172
<title>See Also</title>
173
<simplelist type="inline">
175
<link linkend="intc">intc</link>
178
<link linkend="intl">intl</link>
181
<link linkend="int3d">int3d</link>
184
<link linkend="intg">intg</link>
187
<link linkend="mesh">mesh</link>
171
<refsection role="see also">
172
<title>See Also</title>
173
<simplelist type="inline">
175
<link linkend="intc">intc</link>
178
<link linkend="intl">intl</link>
181
<link linkend="int3d">int3d</link>
184
<link linkend="intg">intg</link>
187
<link linkend="mesh">mesh</link>