Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - Français

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Aide de Scilab >> Intégration - dérivation > int2d

int2d

definite 2D integral by quadrature method

Syntax

[I, err] = int2d(X, Y, f)
[I, err] = int2d(X, Y, f, params)
[I, err] = int2d(xmin, xmax, ymin, ymax, f)
[I, err] = int2d(xmin, xmax, ymin, ymax, f, params)

Arguments

X

a 3 by N array containing the abscissae of the vertices of the N triangles

Y

a 3 by N array containing the ordinates of the vertices of the N triangles

xmin, xmax, ymin, ymax

real scalars defining a rectangle in the plane

f

external (function or list or string) defining the integrand f(u,v)

params

a real vector [tol, iclose, maxtri, mevals, iflag]. The default value is [1.d-10, 1, 50, 4000, 1].

tol

the desired bound on the error. If iflag=0, tol is interpreted as a bound on the relative error; if iflag=1, the bound is on the absolute error.

iclose

an integer parameter that determines the selection of LQM0 or LQM1 methods. If iclose=1 then LQM1 is used. Any other value of iclose causes LQM0 to be used. LQM0 uses function values only at interior points of the triangle. LQM1 is usually more accurate than LQM0 but involves evaluating the integrand at more points including some on the boundary of the triangle. It will usually be better to use LQM1 unless the integrand has singularities on the boundary of the triangle.

maxtri

the maximum number of triangles in the final triangulation of the region

mevals

the maximum number of function evaluations to be allowed. This number will be effective in limiting the computation only if it is less than 94*maxtri when LQM1 is specified or 56*maxtri when LQM0 is specified.

iflag

if iflag=0, tol is interpreted as a bound on the relative error; if iflag=1, the bound is on the absolute error.

I

the integral value

err

the estimated error

Description

int2d computes the two-dimensional integral of a function f over a region consisting of N triangles or over a single rectangle [xmin,xmax]x[ymin,ymax] (internally divided into two triangles). A total error estimate is obtained and compared with a tolerance - tol - that is provided as input to the subroutine. The error tolerance is treated as either relative or absolute depending on the input value of iflag. A 'Local Quadrature Module' is applied to each input triangle and estimates of the total integral and the total error are computed. The local quadrature module is either subroutine LQM0 or subroutine LQM1 and the choice between them is determined by the value of the input variable iclose.

If the total error estimate exceeds the tolerance, the triangle with the largest absolute error is divided into two triangles by a median to its longest side. The local quadrature module is then applied to each of the subtriangles to obtain new estimates of the integral and the error. This process is repeated until either (1) the error tolerance is satisfied, (2) the number of triangles generated exceeds the input parameter maxtri, (3) the number of integrand evaluations exceeds the input parameter mevals, or (4) the function senses that roundoff error is beginning to contaminate the result.

Examples

deff('z=f(x,y)','z=cos(x+y)')
// computes the integral over the  triangle (0,0),(1 0),(0,1)
X = [0 1 0]';
Y = [0 0 1]';
[I,e] = int2d(X,Y,f)

// computes the integral over the square [0,1]x[0,1]
[I,e] = int2d(0,1,0,1,f)

See also

  • mesh2d — Triangulation of n points in the plane
  • int3d — definite 3D integral by quadrature and cubature method
  • intg — intégration numérique adaptative
  • intl — Cauchy integral
  • intc — intégrale dans le plan complexe, selon un chemin rectiligne
Report an issue
<< impl Intégration - dérivation int3d >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:33:05 CET 2022