Scilab Reference Manual |
---|
int2d — definite 2D integral by quadrature and cubature method
[I,err]=int2d(X,Y,f [,params])
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. | ||||||||||
f | : external (function or list or string) defining the integrand f(u,v); | ||||||||||
params | : real vector [tol, iclose, maxtri, mevals, iflag]. default value is [1.d-10, 1, 50, 4000, 1].
| ||||||||||
I | : the integral value | ||||||||||
err | : the estimated error |
int2d computes the two-dimensional integral of a function f over a region consisting of n 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.
X=[0,0;1,1;1,0]; Y=[0,0;0,1;1,1]; deff('z=f(x,y)','z=cos(x+y)') [I,e]=int2d(X,Y,f) // computes the integrand over the square [0 1]x[0 1]
Fortran routine twodq Authors: Kahaner,D.K.,N.B.S., Rechard,O.W.,N.B.S.,; Barnhill,Robert,Univ. of UTAH
<< impl | int3d >> |