# Integration of functions over geometries

Cross-posting from Zulip’s #meshes.jl channel…

Does anyone know of a good reference for integration rules over different geometries?

For example, to integrate a function f over a triangle, we can consider the surface integral:

\int_S fdS = \int_{u=0}^1 \int_{v=0}^{1-u} f(u,v) ||r_u \times r_v|| dudv = Area\ \frac{f_1 + f_2 + f_3}{3}

where r = (x(u,v), y(u,v), z(u,v)) is a point in the triangle expressed in terms of parametric coordinates u and v.

More specifically, I am looking for formulas for bilinear integration over quadrangles and trilinear integration over hexahedron in terms of the vertex values f_1, f_2, f_3, ... and their coordinates x_1, x_2, ....

P.C. Hammer, A.H. Stroud, Numerical integration over simplexes. Math. Tables Aids
Comput. 10 , 137–139 (1956).

M. Abramowitz, I. Stegun, Handbook of Mathematical Functions , 9th edn. (Dover Pub-
lications Inc., New York, NY, 1972).

P.J. Davis, P. Rabinowitz, Methods of Numerical Integration . Computer Science and
Applied Mathematics (Academic Press, New York, NY, 1975).

H. Brass, K. Petras, Quadrature Theory , vol. 178, Mathematical Surveys and Monographs
(American Mathematical Society, Providence, RI, 2011).

R. Cools, P. Rabinowitz, Monomial cubature rules since “Stroud”: a compilation. J. Com-
put. Appl. Math. 48 (3), 309–326 (1993).

R. Cools, Monomial cubature rules since “Stroud”: a compilation. II. J. Comput. Appl.
Math. 112 (1-2), 21–27 (1999).

D.A. Dunavant, High degree eﬃcient symmetrical Gaussian quadrature rules for the tri-
angle. Internat. J. Numer. Methods Engrg. 21 (6), 1129–1148 (1985).

P.C. Hammer, A.H. Stroud, Numerical integration over simplexes. Math. Tables Aids
Comput. 10 , 137–139 (1956).

A.H. Stroud, Approximate Calculation of Multiple Integrals (Prentice-Hall Inc., Engle-
wood Cliﬀs, NJ, 1971).

M. Abramowitz, I. Stegun, Handbook of Mathematical Functions , 9th edn. (Dover Pub-
lications Inc., New York, NY, 1972).

4 Likes

has a medley of (relatively) low-order rules. But not Gauss-Lobatto (useful for nodal integration in spectral methods), except for the lowest order.

(a native Julia version of this would be great…)

1 Like

Amazing links. Thank you all. The plan is to implement some of these for Meshes.jl geometries.

1 Like

@Perrin_Meyer is quadpy closed-source? Can’t find their source code to understand what is going on.

@Oscar_Smith I think FastGaussQuadrature.jl doesn’t implement integration over geometries. It is mostly hypercubes as far as I know.

This is a very good C++ library for integration over convex polytopes that I used some time ago. No Julia interface as far as I know, however…

1 Like

You can take a quadrangle or a hexahedron and easily map into into a hypercube by a coordinate transformation, at which point you can apply any quadrature rule for a hypercube (with a corresponding Jacobian factor), whether it is a simple first-order bilinear rule or a tensor product of Gaussian quadrature rules or an adaptive quadrature scheme.

More generally, things like triangular domains can also be converted to rectangles with a change of variables, and general polygons could be decomposed into triangles, etcetera.

2 Likes

Weird, because last time I looked (six months ago) all the python code was right on github, and I thought it was all open source… My best guess is this is some sort of code-reorganization?

Yes, it is unfortunate that the source code is not open, it would be a great resource to understand the tradeoff of different methods and designs.