Class ExtendedTrapezoidIntegrator1D

  • All Implemented Interfaces:

    public class ExtendedTrapezoidIntegrator1D
    extends Integrator1D<Double,​Double>
    The trapezoid integration rule is a two-point Newton-Cotes formula that approximates the area under the curve as a trapezoid. For a function $f(x)$, $$ \begin{align*} \int^{x_2} _{x_1} f(x)dx \approx \frac{1}{2}(x_2 - x_1)(f(x_1) + f(x_2)) \end{align*} $$

    This class is a wrapper for the Commons Math library implementation of trapezoidal integration.

    • Constructor Detail

      • ExtendedTrapezoidIntegrator1D

        public ExtendedTrapezoidIntegrator1D()
    • Method Detail

      • integrate

        public Double integrate​(Function<Double,​Double> f,
                                Double lower,
                                Double upper)
        Trapezoid integration method. Note that the Commons implementation fails if the lower bound is larger than the upper - in this case, the bounds are reversed and the result negated. 1-D integration method.
        Specified by:
        integrate in class Integrator1D<Double,​Double>
        f - The function to integrate, not null
        lower - The lower bound, not null
        upper - The upper bound, not null
        The result of the integration