Class ExtendedTrapezoidIntegrator1D
- java.lang.Object
-
- com.opengamma.strata.math.impl.integration.Integrator1D<Double,Double>
-
- com.opengamma.strata.math.impl.integration.ExtendedTrapezoidIntegrator1D
-
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 Summary
Constructors Constructor Description ExtendedTrapezoidIntegrator1D()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Double
integrate(Function<Double,Double> f, Double lower, Double upper)
Trapezoid integration method.-
Methods inherited from class com.opengamma.strata.math.impl.integration.Integrator1D
integrate
-
-
-
-
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 classIntegrator1D<Double,Double>
- Parameters:
f
- The function to integrate, not nulllower
- The lower bound, not nullupper
- The upper bound, not null- Returns:
- The result of the integration
-
-