public abstract class GaussianQuadratureIntegrator1D extends Integrator1D<Double,Double>
If a function $f(x)$ can be written as $f(x) = W(x)g(x)$, where $g(x)$ is
approximately polynomial, then for suitably chosen weights $w_i$ and points
$x_i$, the integral can be approximated as:
$$
\begin{align*}
\int_{-1}^1 f(x)dx
&=\int_{-1}^1 W(x)g(x)dx\\
&\approx \sum_{\i=1}^{n} w_i f(x_i)
\end{align*}
$$
The evaluation points, weights and valid limits of integration depend on the type of orthogonal
polynomials that are used
(see OrthogonalPolynomialFunctionGenerator and GaussLaguerreWeightAndAbscissaFunction).
| Constructor and Description |
|---|
GaussianQuadratureIntegrator1D(int n,
QuadratureWeightAndAbscissaFunction generator)
Creates an instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
abstract Function<Double,Double> |
getIntegralFunction(Function<Double,Double> function,
Double lower,
Double upper)
Returns a function that is valid for both the type of quadrature and the limits of integration.
|
abstract Double[] |
getLimits()
Gets the limits.
|
int |
hashCode() |
Double |
integrate(Function<Double,Double> function,
Double lower,
Double upper)
1-D integration method.
|
double |
integrateFromPolyFunc(Function<Double,Double> polyFunction)
If a function $g(x)$ can be written as $W(x)f(x)$, where the weight function $W(x)$ corresponds
to one of the Gaussian quadrature forms, then we may approximate the integral of $g(x)$ over
a specific range as $\int^b_a g(x) dx =\int^b_a W(x)f(x) dx \approx \sum_{i=0}^{N-1} w_i f(x_i)$,
were the abscissas $x_i$ and the weights $w_i$ have been precomputed.
|
integratepublic GaussianQuadratureIntegrator1D(int n,
QuadratureWeightAndAbscissaFunction generator)
n - The number of sample points to be used in the integration, not negative or zerogenerator - The generator of weights and abscissaspublic Double integrate(Function<Double,Double> function, Double lower, Double upper)
integrate in class Integrator1D<Double,Double>function - The function to integrate, not nulllower - The lower bound, not nullupper - The upper bound, not nullpublic double integrateFromPolyFunc(Function<Double,Double> polyFunction)
polyFunction - The function $f(x)$ rather than the full function $g(x) = W(x)f(x)$
This should be well approximated by a polynomial.public abstract Double[] getLimits()
public abstract Function<Double,Double> getIntegralFunction(Function<Double,Double> function, Double lower, Double upper)
function - The function to be integrated, not nulllower - The lower integration limit, not nullupper - The upper integration limit, not nullCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.