TEST_TRI_INT
Triangle Integration Test Functions


TEST_TRI_INT is a MATLAB library which defines test functions to be integrated over a triangle.

It is possible to invoke a particular function by number, or to try out all available functions, as demonstrated in the sample calling program.

For convenience, all the integrand functions have been scaled by a constant, so that the integral of the function over the specific domain is exactly 1.

The test functions include F(X,Y)=

  1. 1 on the unit triangle.
  2. x on the unit triangle.
  3. y on the unit triangle.
  4. x2 on the unit triangle.
  5. x*y on the unit triangle.
  6. y2 on the unit triangle.
  7. x3 on the unit triangle.
  8. x4 on the unit triangle.
  9. x5 on the unit triangle.
  10. x^(-0.2) remapped to (1,0), (5,0), (5,1).
  11. (x+y)^(-0.2) on the unit triangle.
  12. (1-x-y)^(-0.2) remapped to (-1,-3), (3,-2), (-1,2).
  13. (x*y)^(-0.2) remapped to (0,0), (-7,0), (0,-3).
  14. 1/sqrt(x) + 1/sqrt(y) + 1/sqrt(x+y) on the unit triangle.
  15. 1/sqrt(1-x-y) on the unit triangle.
  16. log(x*y) on the unit triangle.
  17. 1/sqrt(|x-1/4|) + 1/sqrt(|y-1/2|) on the unit triangle.
  18. log ( x + y ) on the unit triangle.
  19. sin ( x ) cos ( 5 y ) on the unit triangle.
  20. sin ( 11 x ) cos ( y ) on the unit triangle.
  21. 1 / r on the unit triangle,
    r = sqrt ( x^2+y^2).
  22. log ( r ) / r on the unit triangle,
    r = sqrt ( x^2+y^2).

The library includes a routines to define the integrand function, the triangle over which the integral is to be carried out, and a title for the problem. Thus, for each integrand function, four routines are supplied. For instance, for function #4, we have the routines:

So once you have the calling sequences for these routines, you can easily evaluate the function, or integrate it between the appropriate limits, or compare your estimate of the integral to the exact value.

Moreover, since the same interface is used for each function, if you wish to work with problem 16 instead, you simply change the "04" to "07" in your routine calls.

If you wish to call all of the functions, then you simply use the generic interface, which again has four routines, but which requires you to specify the problem number as an extra input argument:

Finally, some demonstration routines are built in for simple quadrature methods. These routines include

and can be used with any of the sample integrands.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

TEST_TRI_INT is available in a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

DUNAVANT, a MATLAB library which defines Dunavant rules for quadrature on a triangle.

FEKETE, a MATLAB library which defines a Fekete rule for quadrature or interpolation over a triangle.

GM_RULE, a MATLAB library which defines a Grundmann-Moeller rule for quadrature over a triangle, tetrahedron, or general M-dimensional simplex.

LYNESS_RULE, a MATLAB library which returns Lyness-Jespersen quadrature rules for the triangle.

NCC_TRIANGLE, a MATLAB library which defines Newton-Cotes closed quadrature rules on a triangle.

NCO_TRIANGLE, a MATLAB library which defines Newton-Cotes open quadrature rules on a triangle.

STROUD, a MATLAB library which includes some quadrature rules for triangles.

TOMS612, a FORTRAN77 library which can estimate the integral of a function over a triangle.

TRIANGLE_MONTE_CARLO, a MATLAB program which uses the Monte Carlo method to estimate integrals over a triangle.

TRIANGULATION, a MATLAB library which can be used for triangulations, and includes some quadrature rules on triangles.

WANDZURA, a MATLAB library which defines Wandzura rules for quadrature on a triangle.

Reference:

  1. Elise deDoncker, Ian Robinson,
    An Algorithm for Automatic Integration Over a Triangle Using Nonlinear Extrapolation,
    ACM Transactions on Mathematical Software,
    Volume 10, Number 1, March 1984, pages 1-16.
  2. Elise deDoncker, Ian Robinson,
    Algorithm 612: Integration over a Triangle Using Nonlinear Extrapolation,
    ACM Transactions on Mathematical Software,
    Volume 10, Number 1, March 1984, pages 17-22.
  3. Stephen Wandzura, Hong Xiao,
    Symmetric Quadrature Rules on a Triangle,
    Computers and Mathematics with Applications,
    Volume 45, pages 1829-1840, 2003.

Source Code:

Examples and Tests:

You can go up one level to the MATLAB source codes.


Last revised on 10 April 2007.