Tools for constructing univariate and multivariate quadrature rules.
One dimensional quadrature rules attempt to approximate a weighted integral of the form
\[ \int_\Omega f(x) w(x) dx, \]
where \(f(x):\mathbb{R}\rightarrow\mathbb{R}\) is the function we wish to integrate, \(w(x):\mathbb{R}\rightarrow\mathbb{R}\) is a given weight function, and \(\Omega\) defines the support of the weight function. To approximate this type of integral, we seek an approximation of the form
\[ \int_\Omega f(x) w(x) dx \approx \sum_{i=1}^N w_i f(x_i), \]
where \(w_i\) and \(x_i\) are called the quadrature weights and quadrature points. Together these are called the quadrature rule.
Gauss quadrature refers to a particular way of defining quadrature rules that can exactly integrate polynomials of order \(2N-1\). The \(N\) point Gauss quadrature rule for a weight function \(w(x)\) corresponds to the roots of the degree- \(N\) polynomial in a polynomial family that is orthogonal with respect o the weight function \(w(x)\). For example, Legendre polynomials are orthogonal with respect to \(w(x) = I([-1,1])\), where \(I([-1,1])\) is the indicator function for the set \([-1,1]\). The \(N\) point Gauss-Legendre rule will then use the roots of the \(N^{th}\) order Legendre polynomial to exactly integrate
\[ \int_{-1}^1 f(x) dx, \]
when \(f(x)\) is a polynomial with degree \(\leq N\). The following table matches orthogonal polynomial families with their corresponding weight function and MUQ class name.
Weight Function \(w(x)\) | Domain | Polynomial Family | MUQ Class |
---|---|---|---|
\(1\) | \([-1,1]\) | Legendre | muq::Approximation::Legendre |
\(\exp\left[-\frac{1}{2}x^2\right] \) | \((-\infty, \infty)\) | Probabilist Hermite | muq::Approximation::ProbabilistHermite |
\(\exp\left[-x^2\right] \) | \((-\infty, \infty)\) | Physicist Hermite | muq::Approximation::PhysicistHermite |
\(\exp\left[-x\right] \) | \([0, \infty)\) | Laguerre | muq::Approximation::Laguerre |
\((1-x)^a (1+x)^b\) | \([-1,1]\) | Jacobi | muq::Approximation::Jacobi |
To construct a Gauss quadrature rule, MUQ requires the polynomial family to be defined first. See below for examples. Note that behind the scenes, MUQ uses the Golub-Welsch algorithm (see "Calculation of Quadrature Rules" Golub and Welsch 1969), to compute Gauss quadrature rules.
Example of constructing a Gauss-Legendre rule:
Set up for Gauss-Hermite rules:
Set up for Gauss-Laguerre
Set up for Gauss-Jacobi
Note that it is also possible to choose a polynomial family by passing the polynomial name as a string to the OrthogonalPolynomial::Construct
method. For example,
The nested Clenshaw Curtis quadrature:
Classes | |
class | muq::Approximation::GaussQuadrature |
Class for computing Gauss Quadrature rules from an orthogonal polynomial family. More... | |
class | muq::Approximation::ClenshawCurtisQuadrature |
1d Clenshaw Curtis rule More... | |
class | muq::Approximation::ExponentialGrowthQuadrature |
1d Quadrature rule with exponential growth More... | |
class | muq::Approximation::FullTensorQuadrature |
Multivariate quadrature rule defined by the tensor product of 1d rules. More... | |
class | muq::Approximation::GaussPattersonQuadrature |
1d Gauss Patterson nested quadrature rule More... | |
class | muq::Approximation::Quadrature |
Base class for multivariate quadrature rules. @detail An abstract class for computing nodes and weights of general quadrature rules. @seealso GaussQuadrature. More... | |
class | muq::Approximation::SmolyakQuadrature |
Computes static Smolyak quadrature rules for multivariate integration. More... | |