|
CMP++: Uncertainty Quantification & Bayesian Calibration
|
One-dimensional quadrature rule generator and integrator. More...
#include <integrator.h>
Public Member Functions | |
| Quadrature1D (int numPoints) | |
| double | integrate (std::function< double(double)> f) const |
Public Attributes | |
| Eigen::VectorXd | nodes |
| Vector containing the quadrature node points. | |
| Eigen::VectorXd | weights |
| Vector containing the corresponding quadrature weights. | |
One-dimensional quadrature rule generator and integrator.
Mathematical Formulation: A 1D quadrature rule approximates the integral of a function $f(x)$ over an interval $[a, b]$ with a weight function $w(x)$ as:
\[ \int_{a}^{b} w(x) f(x) \, dx \approx \sum_{i=0}^{N-1} w_i f(x_i) \]
where $x_i$ are the quadrature nodes (roots of the $N$-th order orthogonal polynomial associated with $w(x)$) and $w_i$ are the corresponding quadrature weights. Using the Golub-Welsch algorithm, the nodes $x_i$ and weights $w_i$ are computed from the symmetric tridiagonal Jacobi matrix $J$ for the orthogonal polynomial sequence:
\[ J = \begin{pmatrix} a_0 & b_1 & 0 & \cdots & 0 \\ b_1 & a_1 & b_2 & \cdots & 0 \\ 0 & b_2 & a_2 & \ddots & \vdots \\ \vdots & \vdots & \ddots & \ddots & b_{N-1} \\ 0 & 0 & \cdots & b_{N-1} & a_{N-1} \end{pmatrix} \]
The nodes $x_i$ are the eigenvalues of $J$. The weights $w_i$ are computed as:
\[ w_i = \mu_0 v_{i,0}^2 \]
where $v_{i,0}$ is the first component of the normalized $i$-th eigenvector of $J$, and $\mu_0 = \int_{a}^{b} w(x) \, dx$ is the total mass/zeroth moment of the weight function.
Implementation Algorithm:
BasisType::getJacobiMatrix(numPoints).Eigen::SelfAdjointEigenSolver.nodes.weights(i) by squaring the first component of the $i$-th eigenvector (solver.eigenvectors()(0, i)).integrate(f) which evaluates $\sum_i w_i f(x_i)$.
|
inline |
|
inline |
| Eigen::VectorXd cmp::Quadrature1D< BasisType >::nodes |
Vector containing the quadrature node points.
| Eigen::VectorXd cmp::Quadrature1D< BasisType >::weights |
Vector containing the corresponding quadrature weights.