queso-0.57.1
|
Class for Legendre-Gauss quadrature rule for one-dimensional functions. More...
#include <1DQuadrature.h>
Public Member Functions | |
Constructor/Destructor methods | |
UniformLegendre1DQuadrature (double minDomainValue, double maxDomainValue, unsigned int order, bool densityIsNormalized) | |
Default constructor. More... | |
~UniformLegendre1DQuadrature () | |
Destructor. More... | |
Public Member Functions inherited from QUESO::Base1DQuadrature | |
Base1DQuadrature (double minDomainValue, double maxDomainValue, unsigned int order) | |
Default constructor. More... | |
virtual | ~Base1DQuadrature ()=0 |
Pure virtual destructor, forcing this to be an abstract object. More... | |
double | minDomainValue () const |
Returns the minimum value of the domain of the (one-dimensional) function. More... | |
double | maxDomainValue () const |
Returns the maximum value of the domain of the (one-dimensional) function. More... | |
unsigned int | order () const |
Returns the order of the quadrature rule. More... | |
const std::vector< double > & | positions () const |
Array of the positions for the numerical integration. More... | |
Public Member Functions inherited from QUESO::BaseQuadrature | |
BaseQuadrature () | |
virtual | ~BaseQuadrature ()=0 |
Pure virtual destructor, forcing this to be an abstract object. More... | |
const std::vector< double > & | weights () const |
Array of the weights used in the numerical integration. More... | |
Additional Inherited Members | |
Protected Attributes inherited from QUESO::Base1DQuadrature | |
double | m_minDomainValue |
double | m_maxDomainValue |
unsigned int | m_order |
std::vector< double > | m_positions |
Protected Attributes inherited from QUESO::BaseQuadrature | |
std::vector< double > | m_weights |
Class for Legendre-Gauss quadrature rule for one-dimensional functions.
In a general Gaussian quadrature rule, an definite integral of \( f(x)\) is first approximated over the interval [-1,1] by a polynomial approximable function \( g(x)\) and a known weighting function \( W(x)\):
\[\int_{-1}^1 f(x) \, dx = \int_{-1}^1 W(x) g(x) \, dx\]
Those are then approximated by a sum of function values at specified points \( x_i \) multiplied by some weights \( w_i \):
\[ \int_{-1}^1 W(x) g(x) \, dx \approx \sum_{i=1}^n w_i g(x_i) \]
In the case of Gauss-Legendre quadrature, the weighting function \( W(x) = 1 \), so we can approximate an integral of \( f(x) \) with:
\[ \int_{-1}^1 f(x)\,dx \approx \sum_{i=1}^n w_i f(x_i) \]
The abscissas for quadrature order \( n \) are given by the roots of the Legendre polynomials \( P_n(x)\), which occur symmetrically about 0. The weights are
\[ w_i = \frac{2}{(1-x_i^2)[P'_n(x_i)]^2}=\frac{2(1-x_i^2)}{(n+1)^2[P_{n+1}(x_i)]^2} \]
Several authors give a table of abscissas and weights:
\( n \) | \( x_i \) | \( w_i \) |
---|---|---|
2 | \( \pm \frac{1}{3}\sqrt{3} \) | \( 1 \) |
3 | \( 0 \) | \( \frac{8}{9} \) |
\( \pm \frac{1}{5} \sqrt{15} \) | \( \frac{5}{9} \) | |
4 | \( \pm \frac{1}{35}\sqrt{525-70\sqrt{30}} \) | \( \frac{1}{36}(18+\sqrt{30})\) |
\( \pm \frac{1}{35}\sqrt{525+70\sqrt{30}} \) | \( \frac{1}{36}(18-\sqrt{30})\) | |
5 | \( 0 \) | \( \frac{128}{225}\) |
\( \pm \frac{1}{21}\sqrt{245-14\sqrt{70}} \) | \( \frac{1}{900}(322+13\sqrt{70})\) | |
\( \pm \frac{1}{21}\sqrt{245+14\sqrt{70}} \) | \( \frac{1}{900}(322-13\sqrt{70})\) |
Definition at line 148 of file 1DQuadrature.h.
QUESO::UniformLegendre1DQuadrature::UniformLegendre1DQuadrature | ( | double | minDomainValue, |
double | maxDomainValue, | ||
unsigned int | order, | ||
bool | densityIsNormalized | ||
) |
Default constructor.
Constructs a Gaussian-Legendre quadrature of order order
, in the interval [minDomainValue,maxDomainValue]
. Valid values for the order of the quadrature rule are: 1-7, 10-12, 16. This method scales the abscissas (positions) of the quadrature from the interval [-1,1] to [minDomainValue,maxDomainValue]
, and the parameter densityIsNormalized
determines whether the weights should be scaled as well.
Definition at line 98 of file 1DQuadrature.C.
References QUESO::Base1DQuadrature::m_maxDomainValue, QUESO::Base1DQuadrature::m_minDomainValue, QUESO::Base1DQuadrature::m_order, QUESO::Base1DQuadrature::m_positions, and QUESO::BaseQuadrature::m_weights.
QUESO::UniformLegendre1DQuadrature::~UniformLegendre1DQuadrature | ( | ) |