9.10. Integrators¶
- class cherab.core.math.integrators.integrators1d.GaussianQuadrature1D¶
Bases:
Integrator1DCompute an integral of a one-dimensional function over a finite interval using fixed-tolerance Gaussian quadrature. (see Scipy quadrature <https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.quadrature.html>).
The integration is performed by iteratively increasing the order of the Gaussian quadrature until the relative tolerance is met or the maximum order is reached.
- Parameters:
integrand (object) – A 1D function to integrate. Default is Constant1D(0).
relative_tolerance (double) – Iteration stops when relative error between last two iterates is less than this value. Default is 1.e-5.
max_order (int) – Maximum order on Gaussian quadrature the integration stops at. Default is 50.
min_order (int) – Minimum order on Gaussian quadrature the integration starts from. Default is 1.
- Variables:
integrand (Function1D) – A 1D function to integrate.
relative_tolerance (double) – Iteration stops when relative error between last two iterates is less than this value.
max_order (int) – Maximum order on Gaussian quadrature the integration stops at.
min_order (int) – Minimum order on Gaussian quadrature the integration starts from.
- max_order¶
Maximum order on Gaussian quadrature.
- Return type:
float
- min_order¶
Minimum order on Gaussian quadrature.
- Return type:
int
- relative_tolerance¶
Iteration stops when relative error between last two iterates is less than this value.
- Return type:
double
- class cherab.core.math.integrators.integrators2d.GaussianQuadrature2D¶
Bases:
Integrator2DApproximates an integral of a two-dimensional function over a finite interval.
The integral is approximated with fixed-tolerance Gauss-Legendre quadrature. The quadrature approximation is calculated as follows:
\[\int_{x_{\mathrm{lower}}}^{x_{\mathrm{upper}}} \int_{y_{\mathrm{lower}}(x)}^{y_{\mathrm{upper}}(x)} f(x, y) \, dy \, dx \approx \sum_{i=1}^{n_x} \sum_{j=1}^{n_y} w_{i} w_{j} \, f\left( B \xi_i + A, \, D(x) \eta_j + C(x) \right) \, B \cdot D(x)\]- where:
\(x_{\mathrm{lower}}\): Lower limit of integration for the x-dimension.
\(x_{\mathrm{upper}}\): Upper limit of integration for the x-dimension.
\(y_{\mathrm{lower}}(x)\): Lower limit of integration for the y-dimension, a function of \(x\).
\(y_{\mathrm{upper}}(x)\): Upper limit of integration for the y-dimension, a function of \(x\).
\(f(x, y)\): The function to be integrated over the specified region.
\(\xi\): The transformed variable for the x-dimension, ranging from -1 to 1.
\(\eta\): The transformed variable for the y-dimension, ranging from -1 to 1.
\(w_i\): The weight corresponding to the \(i\)-th root of the Legendre polynomial in the x-dimension.
\(w_j\): The weight corresponding to the \(j\)-th root of the Legendre polynomial in the y-dimension.
\(\xi_i\): The \(i\)-th root of the Legendre polynomial in the x-dimension.
\(\eta_j\): The \(j\)-th root of the Legendre polynomial in the y-dimension.
\(n_x\): The number of roots (or nodes) in the x-dimension.
\(n_y\): The number of roots (or nodes) in the y-dimension.
\(A = \frac{x_{\mathrm{upper}} + x_{\mathrm{lower}}}{2}\): Midpoint of the x-interval.
\(B = \frac{x_{\mathrm{upper}} - x_{\mathrm{lower}}}{2}\): Half-width of the x-interval.
\(D(x) = \frac{y_{\mathrm{upper}}(x) - y_{\mathrm{lower}}(x)}{2}\): Half-width of the y-interval.
\(C(x) = \frac{y_{\mathrm{upper}}(x) + y_{\mathrm{lower}}(x)}{2}\): Midpoint of the y-interval.
The integration is performed by iteratively increasing the order of the Gaussian quadrature in both the x and y dimensions until the relative tolerance is met or the maximum orders are reached.
- Parameters:
integrand (Function2D) – A 2D function to integrate. Default is Constant2D(0).
relative_tolerance (double) – Iteration stops when relative error between last two iterates is less than this value. Default is 1.e-5.
x_max_order (int) – Maximum order on Gaussian quadrature in the x dimension the integration stops at. Default is 50.
x_min_order (int) – Minimum order on Gaussian quadrature in the x dimension the integration starts from. Default is 1.
y_max_order (int) – Maximum order on Gaussian quadrature in the y dimension the integration stops at. Default is 50.
y_min_order (int) – Minimum order on Gaussian quadrature in the y dimension the integration starts from. Default is 1.
- Variables:
integrand (Function1D) – A 1D function to integrate.
relative_tolerance (double) – Iteration stops when relative error between last two iterates is less than this value.
x_max_order (int) – Maximum order on Gaussian quadrature in the x dimension the integration stops at.
x_min_order (int) – Minimum order on Gaussian quadrature in the x dimension the integration starts from.
y_max_order (int) – Maximum order on Gaussian quadrature in the y dimension the integration stops at.
y_min_order (int) – Minimum order on Gaussian quadrature in the y dimension the integration starts from.
- relative_tolerance¶
Iteration stops when relative error between last two iterates is less than this value.
- Return type:
double
- x_max_order¶
Maximum order on Gaussian quadrature in the x dimension.
- Return type:
int
- x_min_order¶
Minimum order on Gaussian quadrature in the x dimension.
- Return type:
int
- y_max_order¶
Maximum order on Gaussian quadrature in the y dimension.
- Return type:
int
- y_min_order¶
Minimum order on Gaussian quadrature in the y dimension.
- Return type:
int