Class GaussianQuadratureIntegrator1D

    • Constructor Detail

      • GaussianQuadratureIntegrator1D

        public GaussianQuadratureIntegrator1D​(int n,
                                              QuadratureWeightAndAbscissaFunction generator)
        Creates an instance.
        Parameters:
        n - The number of sample points to be used in the integration, not negative or zero
        generator - The generator of weights and abscissas
    • Method Detail

      • integrate

        public Double integrate​(Function<Double,​Double> function,
                                Double lower,
                                Double upper)
        1-D integration method.
        Specified by:
        integrate in class Integrator1D<Double,​Double>
        Parameters:
        function - The function to integrate, not null
        lower - The lower bound, not null
        upper - The upper bound, not null
        Returns:
        The result of the integration
      • integrateFromPolyFunc

        public 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. This is accurate if $f(x)$ can be approximated by a polynomial.
        Parameters:
        polyFunction - The function $f(x)$ rather than the full function $g(x) = W(x)f(x)$ This should be well approximated by a polynomial.
        Returns:
        The integral
      • getLimits

        public abstract Double[] getLimits()
        Gets the limits.
        Returns:
        The lower and upper limits for which the quadrature is valid
      • getIntegralFunction

        public 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.
        Parameters:
        function - The function to be integrated, not null
        lower - The lower integration limit, not null
        upper - The upper integration limit, not null
        Returns:
        A function in the appropriate form for integration
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object