# cube_exactness

cube_exactness, a MATLAB code which investigates the polynomial exactness of quadrature rules over the interior of a cube in 3D.

We assume that the integral to be approximated is of a Legendre type, over a rectangular region:

```        I(f) = integral ( z1 <= z <= z2 )
integral ( y1 <= y <= y2 )
integral ( x1 <= x <= x2 ) f(x,y,z) dx dy dz
```
and that such integrals are to be approximated by:
```        Q(f) = sum ( 1 <= i <= N ) w(i) * f(x(i),y(i),z(i))
```

To determine the exactness of a given quadrature rule, we simply compare the exact integral I(f) to the estimated integral Q(f) for a sequence of monomials of increasing total degree D. This sequence begins with:

```        D = 0:  1
D = 1:  x    y     z
D = 2:  x^2  xy    xz    y^2   yz   z^2
D = 3:  x^3  x^2y  x^2z  xy^2  xyz  xz^2  y^3  y^2z  yz^2  z^3
```
and the exactness of a quadrature rule is defined as the largest value of D such that I(f) and Q(f) are equal for all monomials up to and including those of total degree D.

Note that if the 3D quadrature rule is formed as a product of two 1D rules, then knowledge of the 1D exactness of the individual factors gives sufficient information to determine the exactness of the product rule, which will simply be the minimum of the exactnesses of the three factor rules.

### Languages:

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

### Related Data and Programs:

cube_felippa_rule, a MATLAB code which returns the points and weights of a Felippa quadrature rule over the interior of a cube in 3D.

cube_grid, a MATLAB code which computes a grid of points over the interior of a cube in 3D.

exactness, a MATLAB code which investigates the exactness of quadrature rules that estimate the integral of a function with a density, such as 1, exp(-x) or exp(-x^2), over an interval such as [-1,+1], [0,+oo) or (-oo,+oo).

hypercube_exactness, a MATLAB code which measures the monomial exactness of an M-dimensional quadrature rule over the interior of the unit hypercube in M dimensions.

pyramid_exactness, a MATLAB code which investigates the monomial exactness of a quadrature rule over the interior of a pyramid in 3D.

sphere_exactness, a MATLAB code which tests the monomial exactness of a quadrature rule on the surface of the unit sphere in 3D.

square_exactness, a MATLAB code which investigates the polynomial exactness of quadrature rules for f(x,y) over the interior of a square (rectangle/quadrilateral) in 2D.

tetrahedron_exactness, a MATLAB code which investigates the monomial exactness of a quadrature rule over the interior of a tetrahedron in 3D.

triangle_exactness, a MATLAB code which investigates the monomial exactness quadrature rule over the interior of a triangle in 2D.

wedge_exactness, a MATLAB code which investigates the monomial exactness of a quadrature rule over the interior of the unit wedge in 3D.

### Reference:

1. Philip Davis, Philip Rabinowitz,
Methods of Numerical Integration,
Second Edition,
Dover, 2007,
ISBN: 0486453391,
LC: QA299.3.D28.

### Source Code:

Last revised on 22 December 2018.